fix(core): Fix resolving of $fromAI expression via evaluateExpression (#11397)
Some checks are pending
Test Master / install-and-build (push) Waiting to run
Test Master / Unit tests (18.x) (push) Blocked by required conditions
Test Master / Unit tests (20.x) (push) Blocked by required conditions
Test Master / Unit tests (22.4) (push) Blocked by required conditions
Test Master / Lint (push) Blocked by required conditions
Test Master / Notify Slack on failure (push) Blocked by required conditions

Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
This commit is contained in:
oleg 2024-10-24 22:50:18 +02:00 committed by GitHub
parent 8608baeb7e
commit 2e6446454d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2856,6 +2856,8 @@ async function getInputConnectionData(
connectedNode.typeVersion, connectedNode.typeVersion,
); );
// TODO: create a new context object here based on the type of `connectedNode`, and avoid using `Object.assign` on context objects
// https://linear.app/n8n/issue/CAT-269
const context = Object.assign({}, this); const context = Object.assign({}, this);
context.getNodeParameter = ( context.getNodeParameter = (
@ -3758,14 +3760,16 @@ export function getExecuteFunctions(
continueOnFail: () => { continueOnFail: () => {
return continueOnFail(node); return continueOnFail(node);
}, },
evaluateExpression: (expression: string, itemIndex: number) => { evaluateExpression(expression: string, itemIndex: number) {
return workflow.expression.resolveSimpleParameterValue( return workflow.expression.resolveSimpleParameterValue(
`=${expression}`, `=${expression}`,
{}, {},
runExecutionData, runExecutionData,
runIndex, runIndex,
itemIndex, itemIndex,
node.name, // TODO: revert this back to `node.name` when we stop using `IExecuteFunctions` as the context object in AI nodes.
// https://linear.app/n8n/issue/CAT-269
this.getNode().name,
connectionInputData, connectionInputData,
mode, mode,
getAdditionalKeys(additionalData, mode, runExecutionData), getAdditionalKeys(additionalData, mode, runExecutionData),