mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-22 04:10:01 +00:00
feat(Merge Node): Overhaul, v3 (#9528)
Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com> Co-authored-by: Shireen Missi <94372015+ShireenMissi@users.noreply.github.com>
This commit is contained in:
22
packages/nodes-base/nodes/Merge/v3/actions/router.ts
Normal file
22
packages/nodes-base/nodes/Merge/v3/actions/router.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { NodeExecutionOutput, type IExecuteFunctions } from 'n8n-workflow';
|
||||
import type { MergeType } from './node.type';
|
||||
import * as mode from './mode';
|
||||
import { getNodeInputsData } from '../helpers/utils';
|
||||
|
||||
export async function router(this: IExecuteFunctions) {
|
||||
const inputsData = getNodeInputsData.call(this);
|
||||
let operationMode = this.getNodeParameter('mode', 0) as string;
|
||||
|
||||
if (operationMode === 'combine') {
|
||||
const combineBy = this.getNodeParameter('combineBy', 0) as string;
|
||||
operationMode = combineBy;
|
||||
}
|
||||
|
||||
const returnData = await mode[operationMode as MergeType].execute.call(this, inputsData);
|
||||
|
||||
if (returnData instanceof NodeExecutionOutput) {
|
||||
return returnData;
|
||||
} else {
|
||||
return [returnData];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user