fix(Code Node): Fix item and items alias regression (#6331)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2023-05-30 10:56:55 +00:00
committed by GitHub
parent 77e3f1551d
commit 54e3838dae
2 changed files with 68 additions and 32 deletions

View File

@@ -102,13 +102,18 @@ export class Code implements INodeType {
const getSandbox = (index = 0) => {
const code = this.getNodeParameter(codeParameterName, index) as string;
const context = getSandboxContext.call(this, index);
if (nodeMode === 'runOnceForAllItems') {
context.items = context.$input.all();
} else {
context.item = context.$input.item;
}
if (language === 'python') {
const modules = this.getNodeParameter('modules', index) as string;
const moduleImports: string[] = modules ? modules.split(',').map((m) => m.trim()) : [];
context.printOverwrite = workflowMode === 'manual' ? this.sendMessageToUI : null;
return new PythonSandbox(context, code, moduleImports, index, this.helpers);
} else {
context.items = context.$input.all();
const sandbox = new JavaScriptSandbox(context, code, index, workflowMode, this.helpers);
if (workflowMode === 'manual') {
sandbox.vm.on('console.log', this.sendMessageToUI);