2023-01-27 03:22:44 -08:00
import type { INodeProperties } from 'n8n-workflow' ;
2022-09-12 22:59:49 -07:00
const clashHandlingProperties : INodeProperties = {
displayName : 'Clash Handling' ,
name : 'clashHandling' ,
type : 'fixedCollection' ,
default : {
values : { resolveClash : 'preferInput2' , mergeMode : 'deepMerge' , overrideEmpty : false } ,
} ,
options : [
{
displayName : 'Values' ,
name : 'values' ,
values : [
{
displayName : 'When Field Values Clash' ,
name : 'resolveClash' ,
type : 'options' ,
default : '' ,
options : [
{
name : 'Always Add Input Number to Field Names' ,
value : 'addSuffix' ,
} ,
{
name : 'Prefer Input 1 Version' ,
value : 'preferInput1' ,
} ,
{
name : 'Prefer Input 2 Version' ,
value : 'preferInput2' ,
} ,
] ,
} ,
{
displayName : 'Merging Nested Fields' ,
name : 'mergeMode' ,
type : 'options' ,
default : 'deepMerge' ,
options : [
{
name : 'Deep Merge' ,
value : 'deepMerge' ,
description : 'Merge at every level of nesting' ,
} ,
{
name : 'Shallow Merge' ,
value : 'shallowMerge' ,
description :
'Merge at the top level only (all nested fields will come from the same input)' ,
} ,
] ,
hint : 'How to merge when there are sub-fields below the top-level ones' ,
displayOptions : {
show : {
resolveClash : [ 'preferInput1' , 'preferInput2' ] ,
} ,
} ,
} ,
{
displayName : 'Minimize Empty Fields' ,
name : 'overrideEmpty' ,
type : 'boolean' ,
default : false ,
description :
"Whether to override the preferred input version for a field if it is empty and the other version isn't. Here 'empty' means undefined, null or an empty string." ,
displayOptions : {
show : {
resolveClash : [ 'preferInput1' , 'preferInput2' ] ,
} ,
} ,
} ,
] ,
} ,
] ,
} ;
export const optionsDescription : INodeProperties [ ] = [
{
displayName : 'Options' ,
name : 'options' ,
type : 'collection' ,
placeholder : 'Add Option' ,
default : { } ,
options : [
{
. . . clashHandlingProperties ,
displayOptions : {
show : {
2022-10-13 07:14:47 -07:00
'/mode' : [ 'combine' ] ,
'/combinationMode' : [ 'mergeByFields' ] ,
2022-09-12 22:59:49 -07:00
} ,
hide : {
'/joinMode' : [ 'keepMatches' , 'keepNonMatches' ] ,
} ,
} ,
} ,
{
. . . clashHandlingProperties ,
displayOptions : {
show : {
2022-10-13 07:14:47 -07:00
'/mode' : [ 'combine' ] ,
'/combinationMode' : [ 'mergeByFields' ] ,
2022-09-12 22:59:49 -07:00
'/joinMode' : [ 'keepMatches' ] ,
'/outputDataFrom' : [ 'both' ] ,
} ,
} ,
} ,
{
. . . clashHandlingProperties ,
displayOptions : {
show : {
2022-10-13 07:14:47 -07:00
'/mode' : [ 'combine' ] ,
'/combinationMode' : [ 'multiplex' , 'mergeByPosition' ] ,
2022-09-12 22:59:49 -07:00
} ,
} ,
} ,
{
displayName : 'Disable Dot Notation' ,
name : 'disableDotNotation' ,
type : 'boolean' ,
default : false ,
description :
'Whether to disallow referencing child fields using `parent.child` in the field name' ,
displayOptions : {
show : {
2022-10-13 07:14:47 -07:00
'/mode' : [ 'combine' ] ,
'/combinationMode' : [ 'mergeByFields' ] ,
2022-09-12 22:59:49 -07:00
} ,
} ,
} ,
2023-01-04 04:37:54 -08:00
{
displayName : 'Fuzzy Compare' ,
name : 'fuzzyCompare' ,
type : 'boolean' ,
default : false ,
description :
"Whether to tolerate small type differences when comparing fields. E.g. the number 3 and the string '3' are treated as the same." ,
} ,
2022-09-12 22:59:49 -07:00
{
displayName : 'Include Any Unpaired Items' ,
name : 'includeUnpaired' ,
type : 'boolean' ,
default : false ,
// eslint-disable-next-line n8n-nodes-base/node-param-description-boolean-without-whether
description :
'If there are different numbers of items in input 1 and input 2, whether to include the ones at the end with nothing to pair with' ,
displayOptions : {
show : {
2022-10-13 07:14:47 -07:00
'/mode' : [ 'combine' ] ,
'/combinationMode' : [ 'mergeByPosition' ] ,
2022-09-12 22:59:49 -07:00
} ,
} ,
} ,
{
displayName : 'Multiple Matches' ,
name : 'multipleMatches' ,
type : 'options' ,
default : 'all' ,
options : [
{
name : 'Include All Matches' ,
value : 'all' ,
description : 'Output multiple items if there are multiple matches' ,
} ,
{
name : 'Include First Match Only' ,
value : 'first' ,
description : 'Only ever output a single item per match' ,
} ,
] ,
displayOptions : {
show : {
2022-10-13 07:14:47 -07:00
'/mode' : [ 'combine' ] ,
'/combinationMode' : [ 'mergeByFields' ] ,
2022-09-12 22:59:49 -07:00
'/joinMode' : [ 'keepMatches' ] ,
'/outputDataFrom' : [ 'both' ] ,
} ,
} ,
} ,
{
displayName : 'Multiple Matches' ,
name : 'multipleMatches' ,
type : 'options' ,
default : 'all' ,
options : [
{
name : 'Include All Matches' ,
value : 'all' ,
description : 'Output multiple items if there are multiple matches' ,
} ,
{
name : 'Include First Match Only' ,
value : 'first' ,
description : 'Only ever output a single item per match' ,
} ,
] ,
displayOptions : {
show : {
2022-10-13 07:14:47 -07:00
'/mode' : [ 'combine' ] ,
'/combinationMode' : [ 'mergeByFields' ] ,
'/joinMode' : [ 'enrichInput1' , 'enrichInput2' , 'keepEverything' ] ,
2022-09-12 22:59:49 -07:00
} ,
} ,
} ,
] ,
displayOptions : {
hide : {
mode : [ 'chooseBranch' , 'append' ] ,
} ,
} ,
} ,
] ;