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

This commit is contained in:
2026-03-17 16:22:57 +03:30
commit 3d5eaf9445
15349 changed files with 2847338 additions and 0 deletions
@@ -0,0 +1,19 @@
{
"node": "n8n-nodes-base.limit",
"nodeVersion": "1.0",
"codexVersion": "1.0",
"details": "",
"categories": ["Core Nodes"],
"resources": {
"primaryDocumentation": [
{
"url": "https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.limit/"
}
],
"generic": []
},
"alias": ["Limit", "Remove", "Slice", "Transform", "Array", "List", "Item"],
"subcategories": {
"Core Nodes": ["Data Transformation"]
}
}
@@ -0,0 +1,71 @@
import type {
IExecuteFunctions,
INodeExecutionData,
INodeType,
INodeTypeDescription,
} from 'n8n-workflow';
import { NodeConnectionTypes } from 'n8n-workflow';
export class Limit implements INodeType {
description: INodeTypeDescription = {
displayName: 'Limit',
name: 'limit',
icon: 'file:limit.svg',
group: ['transform'],
subtitle: '',
version: 1,
description: 'Restrict the number of items',
defaults: {
name: 'Limit',
},
inputs: [NodeConnectionTypes.Main],
outputs: [NodeConnectionTypes.Main],
properties: [
{
displayName: 'Max Items',
name: 'maxItems',
type: 'number',
typeOptions: {
minValue: 1,
},
default: 1,
description: 'If there are more items than this number, some are removed',
},
{
displayName: 'Keep',
name: 'keep',
type: 'options',
options: [
{
name: 'First Items',
value: 'firstItems',
},
{
name: 'Last Items',
value: 'lastItems',
},
],
default: 'firstItems',
description: 'When removing items, whether to keep the ones at the start or the ending',
},
],
};
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
const items = this.getInputData();
let returnData = items;
const maxItems = this.getNodeParameter('maxItems', 0) as number;
const keep = this.getNodeParameter('keep', 0) as string;
if (maxItems > items.length) {
return [returnData];
}
if (keep === 'firstItems') {
returnData = items.slice(0, maxItems);
} else {
returnData = items.slice(items.length - maxItems, items.length);
}
return [returnData];
}
}
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="512" height="512" fill="none"><g fill="#2FB67C" fill-rule="evenodd" clip-path="url(#a)" clip-rule="evenodd"><path d="M512 458c0-6.627-5.373-12-12-12h-68c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h68c6.627 0 12-5.373 12-12zm-140 0c0-6.627-5.373-12-12-12h-68c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h68c6.627 0 12-5.373 12-12zm-140 0c0-6.627-5.373-12-12-12h-68c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h68c6.627 0 12-5.373 12-12zm-140 0c0-6.627-5.373-12-12-12H12c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h68c6.627 0 12-5.373 12-12zm152-222c-6.627 0-12-5.373-12-12V30c0-6.627 5.373-12 12-12h24c6.627 0 12 5.373 12 12v194c0 6.627-5.373 12-12 12z"/><path d="M149.577 146.982c9.398-9.346 24.594-9.304 33.941.095L256 219.964l72.482-72.887c9.347-9.399 24.543-9.441 33.941-.095s9.441 24.543.095 33.941l-89.5 90a24 24 0 0 1-34.036 0l-89.5-90c-9.346-9.398-9.304-24.594.095-33.941M0 350c0-6.627 5.373-12 12-12h488c6.627 0 12 5.373 12 12v24c0 6.627-5.373 12-12 12H12c-6.627 0-12-5.373-12-12z"/></g><defs><clipPath id="a"><path fill="#fff" d="M0 0h512v512H0z"/></clipPath></defs></svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

@@ -0,0 +1,5 @@
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
describe('Test Limit Node', () => {
new NodeTestHarness().setupTests();
});
@@ -0,0 +1,113 @@
{
"name": "itemLists test",
"nodes": [
{
"parameters": {},
"id": "bd7af0bb-de39-44b4-ac11-eb1d22f5e8d7",
"name": "When clicking \"Execute Workflow\"",
"type": "n8n-nodes-base.manualTrigger",
"typeVersion": 1,
"position": [260, 180]
},
{
"parameters": {
"data": [
{
"entry": 1
},
{
"entry": 2
},
{
"entry": 3
},
{
"entry": 4
},
{
"entry": 5
}
]
},
"id": "21185d7a-f0c1-49a0-9c2d-f0f198ceea7e",
"name": "Code",
"type": "n8n-nodes-testing.testData",
"typeVersion": 1,
"position": [520, 180]
},
{
"parameters": {
"maxItems": 1
},
"id": "7cc02cc4-1f5f-489a-81e2-4c96b3bdf221",
"name": "Item Lists limit first",
"type": "n8n-nodes-base.limit",
"typeVersion": 1,
"position": [740, 80]
},
{
"parameters": {
"keep": "lastItems",
"maxItems": 1
},
"id": "2bf79d53-7a0b-4716-aa09-55ad43d306ae",
"name": "Item Lists limit last",
"type": "n8n-nodes-base.limit",
"typeVersion": 1,
"position": [740, 300]
}
],
"pinData": {
"Item Lists limit first": [
{
"json": {
"entry": 1
}
}
],
"Item Lists limit last": [
{
"json": {
"entry": 5
}
}
]
},
"connections": {
"When clicking \"Execute Workflow\"": {
"main": [
[
{
"node": "Code",
"type": "main",
"index": 0
}
]
]
},
"Code": {
"main": [
[
{
"node": "Item Lists limit first",
"type": "main",
"index": 0
},
{
"node": "Item Lists limit last",
"type": "main",
"index": 0
}
]
]
}
},
"active": false,
"settings": {},
"versionId": "5036d554-1ba4-4b5f-ba9f-1de6df09e807",
"id": "105",
"meta": {
"instanceId": "36203ea1ce3cef713fa25999bd9874ae26b9e4c2c3a90a365f2882a154d031d0"
},
"tags": []
}