Skip to content

Commit

Permalink
feat(Merge Node)!: node tweaks n8n-4939 (#4321)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: The Merge node list of operations was rearranged.

Merge node: 'Combine' operation was added with 'Combine Mode' option, operations 'Merge By Fields', 'Merge By Position' and 'Multiplex' placed under 'Combine Mode' option.
To update -go to the workflows that use the Merge node, select 'Combine' operation and then choose an option from 'Combination Mode' that matches an operation that was previously used. If you want to continue even on error, you can set "Continue on Fail" to true.
  • Loading branch information
michael-radency authored Oct 13, 2022
1 parent 1db4fa2 commit 6a37071
Show file tree
Hide file tree
Showing 4 changed files with 271 additions and 191 deletions.
14 changes: 14 additions & 0 deletions packages/cli/BREAKING-CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@

This list shows all the versions which include breaking changes and how to upgrade.

## 0.198.0

### What changed?

The Merge node list of operations was rearranged.

### When is action necessary?

If you are using the overhauled Merge node and 'Merge By Fields', 'Merge By Position' or 'Multiplex' operation.

### How to upgrade:

Go to the workflows that use the Merge node, select 'Combine' operation and then choose an option from 'Combination Mode' that matches an operation that was previously used. If you want to continue even on error, you can set "Continue on Fail" to true.

## 0.171.0

### What changed?
Expand Down
13 changes: 9 additions & 4 deletions packages/nodes-base/nodes/Merge/v2/GenericFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ type MultipleMatches = 'all' | 'first';
export type MatchFieldsOutput = 'both' | 'input1' | 'input2';

export type MatchFieldsJoinMode =
| 'keepEverything'
| 'keepMatches'
| 'keepNonMatches'
| 'enrichInput2'
Expand Down Expand Up @@ -294,12 +295,16 @@ export function selectMergeMethod(clashResolveOptions: ClashResolveOptions) {
}
}
if (mergeMode === 'deepMerge') {
return (target: IDataObject, ...source: IDataObject[]) =>
mergeWith(target, ...source, customizer);
return (target: IDataObject, ...source: IDataObject[]) => {
const targetCopy = Object.assign({}, target);
return mergeWith(targetCopy, ...source, customizer);
};
}
if (mergeMode === 'shallowMerge') {
return (target: IDataObject, ...source: IDataObject[]) =>
assignWith(target, ...source, customizer);
return (target: IDataObject, ...source: IDataObject[]) => {
const targetCopy = Object.assign({}, target);
return assignWith(targetCopy, ...source, customizer);
};
}
} else {
if (mergeMode === 'deepMerge') {
Expand Down
Loading

0 comments on commit 6a37071

Please sign in to comment.