mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-19 11:01:15 +00:00
refactor(core): Rename push sessionId to pushRef (#8905)
This commit is contained in:
committed by
GitHub
parent
eaaefd76da
commit
072c3db97d
@@ -244,50 +244,50 @@ function hookFunctionsPush(): IWorkflowExecuteHooks {
|
||||
return {
|
||||
nodeExecuteBefore: [
|
||||
async function (this: WorkflowHooks, nodeName: string): Promise<void> {
|
||||
const { sessionId, executionId } = this;
|
||||
const { pushRef, executionId } = this;
|
||||
// Push data to session which started workflow before each
|
||||
// node which starts rendering
|
||||
if (sessionId === undefined) {
|
||||
if (pushRef === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
logger.debug(`Executing hook on node "${nodeName}" (hookFunctionsPush)`, {
|
||||
executionId,
|
||||
sessionId,
|
||||
pushRef,
|
||||
workflowId: this.workflowData.id,
|
||||
});
|
||||
|
||||
pushInstance.send('nodeExecuteBefore', { executionId, nodeName }, sessionId);
|
||||
pushInstance.send('nodeExecuteBefore', { executionId, nodeName }, pushRef);
|
||||
},
|
||||
],
|
||||
nodeExecuteAfter: [
|
||||
async function (this: WorkflowHooks, nodeName: string, data: ITaskData): Promise<void> {
|
||||
const { sessionId, executionId } = this;
|
||||
const { pushRef, executionId } = this;
|
||||
// Push data to session which started workflow after each rendered node
|
||||
if (sessionId === undefined) {
|
||||
if (pushRef === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
logger.debug(`Executing hook on node "${nodeName}" (hookFunctionsPush)`, {
|
||||
executionId,
|
||||
sessionId,
|
||||
pushRef,
|
||||
workflowId: this.workflowData.id,
|
||||
});
|
||||
|
||||
pushInstance.send('nodeExecuteAfter', { executionId, nodeName, data }, sessionId);
|
||||
pushInstance.send('nodeExecuteAfter', { executionId, nodeName, data }, pushRef);
|
||||
},
|
||||
],
|
||||
workflowExecuteBefore: [
|
||||
async function (this: WorkflowHooks): Promise<void> {
|
||||
const { sessionId, executionId } = this;
|
||||
const { pushRef, executionId } = this;
|
||||
const { id: workflowId, name: workflowName } = this.workflowData;
|
||||
logger.debug('Executing hook (hookFunctionsPush)', {
|
||||
executionId,
|
||||
sessionId,
|
||||
pushRef,
|
||||
workflowId,
|
||||
});
|
||||
// Push data to session which started the workflow
|
||||
if (sessionId === undefined) {
|
||||
if (pushRef === undefined) {
|
||||
return;
|
||||
}
|
||||
pushInstance.send(
|
||||
@@ -298,24 +298,24 @@ function hookFunctionsPush(): IWorkflowExecuteHooks {
|
||||
startedAt: new Date(),
|
||||
retryOf: this.retryOf,
|
||||
workflowId,
|
||||
sessionId,
|
||||
pushRef,
|
||||
workflowName,
|
||||
},
|
||||
sessionId,
|
||||
pushRef,
|
||||
);
|
||||
},
|
||||
],
|
||||
workflowExecuteAfter: [
|
||||
async function (this: WorkflowHooks, fullRunData: IRun): Promise<void> {
|
||||
const { sessionId, executionId, retryOf } = this;
|
||||
const { pushRef, executionId, retryOf } = this;
|
||||
const { id: workflowId } = this.workflowData;
|
||||
logger.debug('Executing hook (hookFunctionsPush)', {
|
||||
executionId,
|
||||
sessionId,
|
||||
pushRef,
|
||||
workflowId,
|
||||
});
|
||||
// Push data to session which started the workflow
|
||||
if (sessionId === undefined) {
|
||||
if (pushRef === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -351,7 +351,7 @@ function hookFunctionsPush(): IWorkflowExecuteHooks {
|
||||
retryOf,
|
||||
};
|
||||
|
||||
pushInstance.send('executionFinished', sendData, sessionId);
|
||||
pushInstance.send('executionFinished', sendData, pushRef);
|
||||
},
|
||||
],
|
||||
};
|
||||
@@ -378,7 +378,7 @@ export function hookFunctionsPreExecute(): IWorkflowExecuteHooks {
|
||||
nodeName,
|
||||
data,
|
||||
executionData,
|
||||
this.sessionId,
|
||||
this.pushRef,
|
||||
);
|
||||
},
|
||||
],
|
||||
@@ -578,7 +578,7 @@ function hookFunctionsSaveWorker(): IWorkflowExecuteHooks {
|
||||
ErrorReporter.error(e);
|
||||
logger.error(
|
||||
`There was a problem saving the workflow with id "${this.workflowData.id}" to save changed staticData: "${e.message}" (workflowExecuteAfter)`,
|
||||
{ sessionId: this.sessionId, workflowId: this.workflowData.id },
|
||||
{ pushRef: this.pushRef, workflowId: this.workflowData.id },
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -939,15 +939,15 @@ export function setExecutionStatus(status: ExecutionStatus) {
|
||||
}
|
||||
|
||||
export function sendDataToUI(type: string, data: IDataObject | IDataObject[]) {
|
||||
const { sessionId } = this;
|
||||
if (sessionId === undefined) {
|
||||
const { pushRef } = this;
|
||||
if (pushRef === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Push data to session which started workflow
|
||||
try {
|
||||
const pushInstance = Container.get(Push);
|
||||
pushInstance.send(type as IPushDataType, data, sessionId);
|
||||
pushInstance.send(type as IPushDataType, data, pushRef);
|
||||
} catch (error) {
|
||||
const logger = Container.get(Logger);
|
||||
logger.warn(`There was a problem sending message to UI: ${error.message}`);
|
||||
@@ -1128,7 +1128,7 @@ export function getWorkflowHooksMain(
|
||||
if (!hookFunctions.nodeExecuteAfter) hookFunctions.nodeExecuteAfter = [];
|
||||
|
||||
return new WorkflowHooks(hookFunctions, data.executionMode, executionId, data.workflowData, {
|
||||
sessionId: data.sessionId,
|
||||
pushRef: data.pushRef,
|
||||
retryOf: data.retryOf as string,
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user