diff --git a/packages/core/src/execution-engine/node-execution-context/__tests__/execute-context.test.ts b/packages/core/src/execution-engine/node-execution-context/__tests__/execute-context.test.ts index fa0449fc545..a3bdc7aa00b 100644 --- a/packages/core/src/execution-engine/node-execution-context/__tests__/execute-context.test.ts +++ b/packages/core/src/execution-engine/node-execution-context/__tests__/execute-context.test.ts @@ -398,29 +398,6 @@ describe('ExecuteContext', () => { }); }); - describe('getRuntimeCredential', () => { - beforeEach(() => { - additionalData.getRuntimeCredential.mockReset(); - }); - - it('forwards the alias to the additionalData callback and returns its value', async () => { - additionalData.getRuntimeCredential.mockResolvedValue('Bearer xyz'); - - const result = await executeContext.getRuntimeCredential('api_key'); - - expect(result).toBe('Bearer xyz'); - expect(additionalData.getRuntimeCredential).toHaveBeenCalledWith(runExecutionData, 'api_key'); - }); - - it('returns undefined when the underlying callback yields undefined', async () => { - additionalData.getRuntimeCredential.mockResolvedValue(undefined); - - const result = await executeContext.getRuntimeCredential('missing'); - - expect(result).toBeUndefined(); - }); - }); - describe('executeAgent', () => { const webhookNode: INode = { id: 'webhook-node-id', diff --git a/packages/core/src/execution-engine/node-execution-context/__tests__/execute-single-context.test.ts b/packages/core/src/execution-engine/node-execution-context/__tests__/execute-single-context.test.ts index 6fb63f086e3..23098da7d67 100644 --- a/packages/core/src/execution-engine/node-execution-context/__tests__/execute-single-context.test.ts +++ b/packages/core/src/execution-engine/node-execution-context/__tests__/execute-single-context.test.ts @@ -199,27 +199,4 @@ describe('ExecuteSingleContext', () => { ]); }); }); - - describe('getRuntimeCredential', () => { - beforeEach(() => { - additionalData.getRuntimeCredential.mockReset(); - }); - - it('forwards the alias to the additionalData callback and returns its value', async () => { - additionalData.getRuntimeCredential.mockResolvedValue('Bearer xyz'); - - const result = await executeSingleContext.getRuntimeCredential('api_key'); - - expect(result).toBe('Bearer xyz'); - expect(additionalData.getRuntimeCredential).toHaveBeenCalledWith(runExecutionData, 'api_key'); - }); - - it('returns undefined when the underlying callback yields undefined', async () => { - additionalData.getRuntimeCredential.mockResolvedValue(undefined); - - const result = await executeSingleContext.getRuntimeCredential('missing'); - - expect(result).toBeUndefined(); - }); - }); }); diff --git a/packages/core/src/execution-engine/node-execution-context/__tests__/shared-tests.ts b/packages/core/src/execution-engine/node-execution-context/__tests__/shared-tests.ts index 9901b96317c..a55d608b6b4 100644 --- a/packages/core/src/execution-engine/node-execution-context/__tests__/shared-tests.ts +++ b/packages/core/src/execution-engine/node-execution-context/__tests__/shared-tests.ts @@ -46,6 +46,29 @@ export const describeCommonTests = ( ) => { const additionalData = context.additionalData as MockProxy; + describe('getRuntimeCredential', () => { + beforeEach(() => { + additionalData.getRuntimeCredential.mockReset(); + }); + + it('forwards the alias to the additionalData callback and returns its value', async () => { + additionalData.getRuntimeCredential.mockResolvedValue('Bearer xyz'); + + const result = await context.getRuntimeCredential('api_key'); + + expect(result).toBe('Bearer xyz'); + expect(additionalData.getRuntimeCredential).toHaveBeenCalledWith(runExecutionData, 'api_key'); + }); + + it('returns undefined when the underlying callback yields undefined', async () => { + additionalData.getRuntimeCredential.mockResolvedValue(undefined); + + const result = await context.getRuntimeCredential('missing'); + + expect(result).toBeUndefined(); + }); + }); + describe('getExecutionCancelSignal', () => { it('should return the abort signal', () => { expect(context.getExecutionCancelSignal()).toBe(abortSignal); diff --git a/packages/core/src/execution-engine/node-execution-context/base-execute-context.ts b/packages/core/src/execution-engine/node-execution-context/base-execute-context.ts index 21baf53a151..f73f93c241a 100644 --- a/packages/core/src/execution-engine/node-execution-context/base-execute-context.ts +++ b/packages/core/src/execution-engine/node-execution-context/base-execute-context.ts @@ -132,6 +132,10 @@ export class BaseExecuteContext extends NodeExecutionContext { ); } + async getRuntimeCredential(alias: string): Promise { + return await this.additionalData.getRuntimeCredential(this.runExecutionData, alias); + } + async putExecutionToWait( waitTill: Date, options?: { acceptsResumeRequest?: boolean }, diff --git a/packages/core/src/execution-engine/node-execution-context/execute-context.ts b/packages/core/src/execution-engine/node-execution-context/execute-context.ts index de51495f891..c06df443328 100644 --- a/packages/core/src/execution-engine/node-execution-context/execute-context.ts +++ b/packages/core/src/execution-engine/node-execution-context/execute-context.ts @@ -3,7 +3,6 @@ import type { AINodeConnectionType, CallbackManager, CloseFunction, - IDataObject, IExecuteData, IExecuteFunctions, IExecuteResponsePromiseData, @@ -126,10 +125,6 @@ export class ExecuteContext extends BaseExecuteContext implements IExecuteFuncti )) as IExecuteFunctions['getNodeParameter']; } - async getRuntimeCredential(alias: string): Promise { - return await this.additionalData.getRuntimeCredential(this.runExecutionData, alias); - } - async getInputConnectionData( connectionType: AINodeConnectionType, itemIndex: number, diff --git a/packages/core/src/execution-engine/node-execution-context/execute-single-context.ts b/packages/core/src/execution-engine/node-execution-context/execute-single-context.ts index 54fde36654e..7016b49fc26 100644 --- a/packages/core/src/execution-engine/node-execution-context/execute-single-context.ts +++ b/packages/core/src/execution-engine/node-execution-context/execute-single-context.ts @@ -11,7 +11,6 @@ import type { WorkflowExecuteMode, ITaskDataConnections, IExecuteData, - IDataObject, } from 'n8n-workflow'; import { UnexpectedError, NodeConnectionTypes } from 'n8n-workflow'; @@ -87,10 +86,6 @@ export class ExecuteSingleContext extends BaseExecuteContext implements IExecute }; } - async getRuntimeCredential(alias: string): Promise { - return await this.additionalData.getRuntimeCredential(this.runExecutionData, alias); - } - evaluateExpression(expression: string, itemIndex: number = this.itemIndex) { return super.evaluateExpression(expression, itemIndex); }