n8n/packages/nodes-base/nodes/CompareDatasets/test/node/workflow.compareDatasets.json

880 lines
19 KiB
JSON

{
"name": "compare datasets tests",
"nodes": [
{
"parameters": {},
"id": "c8767bae-66ba-495c-9d2c-4b0cc192ea22",
"name": "Start",
"type": "n8n-nodes-base.start",
"typeVersion": 1,
"position": [-1020, 1640]
},
{
"parameters": {
"mergeByFields": {
"values": [
{
"field1": "id",
"field2": "id"
},
{
"field1": "text",
"field2": "text"
}
]
},
"options": {
"multipleMatches": "first"
}
},
"id": "80490760-2b76-4e22-977d-6c5142a5ec99",
"name": "Compare",
"type": "n8n-nodes-base.compareDatasets",
"typeVersion": 1,
"position": [180, 680]
},
{
"parameters": {
"functionCode": "const data = [\n {\n id: 1,\n text: 'foo',\n data: 'A',\n data2: 555,\n memo: 'test',\n },\n {\n id: 2,\n text: 'bar bar',\n data: 'E',\n },\n {\n id: 3,\n text: 'spam',\n data: 'C',\n },\n {\n id: 4,\n text: 'not matched',\n data: 'Y',\n },\n];\n\nreturn data;"
},
"id": "3f4b329b-9d7f-475b-815a-5bb7abfae247",
"name": "Function",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [-100, 600]
},
{
"parameters": {
"functionCode": "const data = [\n {\n id: 1,\n text: 'foo',\n data: 'D',\n data3: 111,\n memo: 'test'\n },\n {\n id: 1,\n text: 'foo',\n data: 'DD',\n },\n {\n id: 2,\n text: 'bar bar',\n data: 'E',\n },\n {\n id: 3,\n text: 'spam',\n data: 'F',\n },\n {\n id: 5,\n text: 'spam',\n data: 'X',\n },\n];\n\nreturn data;"
},
"id": "a91e7fe8-b9fb-417f-a434-c15623246c99",
"name": "Function1",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [-100, 760]
},
{
"parameters": {
"functionCode": "if (!(items.length === 2) && items.filter(({json}) => json.text === 'foo' || 'spam').length !== 2) {\n throw new Error('Incorrect data');\n}\n\nreturn {success: true};"
},
"id": "bef942a0-21f4-469d-b019-e528140d9686",
"name": "Function2",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [440, 900]
},
{
"parameters": {
"functionCode": "if (!(items.length === 1) && items[0].json.data !== 'Y') {\n throw new Error('Incorrect data');\n}\n\nreturn {success: true};"
},
"id": "29b9aa7a-4d1f-442d-9487-7f46e0cba1fe",
"name": "Function3",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [440, 440]
},
{
"parameters": {
"functionCode": "if (!(items.length === 1) && items[0].json.data !== 'E') {\n throw new Error('Incorrect data');\n}\n\nreturn {success: true};"
},
"id": "5669e2d2-6cfe-4df2-9513-3871df1fb7f1",
"name": "Function4",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [440, 580]
},
{
"parameters": {
"functionCode": "if (!(items.length === 2) && items.filter(({json}) => json.text === 'foo' || 'spam').length !== 2) {\n throw new Error('Incorrect data');\n}\n\nreturn {success: true};"
},
"id": "4f7c534d-da1d-4947-8deb-9736c83e8956",
"name": "Function5",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [440, 740]
},
{
"parameters": {},
"id": "916d4bb7-066f-41cb-9a4b-c4ce34643923",
"name": "first match only by id and text",
"type": "n8n-nodes-base.noOp",
"typeVersion": 1,
"position": [-340, 680]
},
{
"parameters": {
"mergeByFields": {
"values": [
{
"field1": "id",
"field2": "id"
}
]
},
"resolve": "includeBoth",
"options": {
"multipleMatches": "all"
}
},
"id": "ecb9384d-79b2-4ea8-9a44-a1bb9064311d",
"name": "Compare1",
"type": "n8n-nodes-base.compareDatasets",
"typeVersion": 1,
"position": [160, 1340]
},
{
"parameters": {
"functionCode": "const data = [\n {\n id: 1,\n data: 'A',\n },\n {\n id: 2,\n data: 'B',\n },\n {\n id: 3,\n data: 'C',\n },\n];\n\nreturn data;"
},
"id": "d218a3b7-1f10-42d8-be27-155f15682855",
"name": "Function6",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [-120, 1260]
},
{
"parameters": {
"functionCode": "const data = [\n {\n id: 1,\n data: 'D',\n },\n {\n id: 1,\n data: 'DD',\n },\n {\n id: 2,\n data: 'E',\n },\n {\n id: 2,\n data: 'EE',\n },\n {\n id: 3,\n data: 'F',\n },\n {\n id: 3,\n data: 'FF',\n },\n {\n id: 5,\n data: 'X',\n },\n];\n\nreturn data;"
},
"id": "7d8e9189-b8e7-4893-96ac-05533d846503",
"name": "Function7",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [-120, 1420]
},
{
"parameters": {
"functionCode": "if (\n items.filter(({json}) => json.id === 5).length !== 1 \n) {\n throw new Error('Incorrect data');\n}\n\n\nreturn {success: true};"
},
"id": "d030711e-4627-456d-936a-5fa433719b77",
"name": "Function8",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [540, 1440]
},
{
"parameters": {
"functionCode": "if (\n items.filter(({json}) => json.keys.id === 1).length !== 2 &&\n items.filter(({json}) => json.keys.id === 2).length !== 2 &&\n items.filter(({json}) => json.keys.id === 3).length !== 2\n) {\n throw new Error('Incorrect data');\n}\n\nreturn {success: true};"
},
"id": "c2033b2a-7046-411a-8a8f-8ed8b46a97e3",
"name": "Function11",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [540, 1280]
},
{
"parameters": {},
"id": "d762ad62-1101-4ef4-912c-d1c6f5dc62fc",
"name": "all match by id",
"type": "n8n-nodes-base.noOp",
"typeVersion": 1,
"position": [-360, 1340]
},
{
"parameters": {
"mergeByFields": {
"values": [
{
"field1": "id.code",
"field2": "id.code"
}
]
},
"resolve": "mix",
"exceptWhenMix": "data",
"options": {
"multipleMatches": "all"
}
},
"id": "f9e2ccd7-ca40-400a-85eb-32c75169519c",
"name": "Compare2",
"type": "n8n-nodes-base.compareDatasets",
"typeVersion": 1,
"position": [160, 1980]
},
{
"parameters": {
"functionCode": "const data = [\n {\n id: {code: 1},\n data: 'A',\n },\n {\n id: {code: 2},\n data: 'B',\n },\n {\n id: {code: 3},\n data: 'C',\n },\n {\n id: {code: 4},\n data: 'AA',\n },\n];\n\nreturn data;"
},
"id": "e70cc695-01f5-456c-bdef-bcd85f4c90db",
"name": "Function12",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [-120, 1900]
},
{
"parameters": {
"functionCode": "const data = [\n {\n id: {code: 1},\n data: 'A',\n },\n {\n id: {code: 2},\n data: 'E',\n },\n {\n id: {code: 3},\n data: 'F',\n },\n {\n id: {code: 5},\n data: 'EE',\n },\n];\n\nreturn data;"
},
"id": "ae9aea77-57b4-4b5a-bb1f-cedda223a357",
"name": "Function13",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [-120, 2060]
},
{
"parameters": {
"mergeByFields": {
"values": [
{
"field1": "id.code",
"field2": "id.code"
}
]
},
"resolve": "includeBoth",
"options": {}
},
"id": "83c6ebd3-dbf3-4175-bf04-313ef47b359e",
"name": "Compare3",
"type": "n8n-nodes-base.compareDatasets",
"typeVersion": 1,
"position": [160, 2480],
"continueOnFail": true
},
{
"parameters": {
"functionCode": "const data = [\n {\n id: {code: 1},\n data: 'A',\n },\n {\n id: {code: 2},\n data: 'B',\n },\n {\n id: {code: 3},\n data: 'C',\n },\n {\n 'id.code': 'AAA',\n },\n];\n\nreturn data;"
},
"id": "91d3256e-dda8-4d8f-9796-f2ab5c5e6372",
"name": "Function18",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [-100, 2400]
},
{
"parameters": {
"functionCode": "const data = [\n {\n id: {code: 1},\n data: 'D',\n },\n {\n id: {code: 2},\n data: 'E',\n },\n {\n id: {code: 3},\n data: 'F',\n },\n {\n 'id.code': 'AAA',\n },\n];\n\nreturn data;"
},
"id": "36651bfd-6835-429a-b6f6-eb2cf4ab0178",
"name": "Function19",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [-100, 2560]
},
{
"parameters": {
"functionCode": "if (items[0].json.data !== 'EE') {\n throw new Error('Incorrect data');\n}\n\nreturn {success: true};"
},
"id": "b1929edc-cecb-4e0e-9698-e2210df4d839",
"name": "Function14",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [420, 2240]
},
{
"parameters": {
"functionCode": "if (items[0].json.data !== 'AA') {\n throw new Error('Incorrect data');\n}\n\nreturn {success: true};"
},
"id": "ffa2e4be-a352-466d-90fd-6be7be8df2c4",
"name": "Function15",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [420, 1780]
},
{
"parameters": {
"functionCode": "if (items[0].json.data !== 'A') {\n throw new Error('Incorrect data');\n}\n\nreturn {success: true};"
},
"id": "3f1d1ed6-06ac-43d8-85f8-e290fd3ffbca",
"name": "Function16",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [420, 1920]
},
{
"parameters": {
"functionCode": "if (items.filter(({json}) => json.data === 'E').length !== 1 && items.filter(({json}) => json.data === 'F').length !== 1) {\n throw new Error('Incorrect data');\n}\n\nreturn {success: true};"
},
"id": "6a0501c1-922f-48a4-813b-64106da3c988",
"name": "Function17",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [420, 2080]
},
{
"parameters": {
"functionCode": "if (!(items.length === 3)) {\n throw new Error('Incorrect data');\n}\n\nreturn {success: true};"
},
"id": "10ce1673-eb0d-4794-a104-05abf0240a8e",
"name": "Function20",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [440, 2560]
},
{
"parameters": {},
"id": "57138e79-dad4-43c4-b805-9e1cda72cb76",
"name": "matching by dot notation",
"type": "n8n-nodes-base.noOp",
"typeVersion": 1,
"position": [-340, 2480]
},
{
"parameters": {},
"id": "ea46b0bd-bd94-453d-b64e-1574c31fdac4",
"name": "matches mix prefer input 1",
"type": "n8n-nodes-base.noOp",
"typeVersion": 1,
"position": [-360, 1980]
},
{
"parameters": {
"functionCode": "if (items[0].json['id.code'] !== 'AAA') {\n throw new Error('Incorrect data');\n}\n\nreturn {success: true};"
},
"id": "55362767-c887-4f31-9a23-fd171869e19f",
"name": "Function21",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [440, 2420]
},
{
"parameters": {
"mergeByFields": {
"values": [
{
"field1": "id.code",
"field2": "id.code"
}
]
},
"resolve": "includeBoth",
"options": {
"disableDotNotation": true
}
},
"id": "542ad5ce-31e7-4a26-b561-757a0fa500c9",
"name": "Compare4",
"type": "n8n-nodes-base.compareDatasets",
"typeVersion": 1,
"position": [180, 2860],
"continueOnFail": true
},
{
"parameters": {
"functionCode": "const data = [\n {\n id: {code: 1},\n data: 'A',\n },\n {\n id: {code: 2},\n data: 'B',\n },\n {\n id: {code: 3},\n data: 'C',\n },\n {\n 'id.code': 'AAA',\n },\n];\n\nreturn data;"
},
"id": "8563aa7c-3e6c-47ba-999b-1fee0489a647",
"name": "Function22",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [-80, 2780]
},
{
"parameters": {
"functionCode": "const data = [\n {\n id: {code: 1},\n data: 'D',\n },\n {\n id: {code: 2},\n data: 'E',\n },\n {\n id: {code: 3},\n data: 'F',\n },\n {\n 'id.code': 'AAA',\n },\n];\n\nreturn data;"
},
"id": "e5dc38cb-c5c3-4ae2-8bb4-5b1ef74c0a3f",
"name": "Function23",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [-80, 2940]
},
{
"parameters": {
"functionCode": "if (items.length !== 3) {\n throw new Error('Incorrect data');\n}\n\nreturn {success: true};"
},
"id": "7739d61b-f62b-47ad-81b5-5fb38b919e01",
"name": "Function24",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [460, 3020]
},
{
"parameters": {
"functionCode": "if (items[0].json['id.code'] !== 'AAA') {\n throw new Error('Incorrect data');\n}\n\nreturn {success: true};"
},
"id": "805f2f3d-51e7-45ad-94d3-ebb9a1c47964",
"name": "Function25",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [460, 2880]
},
{
"parameters": {
"functionCode": "if (items.length !== 3) {\n throw new Error('Incorrect data');\n}\n\nreturn {success: true};"
},
"id": "b82d6133-783d-4777-818d-dbcbe3a82042",
"name": "Function26",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [460, 2740]
},
{
"parameters": {},
"id": "1ba0048e-e032-4f6a-903c-3aaf0598f191",
"name": "disabled dot notation1",
"type": "n8n-nodes-base.noOp",
"typeVersion": 1,
"position": [-320, 2860]
}
],
"pinData": {
"Function3": [
{
"json": {
"success": true
}
}
],
"Function4": [
{
"json": {
"success": true
}
}
],
"Function5": [
{
"json": {
"success": true
}
}
],
"Function2": [
{
"json": {
"success": true
}
}
],
"Function11": [
{
"json": {
"success": true
}
}
],
"Function8": [
{
"json": {
"success": true
}
}
],
"Function15": [
{
"json": {
"success": true
}
}
],
"Function16": [
{
"json": {
"success": true
}
}
],
"Function17": [
{
"json": {
"success": true
}
}
],
"Function14": [
{
"json": {
"success": true
}
}
],
"Function21": [
{
"json": {
"success": true
}
}
],
"Function20": [
{
"json": {
"success": true
}
}
],
"Function26": [
{
"json": {
"success": true
}
}
],
"Function25": [
{
"json": {
"success": true
}
}
],
"Function24": [
{
"json": {
"success": true
}
}
]
},
"connections": {
"Function": {
"main": [
[
{
"node": "Compare",
"type": "main",
"index": 0
}
]
]
},
"Function1": {
"main": [
[
{
"node": "Compare",
"type": "main",
"index": 1
}
]
]
},
"Compare": {
"main": [
[
{
"node": "Function3",
"type": "main",
"index": 0
}
],
[
{
"node": "Function4",
"type": "main",
"index": 0
}
],
[
{
"node": "Function5",
"type": "main",
"index": 0
}
],
[
{
"node": "Function2",
"type": "main",
"index": 0
}
]
]
},
"first match only by id and text": {
"main": [
[
{
"node": "Function",
"type": "main",
"index": 0
},
{
"node": "Function1",
"type": "main",
"index": 0
}
]
]
},
"Compare1": {
"main": [
[],
[],
[
{
"node": "Function11",
"type": "main",
"index": 0
}
],
[
{
"node": "Function8",
"type": "main",
"index": 0
}
]
]
},
"Function6": {
"main": [
[
{
"node": "Compare1",
"type": "main",
"index": 0
}
]
]
},
"Function7": {
"main": [
[
{
"node": "Compare1",
"type": "main",
"index": 1
}
]
]
},
"all match by id": {
"main": [
[
{
"node": "Function6",
"type": "main",
"index": 0
},
{
"node": "Function7",
"type": "main",
"index": 0
}
]
]
},
"Compare2": {
"main": [
[
{
"node": "Function15",
"type": "main",
"index": 0
}
],
[
{
"node": "Function16",
"type": "main",
"index": 0
}
],
[
{
"node": "Function17",
"type": "main",
"index": 0
}
],
[
{
"node": "Function14",
"type": "main",
"index": 0
}
]
]
},
"Function12": {
"main": [
[
{
"node": "Compare2",
"type": "main",
"index": 0
}
]
]
},
"Function13": {
"main": [
[
{
"node": "Compare2",
"type": "main",
"index": 1
}
]
]
},
"Function18": {
"main": [
[
{
"node": "Compare3",
"type": "main",
"index": 0
}
]
]
},
"Function19": {
"main": [
[
{
"node": "Compare3",
"type": "main",
"index": 1
}
]
]
},
"Compare3": {
"main": [
[],
[
{
"node": "Function21",
"type": "main",
"index": 0
}
],
[
{
"node": "Function20",
"type": "main",
"index": 0
}
]
]
},
"Start": {
"main": [
[
{
"node": "first match only by id and text",
"type": "main",
"index": 0
},
{
"node": "all match by id",
"type": "main",
"index": 0
},
{
"node": "matches mix prefer input 1",
"type": "main",
"index": 0
},
{
"node": "matching by dot notation",
"type": "main",
"index": 0
},
{
"node": "disabled dot notation1",
"type": "main",
"index": 0
}
]
]
},
"matching by dot notation": {
"main": [
[
{
"node": "Function18",
"type": "main",
"index": 0
},
{
"node": "Function19",
"type": "main",
"index": 0
}
]
]
},
"matches mix prefer input 1": {
"main": [
[
{
"node": "Function12",
"type": "main",
"index": 0
},
{
"node": "Function13",
"type": "main",
"index": 0
}
]
]
},
"Compare4": {
"main": [
[
{
"node": "Function26",
"type": "main",
"index": 0
}
],
[
{
"node": "Function25",
"type": "main",
"index": 0
}
],
[],
[
{
"node": "Function24",
"type": "main",
"index": 0
}
]
]
},
"Function22": {
"main": [
[
{
"node": "Compare4",
"type": "main",
"index": 0
}
]
]
},
"Function23": {
"main": [
[
{
"node": "Compare4",
"type": "main",
"index": 1
}
]
]
},
"disabled dot notation1": {
"main": [
[
{
"node": "Function22",
"type": "main",
"index": 0
},
{
"node": "Function23",
"type": "main",
"index": 0
}
]
]
}
},
"active": false,
"settings": {},
"versionId": "7169a2ae-a8dd-47a1-8339-8ca7554587a9",
"id": "114",
"meta": {
"instanceId": "36203ea1ce3cef713fa25999bd9874ae26b9e4c2c3a90a365f2882a154d031d0"
},
"tags": []
}