diff --git a/packages/nodes-base/nodes/CompareDatasets/test/node/CompareDatasets.test.ts b/packages/nodes-base/nodes/CompareDatasets/test/node/CompareDatasets.test.ts new file mode 100644 index 0000000000..80c545b795 --- /dev/null +++ b/packages/nodes-base/nodes/CompareDatasets/test/node/CompareDatasets.test.ts @@ -0,0 +1,5 @@ +import { testWorkflows, getWorkflowFilenames } from '../../../../test/nodes/Helpers'; + +const workflows = getWorkflowFilenames(__dirname); + +describe('Test Compare Datasets Node', () => testWorkflows(workflows)); diff --git a/packages/nodes-base/nodes/CompareDatasets/test/node/workflow.compareDatasets.fuzzy.json b/packages/nodes-base/nodes/CompareDatasets/test/node/workflow.compareDatasets.fuzzy.json new file mode 100644 index 0000000000..f3d24a243e --- /dev/null +++ b/packages/nodes-base/nodes/CompareDatasets/test/node/workflow.compareDatasets.fuzzy.json @@ -0,0 +1,1054 @@ +{ + "name": "compare datasets fuzzy search", + "nodes": [ + { + "parameters": {}, + "id": "0600a6c9-83c5-4bb8-a2ee-d763406b2f9f", + "name": "On clicking 'execute'", + "type": "n8n-nodes-base.manualTrigger", + "typeVersion": 1, + "position": [160, 2200] + }, + { + "parameters": { + "jsCode": "return [\n {\n id: '1',\n data: [1,2,3],\n },\n {\n id: 2,\n data: 25,\n },\n {\n id: 3,\n data: true,\n },\n {\n id: 4,\n data: false,\n },\n {\n id: '5',\n data: true,\n },\n {\n id: 6,\n data: null,\n },\n {\n id: 7,\n data: '',\n },\n {\n id: '8',\n data: [],\n },\n];" + }, + "id": "a9204c1d-11da-4f54-9a52-82992815e893", + "name": "Code", + "type": "n8n-nodes-base.code", + "typeVersion": 1, + "position": [640, 300] + }, + { + "parameters": { + "jsCode": "return [\n {\n id: 1,\n data: \"[1,2,3]\",\n },\n {\n id: 2,\n data: '25',\n },\n {\n id: 3,\n data: 'tRuE',\n },\n {\n id: 4,\n data: 'FalsE',\n },\n {\n id: 5,\n data: 1,\n },\n {\n id: 6,\n data: [],\n },\n {\n id: 7,\n data: null,\n },\n {\n id: 8,\n data: '',\n },\n];" + }, + "id": "839119da-4372-442d-8ba6-7d57b53b7825", + "name": "Code1", + "type": "n8n-nodes-base.code", + "typeVersion": 1, + "position": [640, 500] + }, + { + "parameters": { + "mergeByFields": { + "values": [ + { + "field1": "id", + "field2": "id" + } + ] + }, + "resolve": "preferInput1", + "options": { + "fuzzyCompare": true + } + }, + "id": "c950a588-900b-4eba-a94b-566e27a5f5b6", + "name": "Compare Datasets", + "type": "n8n-nodes-base.compareDatasets", + "typeVersion": 1, + "position": [940, 260] + }, + { + "parameters": { + "mergeByFields": { + "values": [ + { + "field1": "id", + "field2": "id" + } + ] + }, + "options": { + "fuzzyCompare": true + } + }, + "id": "b4886a20-3c69-4233-a66b-91ed19693647", + "name": "Compare Datasets1", + "type": "n8n-nodes-base.compareDatasets", + "typeVersion": 1, + "position": [940, 540] + }, + { + "parameters": { + "jsCode": "return [\n {\n id: 1,\n data: [1,2,3],\n },\n {\n id: 2,\n data: '[\"a\", \"b\", \"c\"]',\n },\n {\n id: 3,\n data: [],\n },\n];" + }, + "id": "f0a7fbcf-226a-4b19-a946-5a0d8480bbb8", + "name": "Code2", + "type": "n8n-nodes-base.code", + "typeVersion": 1, + "position": [640, 680] + }, + { + "parameters": { + "jsCode": "return [\n {\n id: '1',\n data: \"[1,2,3]\",\n },\n {\n id: 2,\n data: ['a', 'b', 'c'],\n },\n {\n id: 3,\n data: \"[]\",\n },\n];" + }, + "id": "9d510249-3eff-4264-8f93-1959480fd100", + "name": "Code3", + "type": "n8n-nodes-base.code", + "typeVersion": 1, + "position": [640, 880] + }, + { + "parameters": { + "mergeByFields": { + "values": [ + { + "field1": "id", + "field2": "id" + } + ] + }, + "options": { + "fuzzyCompare": true + } + }, + "id": "80782eeb-bf05-402a-a169-a44d32e189d9", + "name": "Compare Datasets2", + "type": "n8n-nodes-base.compareDatasets", + "typeVersion": 1, + "position": [920, 800] + }, + { + "parameters": { + "jsCode": "return [\n {\n id: 1,\n data: 25.36,\n },\n {\n id: 2,\n data: 2500,\n },\n {\n id: 3,\n data: 0.894,\n },\n {\n id: 4,\n data: 42,\n },\n];" + }, + "id": "eb4e5ee5-5f9e-413e-bd80-11d75bff9f90", + "name": "Code4", + "type": "n8n-nodes-base.code", + "typeVersion": 1, + "position": [620, 1100] + }, + { + "parameters": { + "jsCode": "return [\n {\n id: 1,\n data: '25.36',\n },\n {\n id: 2,\n data: '2500',\n },\n {\n id: 3,\n data: '0.894',\n },\n {\n id: 4,\n data: 'forty two',\n },\n];" + }, + "id": "28d3f7f4-abba-4523-9b5b-1bcf47d6dbec", + "name": "Code5", + "type": "n8n-nodes-base.code", + "typeVersion": 1, + "position": [620, 1300] + }, + { + "parameters": { + "mergeByFields": { + "values": [ + { + "field1": "id", + "field2": "id" + } + ] + }, + "resolve": "includeBoth", + "options": { + "fuzzyCompare": true + } + }, + "id": "661c9b3e-f5c7-41a2-9f48-4e2648c657d4", + "name": "Compare Datasets3", + "type": "n8n-nodes-base.compareDatasets", + "typeVersion": 1, + "position": [900, 1180] + }, + { + "parameters": { + "jsCode": "return [\n {\n id: 1,\n data: \"TRUE\",\n },\n {\n id: 2,\n data: false,\n },\n {\n id: 3,\n data: 1,\n },\n {\n id: 4,\n data: false,\n },\n {\n id: '5',\n data: true,\n },\n {\n id: 6,\n data: '0',\n },\n];" + }, + "id": "bf4f3286-db11-4075-a10a-6c19b60ef8cf", + "name": "Code6", + "type": "n8n-nodes-base.code", + "typeVersion": 1, + "position": [620, 1480] + }, + { + "parameters": { + "jsCode": "return [\n {\n id: 1,\n data: true,\n },\n {\n id: 2,\n data: 'False',\n },\n {\n id: 3,\n data: true,\n },\n {\n id: 4,\n data: 0,\n },\n {\n id: '5',\n data: '1',\n },\n {\n id: 6,\n data: false,\n },\n];" + }, + "id": "731b6fc7-0a57-449e-b9c4-54f1feeec9be", + "name": "Code7", + "type": "n8n-nodes-base.code", + "typeVersion": 1, + "position": [620, 1680] + }, + { + "parameters": { + "mergeByFields": { + "values": [ + { + "field1": "id", + "field2": "id" + } + ] + }, + "options": { + "fuzzyCompare": true + } + }, + "id": "72fcf699-62b7-42c6-b6a8-4c8af514eaa7", + "name": "Compare Datasets4", + "type": "n8n-nodes-base.compareDatasets", + "typeVersion": 1, + "position": [880, 1580] + }, + { + "parameters": { + "jsCode": "return [\n {\n id: '1',\n data: null,\n },\n {\n id: 2,\n data: null,\n },\n {\n id: 3,\n data: null,\n },\n {\n id: 4,\n data: [],\n },\n {\n id: '5',\n data: '',\n },\n {\n id: 6,\n data: '',\n },\n {\n id: 7,\n data: [],\n },\n];" + }, + "id": "f75820ed-4f8f-49b7-af25-3bbd0691eafd", + "name": "Code8", + "type": "n8n-nodes-base.code", + "typeVersion": 1, + "position": [620, 1860] + }, + { + "parameters": { + "jsCode": "return [\n {\n id: '1',\n data: '',\n },\n {\n id: 2,\n data: [],\n },\n {\n id: 3,\n data: null,\n },\n {\n id: 4,\n data: '',\n },\n {\n id: '5',\n data: [],\n },\n {\n id: 6,\n data: '',\n },\n {\n id: 7,\n data: [],\n },\n];" + }, + "id": "abe98ef5-0b3a-4e06-8a5d-f0554e42cf33", + "name": "Code9", + "type": "n8n-nodes-base.code", + "typeVersion": 1, + "position": [620, 2060] + }, + { + "parameters": { + "mergeByFields": { + "values": [ + { + "field1": "id", + "field2": "id" + } + ] + }, + "options": { + "fuzzyCompare": true + } + }, + "id": "0f86d545-5612-4743-8d18-593e95b1b95d", + "name": "Compare Datasets5", + "type": "n8n-nodes-base.compareDatasets", + "typeVersion": 1, + "position": [880, 1960] + }, + { + "parameters": { + "jsCode": "return [\n {\n id: 1,\n data: {foo: 'foo', bar: 'bar'},\n },\n {\n id: 2,\n data: '{\"foo\": \"foo\", \"bar\": \"bar\"}',\n },\n {\n id: 3,\n data: {},\n },\n];" + }, + "id": "c516813c-a5c7-464e-887b-447e5177c137", + "name": "Code10", + "type": "n8n-nodes-base.code", + "typeVersion": 1, + "position": [640, 2440] + }, + { + "parameters": { + "jsCode": "return [\n {\n id: 2,\n data: {foo: 'foo', bar: 'bar'},\n },\n {\n id: 1,\n data: '{\"foo\": \"foo\", \"bar\": \"bar\"}',\n },\n {\n id: 3,\n data: \"{}\",\n },\n];" + }, + "id": "a0986a04-da68-47e7-9a06-f7abf83604c8", + "name": "Code11", + "type": "n8n-nodes-base.code", + "typeVersion": 1, + "position": [640, 2640] + }, + { + "parameters": { + "mergeByFields": { + "values": [ + { + "field1": "id", + "field2": "id" + } + ] + }, + "resolve": "includeBoth", + "options": { + "fuzzyCompare": true + } + }, + "id": "a60fd8e1-962e-40e9-b00d-847ef424f2be", + "name": "Compare Datasets6", + "type": "n8n-nodes-base.compareDatasets", + "typeVersion": 1, + "position": [920, 2560] + }, + { + "parameters": { + "jsCode": "return [\n {\n id: 1,\n data: \"2019-08-30T22:54:40.273Z\",\n },\n {\n id: 2,\n data: '{\"foo\": \"foo\", \"bar\": \"bar\"}',\n },\n {\n id: 3,\n data: {},\n },\n];" + }, + "id": "80c1f595-9d0e-4df9-b927-4b1459e217c1", + "name": "Code12", + "type": "n8n-nodes-base.code", + "typeVersion": 1, + "position": [640, 2860] + }, + { + "parameters": { + "jsCode": "return [\n {\n id: 1,\n data: 'Sat Aug 31 2019 01:54:40 GMT+0300 (Eastern European Summer Time)',\n },\n {\n id: 2,\n data: '{\"foo\": \"foo\", \"bar\": \"bar\"}',\n },\n {\n id: 3,\n data: \"{}\",\n },\n];" + }, + "id": "d9764a14-2b8b-4a12-ad06-8a4f09685e62", + "name": "Code13", + "type": "n8n-nodes-base.code", + "typeVersion": 1, + "position": [640, 3060] + }, + { + "parameters": { + "mergeByFields": { + "values": [ + { + "field1": "id", + "field2": "id" + } + ] + }, + "resolve": "includeBoth", + "options": { + "fuzzyCompare": true + } + }, + "id": "e7c46e07-4f65-4ba8-8435-2b8284567bdd", + "name": "Compare Datasets7", + "type": "n8n-nodes-base.compareDatasets", + "typeVersion": 1, + "position": [920, 2980] + }, + { + "parameters": {}, + "id": "7a8fd2b3-a55e-43a0-af3d-5621b42bbd06", + "name": "No Operation, do nothing", + "type": "n8n-nodes-base.noOp", + "typeVersion": 1, + "position": [1200, 200] + }, + { + "parameters": {}, + "id": "cfe4cf23-3329-4c7d-89f1-9e358eba9265", + "name": "No Operation, do nothing1", + "type": "n8n-nodes-base.noOp", + "typeVersion": 1, + "position": [1220, 480] + }, + { + "parameters": {}, + "id": "4b55d3ee-ada6-4b72-beee-f9c5bbf8531b", + "name": "No Operation, do nothing2", + "type": "n8n-nodes-base.noOp", + "typeVersion": 1, + "position": [1220, 680] + }, + { + "parameters": {}, + "id": "b55e855b-ad71-439b-aa76-f0cb38b137d1", + "name": "No Operation, do nothing3", + "type": "n8n-nodes-base.noOp", + "typeVersion": 1, + "position": [1200, 1020] + }, + { + "parameters": {}, + "id": "a64cbf1e-3701-498e-b4a7-47353f15d602", + "name": "No Operation, do nothing4", + "type": "n8n-nodes-base.noOp", + "typeVersion": 1, + "position": [1200, 1260] + }, + { + "parameters": {}, + "id": "52b6b2e2-c8f6-4b22-a469-da437d092a5a", + "name": "No Operation, do nothing5", + "type": "n8n-nodes-base.noOp", + "typeVersion": 1, + "position": [1160, 1520] + }, + { + "parameters": {}, + "id": "dca4c5e9-db21-4cf3-8de4-9b9e32166ae1", + "name": "No Operation, do nothing6", + "type": "n8n-nodes-base.noOp", + "typeVersion": 1, + "position": [1140, 1860] + }, + { + "parameters": {}, + "id": "ee8d917b-a338-468c-9cc0-fdfbf6a76445", + "name": "No Operation, do nothing7", + "type": "n8n-nodes-base.noOp", + "typeVersion": 1, + "position": [1180, 2440] + }, + { + "parameters": {}, + "id": "95d18d83-79e8-427b-8745-55e2256cb7f5", + "name": "No Operation, do nothing8", + "type": "n8n-nodes-base.noOp", + "typeVersion": 1, + "position": [1220, 2900] + }, + { + "parameters": {}, + "id": "e191ba81-bd88-4962-bd13-36ffd752336d", + "name": "No Operation, do nothing9", + "type": "n8n-nodes-base.noOp", + "typeVersion": 1, + "position": [1220, 3100] + } + ], + "pinData": { + "No Operation, do nothing9": [ + { + "json": { + "keys": { + "id": 1 + }, + "same": { + "id": 1 + }, + "different": { + "data": { + "input1": "2019-08-30T22:54:40.273Z", + "input2": "Sat Aug 31 2019 01:54:40 GMT+0300 (Eastern European Summer Time)" + } + } + } + } + ], + "No Operation, do nothing8": [ + { + "json": { + "id": 2, + "data": "{\"foo\": \"foo\", \"bar\": \"bar\"}" + } + }, + { + "json": { + "id": 3, + "data": {} + } + } + ], + "No Operation, do nothing7": [ + { + "json": { + "id": 1, + "data": { + "foo": "foo", + "bar": "bar" + } + } + }, + { + "json": { + "id": 2, + "data": "{\"foo\": \"foo\", \"bar\": \"bar\"}" + } + }, + { + "json": { + "id": 3, + "data": {} + } + } + ], + "No Operation, do nothing6": [ + { + "json": { + "id": "1", + "data": "" + } + }, + { + "json": { + "id": 2, + "data": [] + } + }, + { + "json": { + "id": 3, + "data": null + } + }, + { + "json": { + "id": 4, + "data": "" + } + }, + { + "json": { + "id": "5", + "data": [] + } + }, + { + "json": { + "id": 6, + "data": "" + } + }, + { + "json": { + "id": 7, + "data": [] + } + } + ], + "No Operation, do nothing5": [ + { + "json": { + "id": 1, + "data": true + } + }, + { + "json": { + "id": 2, + "data": "False" + } + }, + { + "json": { + "id": 3, + "data": true + } + }, + { + "json": { + "id": 4, + "data": 0 + } + }, + { + "json": { + "id": "5", + "data": "1" + } + }, + { + "json": { + "id": 6, + "data": false + } + } + ], + "No Operation, do nothing4": [ + { + "json": { + "keys": { + "id": 4 + }, + "same": { + "id": 4 + }, + "different": { + "data": { + "input1": 42, + "input2": "forty two" + } + } + } + } + ], + "No Operation, do nothing3": [ + { + "json": { + "id": 1, + "data": 25.36 + } + }, + { + "json": { + "id": 2, + "data": 2500 + } + }, + { + "json": { + "id": 3, + "data": 0.894 + } + } + ], + "No Operation, do nothing2": [ + { + "json": { + "id": "1", + "data": "[1,2,3]" + } + }, + { + "json": { + "id": 2, + "data": ["a", "b", "c"] + } + }, + { + "json": { + "id": 3, + "data": "[]" + } + } + ], + "No Operation, do nothing1": [ + { + "json": { + "id": 1, + "data": "[1,2,3]" + } + }, + { + "json": { + "id": 2, + "data": "25" + } + }, + { + "json": { + "id": 3, + "data": "tRuE" + } + }, + { + "json": { + "id": 4, + "data": "FalsE" + } + }, + { + "json": { + "id": 5, + "data": 1 + } + }, + { + "json": { + "id": 6, + "data": [] + } + }, + { + "json": { + "id": 7, + "data": null + } + }, + { + "json": { + "id": 8, + "data": "" + } + } + ], + "No Operation, do nothing": [ + { + "json": { + "id": "1", + "data": [1, 2, 3] + } + }, + { + "json": { + "id": 2, + "data": 25 + } + }, + { + "json": { + "id": 3, + "data": true + } + }, + { + "json": { + "id": 4, + "data": false + } + }, + { + "json": { + "id": "5", + "data": true + } + }, + { + "json": { + "id": 6, + "data": null + } + }, + { + "json": { + "id": 7, + "data": "" + } + }, + { + "json": { + "id": "8", + "data": [] + } + } + ] + }, + "connections": { + "On clicking 'execute'": { + "main": [ + [ + { + "node": "Code3", + "type": "main", + "index": 0 + }, + { + "node": "Code2", + "type": "main", + "index": 0 + }, + { + "node": "Code", + "type": "main", + "index": 0 + }, + { + "node": "Code1", + "type": "main", + "index": 0 + }, + { + "node": "Code4", + "type": "main", + "index": 0 + }, + { + "node": "Code5", + "type": "main", + "index": 0 + }, + { + "node": "Code6", + "type": "main", + "index": 0 + }, + { + "node": "Code7", + "type": "main", + "index": 0 + }, + { + "node": "Code8", + "type": "main", + "index": 0 + }, + { + "node": "Code9", + "type": "main", + "index": 0 + }, + { + "node": "Code10", + "type": "main", + "index": 0 + }, + { + "node": "Code11", + "type": "main", + "index": 0 + }, + { + "node": "Code12", + "type": "main", + "index": 0 + }, + { + "node": "Code13", + "type": "main", + "index": 0 + } + ] + ] + }, + "Code1": { + "main": [ + [ + { + "node": "Compare Datasets", + "type": "main", + "index": 1 + }, + { + "node": "Compare Datasets1", + "type": "main", + "index": 1 + } + ] + ] + }, + "Code": { + "main": [ + [ + { + "node": "Compare Datasets", + "type": "main", + "index": 0 + }, + { + "node": "Compare Datasets1", + "type": "main", + "index": 0 + } + ] + ] + }, + "Code2": { + "main": [ + [ + { + "node": "Compare Datasets2", + "type": "main", + "index": 0 + } + ] + ] + }, + "Code3": { + "main": [ + [ + { + "node": "Compare Datasets2", + "type": "main", + "index": 1 + } + ] + ] + }, + "Code4": { + "main": [ + [ + { + "node": "Compare Datasets3", + "type": "main", + "index": 0 + } + ] + ] + }, + "Code5": { + "main": [ + [ + { + "node": "Compare Datasets3", + "type": "main", + "index": 1 + } + ] + ] + }, + "Code6": { + "main": [ + [ + { + "node": "Compare Datasets4", + "type": "main", + "index": 0 + } + ] + ] + }, + "Code7": { + "main": [ + [ + { + "node": "Compare Datasets4", + "type": "main", + "index": 1 + } + ] + ] + }, + "Code8": { + "main": [ + [ + { + "node": "Compare Datasets5", + "type": "main", + "index": 0 + } + ] + ] + }, + "Code9": { + "main": [ + [ + { + "node": "Compare Datasets5", + "type": "main", + "index": 1 + } + ] + ] + }, + "Code10": { + "main": [ + [ + { + "node": "Compare Datasets6", + "type": "main", + "index": 0 + } + ] + ] + }, + "Code11": { + "main": [ + [ + { + "node": "Compare Datasets6", + "type": "main", + "index": 1 + } + ] + ] + }, + "Code12": { + "main": [ + [ + { + "node": "Compare Datasets7", + "type": "main", + "index": 0 + } + ] + ] + }, + "Code13": { + "main": [ + [ + { + "node": "Compare Datasets7", + "type": "main", + "index": 1 + } + ] + ] + }, + "Compare Datasets": { + "main": [ + [], + [ + { + "node": "No Operation, do nothing", + "type": "main", + "index": 0 + } + ] + ] + }, + "Compare Datasets1": { + "main": [ + [], + [ + { + "node": "No Operation, do nothing1", + "type": "main", + "index": 0 + } + ] + ] + }, + "Compare Datasets2": { + "main": [ + [], + [ + { + "node": "No Operation, do nothing2", + "type": "main", + "index": 0 + } + ] + ] + }, + "Compare Datasets3": { + "main": [ + [], + [ + { + "node": "No Operation, do nothing3", + "type": "main", + "index": 0 + } + ], + [ + { + "node": "No Operation, do nothing4", + "type": "main", + "index": 0 + } + ] + ] + }, + "Compare Datasets4": { + "main": [ + [], + [ + { + "node": "No Operation, do nothing5", + "type": "main", + "index": 0 + } + ] + ] + }, + "Compare Datasets5": { + "main": [ + [], + [ + { + "node": "No Operation, do nothing6", + "type": "main", + "index": 0 + } + ] + ] + }, + "Compare Datasets6": { + "main": [ + [], + [ + { + "node": "No Operation, do nothing7", + "type": "main", + "index": 0 + } + ] + ] + }, + "Compare Datasets7": { + "main": [ + [], + [ + { + "node": "No Operation, do nothing8", + "type": "main", + "index": 0 + } + ], + [ + { + "node": "No Operation, do nothing9", + "type": "main", + "index": 0 + } + ] + ] + } + }, + "active": false, + "settings": {}, + "versionId": "66b1e26d-0897-4c70-8eac-0f7bc0536214", + "id": "85", + "meta": { + "instanceId": "36203ea1ce3cef713fa25999bd9874ae26b9e4c2c3a90a365f2882a154d031d0" + }, + "tags": [] +} diff --git a/packages/nodes-base/nodes/CompareDatasets/test/node/workflow.compareDatasets.json b/packages/nodes-base/nodes/CompareDatasets/test/node/workflow.compareDatasets.json new file mode 100644 index 0000000000..18ebdcc8b5 --- /dev/null +++ b/packages/nodes-base/nodes/CompareDatasets/test/node/workflow.compareDatasets.json @@ -0,0 +1,879 @@ +{ + "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": [] +}