fix(core): Fix value resolution in declarative node design (#5217)

This commit is contained in:
Jan Oberhauser 2023-02-01 08:25:43 -06:00 committed by GitHub
parent 3bb1690086
commit b27a60b665
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 38 additions and 3 deletions

View file

@ -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;
}

View file

@ -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',