mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 10:31:15 +00:00
✨ Add ExecuteWorkflow-Node
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
|
||||
import {
|
||||
IProcessMessageDataHook,
|
||||
IWorkflowExecutionDataProcessWithExecution,
|
||||
NodeTypes,
|
||||
WorkflowExecuteAdditionalData,
|
||||
@@ -18,10 +17,9 @@ import {
|
||||
INodeTypeData,
|
||||
IRun,
|
||||
ITaskData,
|
||||
IWorkflowExecuteHooks,
|
||||
Workflow,
|
||||
WorkflowHooks,
|
||||
} from 'n8n-workflow';
|
||||
import { ChildProcess } from 'child_process';
|
||||
|
||||
export class WorkflowRunnerProcess {
|
||||
data: IWorkflowExecutionDataProcessWithExecution | undefined;
|
||||
@@ -61,10 +59,9 @@ export class WorkflowRunnerProcess {
|
||||
await nodeTypes.init(nodeTypesData);
|
||||
|
||||
this.workflow = new Workflow(this.data.workflowData.id as string | undefined, this.data.workflowData!.nodes, this.data.workflowData!.connections, this.data.workflowData!.active, nodeTypes, this.data.workflowData!.staticData);
|
||||
const additionalData = await WorkflowExecuteAdditionalData.getBase(this.data.executionMode, this.data.credentials);
|
||||
const additionalData = await WorkflowExecuteAdditionalData.getBase(this.data.credentials);
|
||||
additionalData.hooks = this.getProcessForwardHooks();
|
||||
|
||||
|
||||
if (this.data.executionData !== undefined) {
|
||||
this.workflowExecute = new WorkflowExecute(additionalData, this.data.executionMode, this.data.executionData);
|
||||
return this.workflowExecute.processRunExecutionData(this.workflow);
|
||||
@@ -111,11 +108,10 @@ export class WorkflowRunnerProcess {
|
||||
* the parent process where they then can be executed with access
|
||||
* to database and to PushService
|
||||
*
|
||||
* @param {ChildProcess} process
|
||||
* @returns
|
||||
*/
|
||||
getProcessForwardHooks(): IWorkflowExecuteHooks {
|
||||
return {
|
||||
getProcessForwardHooks(): WorkflowHooks {
|
||||
const hookFunctions = {
|
||||
nodeExecuteBefore: [
|
||||
async (nodeName: string): Promise<void> => {
|
||||
this.sendHookToParentProcess('nodeExecuteBefore', [nodeName]);
|
||||
@@ -137,6 +133,8 @@ export class WorkflowRunnerProcess {
|
||||
},
|
||||
]
|
||||
};
|
||||
|
||||
return new WorkflowHooks(hookFunctions, this.data!.executionMode, this.data!.executionId, this.data!.workflowData, { sessionId: this.data!.sessionId, retryOf: this.data!.retryOf as string });
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user