mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
feat(Item Lists Node): Table tranformation
This commit is contained in:
@@ -49,6 +49,8 @@ const shuffleArray = (array: any[]) => {
|
||||
}
|
||||
};
|
||||
|
||||
import * as summarize from './summarize.operation';
|
||||
|
||||
export class ItemLists implements INodeType {
|
||||
description: INodeTypeDescription = {
|
||||
displayName: 'Item Lists',
|
||||
@@ -84,10 +86,10 @@ export class ItemLists implements INodeType {
|
||||
noDataExpression: true,
|
||||
options: [
|
||||
{
|
||||
name: 'Aggregate Items',
|
||||
name: 'Concatenate Items',
|
||||
value: 'aggregateItems',
|
||||
description: 'Combine fields into a single new item',
|
||||
action: 'Combine fields into a single new item',
|
||||
description: 'Combine fields into a list in a single new item',
|
||||
action: 'Combine fields into a list in a single new item',
|
||||
},
|
||||
{
|
||||
name: 'Limit',
|
||||
@@ -113,11 +115,16 @@ export class ItemLists implements INodeType {
|
||||
description: 'Turn a list inside item(s) into separate items',
|
||||
action: 'Turn a list inside item(s) into separate items',
|
||||
},
|
||||
{
|
||||
name: 'Summarize',
|
||||
value: 'summarize',
|
||||
description: 'Aggregate items together (pivot table)',
|
||||
action: 'Aggregate items together (pivot table)',
|
||||
},
|
||||
],
|
||||
default: 'splitOutItems',
|
||||
},
|
||||
// Split out items - Fields
|
||||
|
||||
{
|
||||
displayName: 'Field To Split Out',
|
||||
name: 'fieldToSplitOut',
|
||||
@@ -765,6 +772,8 @@ return 0;`,
|
||||
},
|
||||
],
|
||||
},
|
||||
// Remove duplicates - Fields
|
||||
...summarize.description,
|
||||
],
|
||||
};
|
||||
|
||||
@@ -1388,6 +1397,8 @@ return 0;`,
|
||||
newItems = items.slice(items.length - maxItems, items.length);
|
||||
}
|
||||
return this.prepareOutputData(newItems);
|
||||
} else if (operation === 'summarize') {
|
||||
return summarize.execute.call(this, items);
|
||||
} else {
|
||||
throw new NodeOperationError(this.getNode(), `Operation '${operation}' is not recognized`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user