mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-12 21:37:32 -08:00
fix(core): Fix value resolution in declarative node design (#5217)
This commit is contained in:
parent
3bb1690086
commit
b27a60b665
|
@ -180,7 +180,7 @@ export class RoutingNode {
|
|||
runIndex,
|
||||
executeData,
|
||||
{ $credentials: credentials, $version: this.node.typeVersion },
|
||||
true,
|
||||
false,
|
||||
) as string | NodeParameterValue;
|
||||
|
||||
const tempOptions = this.getRequestOptionsFromParameters(
|
||||
|
@ -380,7 +380,7 @@ export class RoutingNode {
|
|||
$value: parameterValue,
|
||||
$version: this.node.typeVersion,
|
||||
},
|
||||
true,
|
||||
false,
|
||||
) as string;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
(returnItem as Record<string, any>)[key] = propertyValue;
|
||||
|
@ -725,7 +725,7 @@ export class RoutingNode {
|
|||
runIndex,
|
||||
executeSingleFunctions.getExecuteData(),
|
||||
{ ...additionalKeys, $value: value },
|
||||
true,
|
||||
false,
|
||||
) as string;
|
||||
}
|
||||
|
||||
|
|
|
@ -176,6 +176,8 @@ describe('RoutingNode', () => {
|
|||
value2: 'v2',
|
||||
value3: 'v3',
|
||||
value4: 4,
|
||||
value6: 'value1,value2',
|
||||
value7: 'value3,value4',
|
||||
lowerLevel: {
|
||||
lowLevelValue1: 1,
|
||||
lowLevelValue2: 'llv2',
|
||||
|
@ -334,6 +336,35 @@ describe('RoutingNode', () => {
|
|||
},
|
||||
},
|
||||
},
|
||||
|
||||
// Test resolve of value and properties including as objects
|
||||
{
|
||||
displayName: 'Value 6',
|
||||
name: 'value6',
|
||||
type: 'string',
|
||||
routing: {
|
||||
send: {
|
||||
property: '={{ `value${5+1}A` }}',
|
||||
type: 'query',
|
||||
value: '={{$value.toUpperCase()}}',
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Value 7',
|
||||
name: 'value7',
|
||||
type: 'string',
|
||||
routing: {
|
||||
send: {
|
||||
property: '={{ `value${6+1}B` }}',
|
||||
type: 'body',
|
||||
value: "={{$value.split(',')}}",
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
},
|
||||
|
||||
{
|
||||
displayName: 'Lower Level',
|
||||
name: 'lowerLevel',
|
||||
|
@ -509,10 +540,12 @@ describe('RoutingNode', () => {
|
|||
name: 'cSName1',
|
||||
value: 'cSValue1',
|
||||
},
|
||||
value6A: 'VALUE1,VALUE2',
|
||||
},
|
||||
body: {
|
||||
value1: 'v1',
|
||||
'topLevel.value2': 'v2',
|
||||
value7B: ['value3', 'value4'],
|
||||
lowerLevel: {
|
||||
value3: 'v3',
|
||||
},
|
||||
|
@ -543,6 +576,8 @@ describe('RoutingNode', () => {
|
|||
value2: 'v2',
|
||||
value3: 'v3',
|
||||
value4: 4,
|
||||
value6: 'value1,value2',
|
||||
value7: 'value3,value4',
|
||||
lowerLevel: {
|
||||
lowLevelValue1: 1,
|
||||
lowLevelValue2: 'llv2',
|
||||
|
|
Loading…
Reference in a new issue