fix(core): Setup nodeHelpers that aren't exposed in the code sandbox (no-changelog) (#5753)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2023-03-23 15:11:18 +01:00
committed by GitHub
parent d3a34ab71b
commit b0cfd69f2b
6 changed files with 27 additions and 10 deletions

View File

@@ -49,6 +49,7 @@ import type {
IPairedItemData,
ICredentialTestFunctions,
BinaryHelperFunctions,
NodeHelperFunctions,
RequestHelperFunctions,
FunctionsBase,
IExecuteFunctions,
@@ -2054,6 +2055,13 @@ const getFileSystemHelperFunctions = (node: INode): FileSystemHelperFunctions =>
},
});
const getNodeHelperFunctions = ({
executionId,
}: IWorkflowExecuteAdditionalData): NodeHelperFunctions => ({
copyBinaryFile: async (filePath, fileName, mimeType) =>
copyBinaryFile(executionId!, filePath, fileName, mimeType),
});
const getBinaryHelperFunctions = ({
executionId,
}: IWorkflowExecuteAdditionalData): BinaryHelperFunctions => ({
@@ -2064,8 +2072,9 @@ const getBinaryHelperFunctions = ({
prepareBinaryData(binaryData, executionId!, filePath, mimeType),
setBinaryDataBuffer: async (data, binaryData) =>
setBinaryDataBuffer(data, binaryData, executionId!),
copyBinaryFile: async (filePath, fileName, mimeType) =>
copyBinaryFile(executionId!, filePath, fileName, mimeType),
copyBinaryFile: async () => {
throw new Error('copyBinaryFile has been removed. Please upgrade this node');
},
});
/**
@@ -2368,6 +2377,7 @@ export function getExecuteFunctions(
normalizeItems,
constructExecutionMetaData,
},
nodeHelpers: getNodeHelperFunctions(additionalData),
};
})(workflow, runExecutionData, connectionInputData, inputData, node) as IExecuteFunctions;
}
@@ -2758,6 +2768,7 @@ export function getExecuteWebhookFunctions(
...getBinaryHelperFunctions(additionalData),
returnJsonArray,
},
nodeHelpers: getNodeHelperFunctions(additionalData),
};
})(workflow, node);
}