mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2026-08-05 11:28:36 +02:00
fix(Call n8n Workflow Tool Node): Support concurrent invocations of the tool (#13526)
Co-authored-by: Oleg Ivaniv <me@olegivaniv.com>
This commit is contained in:
co-authored by
Oleg Ivaniv
parent
24a38b99a1
commit
5334661b76
+11
-1
@@ -54,7 +54,9 @@ describe('SupplyDataContext', () => {
|
||||
const credentialsHelper = mock<ICredentialsHelper>();
|
||||
const additionalData = mock<IWorkflowExecuteAdditionalData>({ credentialsHelper });
|
||||
const mode: WorkflowExecuteMode = 'manual';
|
||||
const runExecutionData = mock<IRunExecutionData>();
|
||||
const runExecutionData = mock<IRunExecutionData>({
|
||||
resultData: { runData: {} },
|
||||
});
|
||||
const connectionInputData: INodeExecutionData[] = [];
|
||||
const connectionType = NodeConnectionType.Main;
|
||||
const inputData: ITaskDataConnections = { [connectionType]: [[{ json: { test: 'data' } }]] };
|
||||
@@ -175,4 +177,12 @@ describe('SupplyDataContext', () => {
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
describe('cloneWith', () => {
|
||||
it('should return a new copy', () => {
|
||||
const clone = supplyDataContext.cloneWith({ runIndex: 12, inputData: [[{ json: {} }]] });
|
||||
expect(clone.runIndex).toBe(12);
|
||||
expect(clone).not.toBe(supplyDataContext);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -13,11 +13,10 @@ import type {
|
||||
ITaskDataConnections,
|
||||
ITaskMetadata,
|
||||
IWorkflowExecuteAdditionalData,
|
||||
NodeConnectionType,
|
||||
Workflow,
|
||||
WorkflowExecuteMode,
|
||||
} from 'n8n-workflow';
|
||||
import { createDeferredPromise } from 'n8n-workflow';
|
||||
import { createDeferredPromise, NodeConnectionType } from 'n8n-workflow';
|
||||
|
||||
import { BaseExecuteContext } from './base-execute-context';
|
||||
import {
|
||||
@@ -109,6 +108,28 @@ export class SupplyDataContext extends BaseExecuteContext implements ISupplyData
|
||||
)) as ISupplyDataFunctions['getNodeParameter'];
|
||||
}
|
||||
|
||||
cloneWith(replacements: {
|
||||
runIndex: number;
|
||||
inputData: INodeExecutionData[][];
|
||||
}): SupplyDataContext {
|
||||
const context = new SupplyDataContext(
|
||||
this.workflow,
|
||||
this.node,
|
||||
this.additionalData,
|
||||
this.mode,
|
||||
this.runExecutionData,
|
||||
replacements.runIndex,
|
||||
this.connectionInputData,
|
||||
{},
|
||||
this.connectionType,
|
||||
this.executeData,
|
||||
this.closeFunctions,
|
||||
this.abortSignal,
|
||||
);
|
||||
context.addInputData(NodeConnectionType.AiTool, replacements.inputData);
|
||||
return context;
|
||||
}
|
||||
|
||||
async getInputConnectionData(
|
||||
connectionType: AINodeConnectionType,
|
||||
itemIndex: number,
|
||||
|
||||
Reference in New Issue
Block a user