fix(Code Node): Bind helper methods to the correct context (#9380)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™ 2024-05-14 14:08:51 +02:00 committed by GitHub
parent 97d3c6465c
commit 82c8801f25
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -19,11 +19,16 @@ export interface SandboxContext extends IWorkflowDataProxyData {
export const REQUIRED_N8N_ITEM_KEYS = new Set(['json', 'binary', 'pairedItem', 'error']);
export function getSandboxContext(this: IExecuteFunctions, index: number): SandboxContext {
const helpers = {
...this.helpers,
httpRequestWithAuthentication: this.helpers.httpRequestWithAuthentication.bind(this),
requestWithAuthenticationPaginated: this.helpers.requestWithAuthenticationPaginated.bind(this),
};
return {
// from NodeExecuteFunctions
$getNodeParameter: this.getNodeParameter,
$getWorkflowStaticData: this.getWorkflowStaticData,
helpers: this.helpers,
helpers,
// to bring in all $-prefixed vars and methods from WorkflowDataProxy
// $node, $items(), $parameter, $json, $env, etc.