first commit
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,180 @@
|
||||
{
|
||||
"name": "Filter test: boolean",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "9e2c2dc5-bd37-460b-a5a4-943860dcc03e",
|
||||
"name": "When clicking \"Execute Workflow\"",
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [-720, 160]
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "3184fda2-b1d0-400a-a882-5844bbe99ae3",
|
||||
"name": "false",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [0, 260]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"data": [
|
||||
{
|
||||
"email": "shane@yahoo.com",
|
||||
"admin": false
|
||||
},
|
||||
{
|
||||
"email": "sharon@yahoo.com",
|
||||
"admin": true
|
||||
},
|
||||
{
|
||||
"email": "sarah@gmail.com",
|
||||
"admin": "false"
|
||||
},
|
||||
{
|
||||
"email": "tom@gmail.com",
|
||||
"admin": "0"
|
||||
},
|
||||
{
|
||||
"email": "jane@gmail.com",
|
||||
"admin": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
"id": "85de5f5c-0a4c-4da1-805b-9e056089bcd5",
|
||||
"name": "Code",
|
||||
"type": "n8n-nodes-testing.testData",
|
||||
"typeVersion": 1,
|
||||
"position": [-500, 160]
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "8577ab3b-b9f8-4c4d-a3a1-abb6a9269473",
|
||||
"name": "true",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [0, 100]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"options": {
|
||||
"caseSensitive": true,
|
||||
"leftValue": "",
|
||||
"typeValidation": "loose",
|
||||
"version": 2
|
||||
},
|
||||
"conditions": [
|
||||
{
|
||||
"id": "307e4ea0-3a82-4722-aca6-68d882115e8b",
|
||||
"leftValue": "={{ $json.admin }}",
|
||||
"rightValue": "",
|
||||
"operator": {
|
||||
"type": "boolean",
|
||||
"operation": "true",
|
||||
"singleValue": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"combinator": "and"
|
||||
},
|
||||
"looseTypeValidation": true,
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.if",
|
||||
"typeVersion": 2.2,
|
||||
"position": [-280, 160],
|
||||
"id": "d5d17556-45e6-44a1-8580-a08395ca38c4",
|
||||
"name": "loose"
|
||||
}
|
||||
],
|
||||
"pinData": {
|
||||
"true": [
|
||||
{
|
||||
"json": {
|
||||
"email": "sharon@yahoo.com",
|
||||
"admin": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"json": {
|
||||
"email": "jane@gmail.com",
|
||||
"admin": 1
|
||||
}
|
||||
}
|
||||
],
|
||||
"false": [
|
||||
{
|
||||
"json": {
|
||||
"email": "shane@yahoo.com",
|
||||
"admin": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"json": {
|
||||
"email": "sarah@gmail.com",
|
||||
"admin": "false"
|
||||
}
|
||||
},
|
||||
{
|
||||
"json": {
|
||||
"email": "tom@gmail.com",
|
||||
"admin": "0"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"connections": {
|
||||
"When clicking \"Execute Workflow\"": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Code",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Code": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "loose",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"loose": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "true",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "false",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": false,
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"versionId": "35631b37-dc5e-4155-a54f-41b38584f38e",
|
||||
"meta": {
|
||||
"instanceId": "27cc9b56542ad45b38725555722c50a1c3fee1670bbb67980558314ee08517c4"
|
||||
},
|
||||
"id": "JQsdJ4gnZtuDb7Oo",
|
||||
"tags": []
|
||||
}
|
||||
@@ -0,0 +1,165 @@
|
||||
{
|
||||
"name": "Filter test",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "f332a7d1-31b4-4e78-b31e-9e8db945bf3f",
|
||||
"name": "When clicking \"Execute Workflow\"",
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [-60, 480]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"data": [
|
||||
{
|
||||
"date": "2023-10-26T16:45:52.367Z",
|
||||
"label": "Apple"
|
||||
},
|
||||
{
|
||||
"date": "2023-10-20T16:45:52.367Z",
|
||||
"label": "Banana"
|
||||
},
|
||||
{
|
||||
"date": "2023-10-20T16:45:52.367Z",
|
||||
"label": "Kiwi"
|
||||
},
|
||||
{
|
||||
"date": "2023-10-20T16:45:52.367Z",
|
||||
"label": "Orange"
|
||||
}
|
||||
]
|
||||
},
|
||||
"id": "60697c7f-3948-4790-97ba-8aba03d02ac2",
|
||||
"name": "Code",
|
||||
"type": "n8n-nodes-testing.testData",
|
||||
"typeVersion": 1,
|
||||
"position": [160, 480]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"options": {
|
||||
"caseSensitive": true,
|
||||
"leftValue": ""
|
||||
},
|
||||
"conditions": [
|
||||
{
|
||||
"leftValue": "={{ $json.date }}",
|
||||
"rightValue": "2023-10-21",
|
||||
"operator": {
|
||||
"type": "dateTime",
|
||||
"operation": "before"
|
||||
}
|
||||
}
|
||||
],
|
||||
"combinator": "or"
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"id": "7531191b-5ac3-45dc-8afb-27ae83d8f33a",
|
||||
"name": "If",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"typeVersion": 2,
|
||||
"position": [380, 480]
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "d8c614ea-0bbf-4b12-ad7d-c9ebe09ce583",
|
||||
"name": "Then",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [600, 400]
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "69364770-60d2-4ef4-9f29-9570718a9a10",
|
||||
"name": "Else",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [600, 580]
|
||||
}
|
||||
],
|
||||
"pinData": {
|
||||
"Then": [
|
||||
{
|
||||
"json": {
|
||||
"date": "2023-10-20T16:45:52.367Z",
|
||||
"label": "Banana"
|
||||
}
|
||||
},
|
||||
{
|
||||
"json": {
|
||||
"date": "2023-10-20T16:45:52.367Z",
|
||||
"label": "Kiwi"
|
||||
}
|
||||
},
|
||||
{
|
||||
"json": {
|
||||
"date": "2023-10-20T16:45:52.367Z",
|
||||
"label": "Orange"
|
||||
}
|
||||
}
|
||||
],
|
||||
"Else": [
|
||||
{
|
||||
"json": {
|
||||
"date": "2023-10-26T16:45:52.367Z",
|
||||
"label": "Apple"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"connections": {
|
||||
"When clicking \"Execute Workflow\"": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Code",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Code": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "If",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"If": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Then",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "Else",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": false,
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"versionId": "ce7ed9ae-704e-4da8-b178-24556f720b2a",
|
||||
"id": "BWUTRs5RHxVgQ4uT",
|
||||
"meta": {
|
||||
"instanceId": "78577815012af39cf16dad7a787b0898c42fb7514b8a7f99b2136862c2af502c"
|
||||
},
|
||||
"tags": []
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
|
||||
import { mock } from 'jest-mock-extended';
|
||||
import get from 'lodash/get';
|
||||
import {
|
||||
NodeOperationError,
|
||||
type IExecuteFunctions,
|
||||
type INodeTypeDescription,
|
||||
type IDataObject,
|
||||
type IGetNodeParameterOptions,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import * as IfV2 from '../../V2/IfV2.node';
|
||||
|
||||
jest.mock('lodash/set', () => jest.fn());
|
||||
|
||||
describe('Test IF v2 Node Tests', () => {
|
||||
afterEach(() => jest.resetAllMocks());
|
||||
|
||||
describe('Test IF v2 Node Workflow Tests', () => {
|
||||
new NodeTestHarness().setupTests();
|
||||
});
|
||||
|
||||
describe('Test IF V2 Node Unit Tests', () => {
|
||||
const node = new IfV2.IfV2(mock<INodeTypeDescription>());
|
||||
|
||||
const input = [{ json: {} }];
|
||||
|
||||
const createMockExecuteFunction = (
|
||||
nodeParameters: IDataObject,
|
||||
continueOnFail: boolean = false,
|
||||
) => {
|
||||
const fakeExecuteFunction = {
|
||||
getNodeParameter(
|
||||
parameterName: string,
|
||||
itemIndex: number,
|
||||
fallbackValue?: IDataObject,
|
||||
options?: IGetNodeParameterOptions,
|
||||
) {
|
||||
const parameter = options?.extractValue ? `${parameterName}.value` : parameterName;
|
||||
|
||||
const parameterValue = get(nodeParameters, parameter, fallbackValue);
|
||||
|
||||
if ((parameterValue as IDataObject)?.nodeOperationError) {
|
||||
throw new NodeOperationError(mock(), 'Get Options Error', { itemIndex });
|
||||
}
|
||||
|
||||
return parameterValue;
|
||||
},
|
||||
getNode() {
|
||||
return node;
|
||||
},
|
||||
continueOnFail: () => continueOnFail,
|
||||
getInputData: () => input,
|
||||
} as unknown as IExecuteFunctions;
|
||||
return fakeExecuteFunction;
|
||||
};
|
||||
|
||||
it('should return items if continue on fail is true', async () => {
|
||||
const fakeExecuteFunction = createMockExecuteFunction(
|
||||
{ options: { nodeOperationError: true } },
|
||||
true,
|
||||
);
|
||||
|
||||
const output = await node.execute.call(fakeExecuteFunction);
|
||||
expect(output).toEqual([[], input]);
|
||||
});
|
||||
|
||||
it('should throw an error if continue on fail is false and if there is an error', async () => {
|
||||
const fakeExecuteFunction = createMockExecuteFunction(
|
||||
{ options: { nodeOperationError: true } },
|
||||
false,
|
||||
);
|
||||
|
||||
await expect(node.execute.call(fakeExecuteFunction)).rejects.toThrow(NodeOperationError);
|
||||
});
|
||||
|
||||
it('should assign a paired item if paired item is undefined', async () => {
|
||||
const fakeExecuteFunction = createMockExecuteFunction(
|
||||
{ options: {}, conditions: true },
|
||||
false,
|
||||
);
|
||||
|
||||
const output = await node.execute.call(fakeExecuteFunction);
|
||||
expect(output).toEqual([[], [{ json: {}, pairedItem: { item: 0 } }]]);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,163 @@
|
||||
{
|
||||
"name": "Filter test",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "f332a7d1-31b4-4e78-b31e-9e8db945bf3f",
|
||||
"name": "When clicking \"Execute Workflow\"",
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [-60, 480]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"data": [
|
||||
{
|
||||
"count": 1,
|
||||
"label": "Apple"
|
||||
},
|
||||
{
|
||||
"count": 5,
|
||||
"label": "Banana"
|
||||
},
|
||||
{
|
||||
"count": 12,
|
||||
"label": "Kiwi"
|
||||
}
|
||||
]
|
||||
},
|
||||
"id": "60697c7f-3948-4790-97ba-8aba03d02ac2",
|
||||
"name": "Code",
|
||||
"type": "n8n-nodes-testing.testData",
|
||||
"typeVersion": 1,
|
||||
"position": [160, 480]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"options": {
|
||||
"caseSensitive": true,
|
||||
"leftValue": ""
|
||||
},
|
||||
"conditions": [
|
||||
{
|
||||
"leftValue": "={{ $json.count }}",
|
||||
"rightValue": "1",
|
||||
"operator": {
|
||||
"type": "number",
|
||||
"operation": "equals"
|
||||
}
|
||||
},
|
||||
{
|
||||
"leftValue": "={{ $json.count }}",
|
||||
"rightValue": "10",
|
||||
"operator": {
|
||||
"type": "number",
|
||||
"operation": "gt"
|
||||
}
|
||||
}
|
||||
],
|
||||
"combinator": "or"
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"id": "7531191b-5ac3-45dc-8afb-27ae83d8f33a",
|
||||
"name": "If",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"typeVersion": 2,
|
||||
"position": [380, 480]
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "d8c614ea-0bbf-4b12-ad7d-c9ebe09ce583",
|
||||
"name": "Then",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [600, 400]
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "69364770-60d2-4ef4-9f29-9570718a9a10",
|
||||
"name": "Else",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [600, 580]
|
||||
}
|
||||
],
|
||||
"pinData": {
|
||||
"Then": [
|
||||
{
|
||||
"json": {
|
||||
"count": 1,
|
||||
"label": "Apple"
|
||||
}
|
||||
},
|
||||
{
|
||||
"json": {
|
||||
"count": 12,
|
||||
"label": "Kiwi"
|
||||
}
|
||||
}
|
||||
],
|
||||
"Else": [
|
||||
{
|
||||
"json": {
|
||||
"count": 5,
|
||||
"label": "Banana"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"connections": {
|
||||
"When clicking \"Execute Workflow\"": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Code",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Code": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "If",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"If": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Then",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "Else",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": false,
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"versionId": "78d54316-4f39-4012-bbb8-c789f1f8865b",
|
||||
"id": "BWUTRs5RHxVgQ4uT",
|
||||
"meta": {
|
||||
"instanceId": "78577815012af39cf16dad7a787b0898c42fb7514b8a7f99b2136862c2af502c"
|
||||
},
|
||||
"tags": []
|
||||
}
|
||||
@@ -0,0 +1,185 @@
|
||||
{
|
||||
"name": "Filter test",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "f332a7d1-31b4-4e78-b31e-9e8db945bf3f",
|
||||
"name": "When clicking \"Execute Workflow\"",
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [-60, 480]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"data": [
|
||||
{
|
||||
"label": "Apple",
|
||||
"tags": [],
|
||||
"meta": {
|
||||
"foo": "bar"
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "Banana",
|
||||
"tags": ["exotic"],
|
||||
"meta": {}
|
||||
},
|
||||
{
|
||||
"label": "Kiwi",
|
||||
"tags": ["exotic"],
|
||||
"meta": {}
|
||||
},
|
||||
{
|
||||
"label": "Orange",
|
||||
"meta": {}
|
||||
}
|
||||
]
|
||||
},
|
||||
"id": "60697c7f-3948-4790-97ba-8aba03d02ac2",
|
||||
"name": "Code",
|
||||
"type": "n8n-nodes-testing.testData",
|
||||
"typeVersion": 1,
|
||||
"position": [160, 480]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"options": {
|
||||
"caseSensitive": true,
|
||||
"leftValue": ""
|
||||
},
|
||||
"conditions": [
|
||||
{
|
||||
"leftValue": "={{ $json.tags }}",
|
||||
"rightValue": "exotic",
|
||||
"operator": {
|
||||
"type": "array",
|
||||
"operation": "contains",
|
||||
"rightType": "any"
|
||||
}
|
||||
},
|
||||
{
|
||||
"leftValue": "={{ $json.meta }}",
|
||||
"rightValue": "",
|
||||
"operator": {
|
||||
"type": "object",
|
||||
"operation": "notEmpty",
|
||||
"singleValue": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"combinator": "or"
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"id": "7531191b-5ac3-45dc-8afb-27ae83d8f33a",
|
||||
"name": "If",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"typeVersion": 2,
|
||||
"position": [380, 480]
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "d8c614ea-0bbf-4b12-ad7d-c9ebe09ce583",
|
||||
"name": "Then",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [600, 400]
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "69364770-60d2-4ef4-9f29-9570718a9a10",
|
||||
"name": "Else",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [600, 580]
|
||||
}
|
||||
],
|
||||
"pinData": {
|
||||
"Then": [
|
||||
{
|
||||
"json": {
|
||||
"label": "Apple",
|
||||
"tags": [],
|
||||
"meta": {
|
||||
"foo": "bar"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"json": {
|
||||
"label": "Banana",
|
||||
"tags": ["exotic"],
|
||||
"meta": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"json": {
|
||||
"label": "Kiwi",
|
||||
"tags": ["exotic"],
|
||||
"meta": {}
|
||||
}
|
||||
}
|
||||
],
|
||||
"Else": [
|
||||
{
|
||||
"json": {
|
||||
"label": "Orange",
|
||||
"meta": {}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"connections": {
|
||||
"When clicking \"Execute Workflow\"": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Code",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Code": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "If",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"If": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Then",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "Else",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": false,
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"versionId": "a6249f48-d88f-4b80-9ed9-79555e522d48",
|
||||
"id": "BWUTRs5RHxVgQ4uT",
|
||||
"meta": {
|
||||
"instanceId": "78577815012af39cf16dad7a787b0898c42fb7514b8a7f99b2136862c2af502c"
|
||||
},
|
||||
"tags": []
|
||||
}
|
||||
@@ -0,0 +1,179 @@
|
||||
{
|
||||
"name": "Filter test",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "96490c63-a3f4-4923-b969-8f9adcbb1bbb",
|
||||
"name": "When clicking \"Execute Workflow\"",
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [-160, 300]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"options": {
|
||||
"caseSensitive": false,
|
||||
"leftValue": ""
|
||||
},
|
||||
"conditions": [
|
||||
{
|
||||
"leftValue": "={{ $json.firstname }}",
|
||||
"rightValue": "s",
|
||||
"operator": {
|
||||
"type": "string",
|
||||
"operation": "startsWith"
|
||||
}
|
||||
},
|
||||
{
|
||||
"leftValue": "={{ $json.lastname }}",
|
||||
"rightValue": "",
|
||||
"operator": {
|
||||
"type": "any",
|
||||
"operation": "exists"
|
||||
}
|
||||
},
|
||||
{
|
||||
"leftValue": "={{ $json.email }}",
|
||||
"rightValue": "@yahoo.com",
|
||||
"operator": {
|
||||
"type": "string",
|
||||
"operation": "endsWith"
|
||||
}
|
||||
}
|
||||
],
|
||||
"combinator": "and"
|
||||
},
|
||||
"options": {
|
||||
"caseSensitive": false
|
||||
}
|
||||
},
|
||||
"id": "48399b31-219a-42fa-bb5b-380dbb4a2e7d",
|
||||
"name": "If",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"typeVersion": 2,
|
||||
"position": [260, 300]
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "8a59a941-bafd-46a6-8692-878de715d912",
|
||||
"name": "false",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [560, 440]
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "b82546fa-f9e9-4fa3-9dcb-e2c94a3784de",
|
||||
"name": "Then",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [560, 140]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"data": [
|
||||
{
|
||||
"email": "Shane@yahoo.com",
|
||||
"firstname": "Shane",
|
||||
"lastname": "Martin"
|
||||
},
|
||||
{
|
||||
"email": "Sharon@yahoo.com",
|
||||
"firstname": "Sharon",
|
||||
"lastname": "Tromp"
|
||||
},
|
||||
{
|
||||
"email": "sarah@gmail.com",
|
||||
"firstname": "Sarah",
|
||||
"lastname": "Dawson"
|
||||
}
|
||||
]
|
||||
},
|
||||
"id": "674c5688-ac03-49a7-83fb-62460a10cc10",
|
||||
"name": "Code",
|
||||
"type": "n8n-nodes-testing.testData",
|
||||
"typeVersion": 1,
|
||||
"position": [60, 300]
|
||||
}
|
||||
],
|
||||
"pinData": {
|
||||
"Then": [
|
||||
{
|
||||
"json": {
|
||||
"email": "Shane@yahoo.com",
|
||||
"firstname": "Shane",
|
||||
"lastname": "Martin"
|
||||
}
|
||||
},
|
||||
{
|
||||
"json": {
|
||||
"email": "Sharon@yahoo.com",
|
||||
"firstname": "Sharon",
|
||||
"lastname": "Tromp"
|
||||
}
|
||||
}
|
||||
],
|
||||
"false": [
|
||||
{
|
||||
"json": {
|
||||
"email": "sarah@gmail.com",
|
||||
"firstname": "Sarah",
|
||||
"lastname": "Dawson"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"connections": {
|
||||
"When clicking \"Execute Workflow\"": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Code",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"If": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Then",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "false",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Code": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "If",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": false,
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"versionId": "48c6a584-e79b-4ce4-ab4b-2b4ab663b89d",
|
||||
"id": "BWUTRs5RHxVgQ4uT",
|
||||
"meta": {
|
||||
"instanceId": "78577815012af39cf16dad7a787b0898c42fb7514b8a7f99b2136862c2af502c"
|
||||
},
|
||||
"tags": []
|
||||
}
|
||||
Reference in New Issue
Block a user