Skip to content

Commit

Permalink
fix(core): Fix value resolution in declarative node design (#5217)
Browse files Browse the repository at this point in the history
  • Loading branch information
janober authored Feb 1, 2023
1 parent 3bb1690 commit b27a60b
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/workflow/src/RoutingNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ export class RoutingNode {
runIndex,
executeData,
{ $credentials: credentials, $version: this.node.typeVersion },
true,
false,
) as string | NodeParameterValue;

const tempOptions = this.getRequestOptionsFromParameters(
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -725,7 +725,7 @@ export class RoutingNode {
runIndex,
executeSingleFunctions.getExecuteData(),
{ ...additionalKeys, $value: value },
true,
false,
) as string;
}

Expand Down
35 changes: 35 additions & 0 deletions packages/workflow/test/RoutingNode.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ describe('RoutingNode', () => {
value2: 'v2',
value3: 'v3',
value4: 4,
value6: 'value1,value2',
value7: 'value3,value4',
lowerLevel: {
lowLevelValue1: 1,
lowLevelValue2: 'llv2',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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',
},
Expand Down Expand Up @@ -543,6 +576,8 @@ describe('RoutingNode', () => {
value2: 'v2',
value3: 'v3',
value4: 4,
value6: 'value1,value2',
value7: 'value3,value4',
lowerLevel: {
lowLevelValue1: 1,
lowLevelValue2: 'llv2',
Expand Down

0 comments on commit b27a60b

Please sign in to comment.