mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-19 11:01:15 +00:00
refactor: Make execution IDs mandatory in BE (#8299)
Co-authored-by: Iván Ovejero <ivov.src@gmail.com>
This commit is contained in:
@@ -420,7 +420,7 @@ function hookFunctionsSave(parentProcessMode?: string): IWorkflowExecuteHooks {
|
||||
// Workflow is saved so update in database
|
||||
try {
|
||||
await Container.get(WorkflowStaticDataService).saveStaticDataById(
|
||||
this.workflowData.id as string,
|
||||
this.workflowData.id,
|
||||
newStaticData,
|
||||
);
|
||||
} catch (e) {
|
||||
@@ -464,7 +464,7 @@ function hookFunctionsSave(parentProcessMode?: string): IWorkflowExecuteHooks {
|
||||
this.retryOf,
|
||||
);
|
||||
await Container.get(ExecutionRepository).hardDelete({
|
||||
workflowId: this.workflowData.id as string,
|
||||
workflowId: this.workflowData.id,
|
||||
executionId: this.executionId,
|
||||
});
|
||||
|
||||
@@ -483,7 +483,7 @@ function hookFunctionsSave(parentProcessMode?: string): IWorkflowExecuteHooks {
|
||||
|
||||
await updateExistingExecution({
|
||||
executionId: this.executionId,
|
||||
workflowId: this.workflowData.id as string,
|
||||
workflowId: this.workflowData.id,
|
||||
executionData: fullExecutionData,
|
||||
});
|
||||
|
||||
@@ -566,7 +566,7 @@ function hookFunctionsSaveWorker(): IWorkflowExecuteHooks {
|
||||
// Workflow is saved so update in database
|
||||
try {
|
||||
await Container.get(WorkflowStaticDataService).saveStaticDataById(
|
||||
this.workflowData.id as string,
|
||||
this.workflowData.id,
|
||||
newStaticData,
|
||||
);
|
||||
} catch (e) {
|
||||
@@ -601,7 +601,7 @@ function hookFunctionsSaveWorker(): IWorkflowExecuteHooks {
|
||||
|
||||
await updateExistingExecution({
|
||||
executionId: this.executionId,
|
||||
workflowId: this.workflowData.id as string,
|
||||
workflowId: this.workflowData.id,
|
||||
executionData: fullExecutionData,
|
||||
});
|
||||
} catch (error) {
|
||||
@@ -702,7 +702,7 @@ export async function getRunData(
|
||||
|
||||
export async function getWorkflowData(
|
||||
workflowInfo: IExecuteWorkflowInfo,
|
||||
parentWorkflowId?: string,
|
||||
parentWorkflowId: string,
|
||||
parentWorkflowSettings?: IWorkflowSettings,
|
||||
): Promise<IWorkflowBase> {
|
||||
if (workflowInfo.id === undefined && workflowInfo.code === undefined) {
|
||||
@@ -748,7 +748,7 @@ async function executeWorkflow(
|
||||
additionalData: IWorkflowExecuteAdditionalData,
|
||||
options: {
|
||||
node?: INode;
|
||||
parentWorkflowId?: string;
|
||||
parentWorkflowId: string;
|
||||
inputData?: INodeExecutionData[];
|
||||
parentExecutionId?: string;
|
||||
loadedWorkflowData?: IWorkflowBase;
|
||||
@@ -769,7 +769,7 @@ async function executeWorkflow(
|
||||
|
||||
const workflowName = workflowData ? workflowData.name : undefined;
|
||||
const workflow = new Workflow({
|
||||
id: workflowData.id?.toString(),
|
||||
id: workflowData.id,
|
||||
name: workflowName,
|
||||
nodes: workflowData.nodes,
|
||||
connections: workflowData.connections,
|
||||
@@ -788,10 +788,7 @@ async function executeWorkflow(
|
||||
if (options.parentExecutionId !== undefined) {
|
||||
executionId = options.parentExecutionId;
|
||||
} else {
|
||||
executionId =
|
||||
options.parentExecutionId !== undefined
|
||||
? options.parentExecutionId
|
||||
: await activeExecutions.add(runData);
|
||||
executionId = options.parentExecutionId ?? (await activeExecutions.add(runData));
|
||||
}
|
||||
|
||||
void internalHooks.onWorkflowBeforeExecute(executionId || '', runData);
|
||||
@@ -801,7 +798,7 @@ async function executeWorkflow(
|
||||
await PermissionChecker.check(workflow, additionalData.userId);
|
||||
await PermissionChecker.checkSubworkflowExecutePolicy(
|
||||
workflow,
|
||||
options.parentWorkflowId!,
|
||||
options.parentWorkflowId,
|
||||
options.node,
|
||||
);
|
||||
|
||||
@@ -879,6 +876,7 @@ async function executeWorkflow(
|
||||
stoppedAt: fullRunData.stoppedAt,
|
||||
status: fullRunData.status,
|
||||
workflowData,
|
||||
workflowId: workflowData.id,
|
||||
};
|
||||
if (workflowData.id) {
|
||||
fullExecutionData.workflowId = workflowData.id;
|
||||
@@ -1082,7 +1080,7 @@ export function getWorkflowHooksWorkerMain(
|
||||
|
||||
if (shouldNotSave) {
|
||||
await Container.get(ExecutionRepository).hardDelete({
|
||||
workflowId: this.workflowData.id as string,
|
||||
workflowId: this.workflowData.id,
|
||||
executionId: this.executionId,
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user