2
0

feat(engine): Improve variables in executed codes

This commit is contained in:
Baptiste Arnaud
2022-03-31 16:41:18 +02:00
parent 82f7bf0ed6
commit db10f1ee89
11 changed files with 155 additions and 60 deletions

View File

@ -247,9 +247,8 @@ const executeWebhook = async (
if (!varMapping?.bodyPath || !varMapping.variableId) return newVariables
const existingVariable = variables.find(byId(varMapping.variableId))
if (!existingVariable) return newVariables
const value = Function(
`return (${JSON.stringify(data)}).${varMapping?.bodyPath}`
)()
const func = Function('data', `return data.${varMapping?.bodyPath}`)
const value = func(JSON.stringify(data))
updateVariableValue(existingVariable?.id, value)
return [...newVariables, { ...existingVariable, value }]
}, [])