mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 01:56:46 +00:00
refactor(core): Remove NodeExecutionOutput. Add execution hints directly to the context (#13111)
This commit is contained in:
committed by
GitHub
parent
5dddf772cf
commit
dbb9475b7b
@@ -36,7 +36,6 @@ import {
|
||||
ApplicationError,
|
||||
createDeferredPromise,
|
||||
NodeConnectionType,
|
||||
NodeExecutionOutput,
|
||||
NodeHelpers,
|
||||
Workflow,
|
||||
} from 'n8n-workflow';
|
||||
@@ -246,18 +245,6 @@ describe('WorkflowExecute', () => {
|
||||
}
|
||||
});
|
||||
|
||||
test('WorkflowExecute, NodeExecutionOutput type test', () => {
|
||||
//TODO Add more tests here when execution hints are added to some node types
|
||||
const nodeExecutionOutput = new NodeExecutionOutput(
|
||||
[[{ json: { data: 123 } }]],
|
||||
[{ message: 'TEXT HINT' }],
|
||||
);
|
||||
|
||||
expect(nodeExecutionOutput).toBeInstanceOf(NodeExecutionOutput);
|
||||
expect(nodeExecutionOutput[0][0].json.data).toEqual(123);
|
||||
expect(nodeExecutionOutput.getHints()[0].message).toEqual('TEXT HINT');
|
||||
});
|
||||
|
||||
describe('runPartialWorkflow2', () => {
|
||||
// Dirty ►
|
||||
// ┌───────┐1 ┌─────┐1 ┌─────┐
|
||||
|
||||
@@ -11,6 +11,7 @@ import type {
|
||||
IRunExecutionData,
|
||||
ITaskDataConnections,
|
||||
IWorkflowExecuteAdditionalData,
|
||||
NodeExecutionHint,
|
||||
Result,
|
||||
Workflow,
|
||||
WorkflowExecuteMode,
|
||||
@@ -51,6 +52,8 @@ export class ExecuteContext extends BaseExecuteContext implements IExecuteFuncti
|
||||
|
||||
readonly getNodeParameter: IExecuteFunctions['getNodeParameter'];
|
||||
|
||||
readonly hints: NodeExecutionHint[] = [];
|
||||
|
||||
constructor(
|
||||
workflow: Workflow,
|
||||
node: INode,
|
||||
@@ -210,4 +213,8 @@ export class ExecuteContext extends BaseExecuteContext implements IExecuteFuncti
|
||||
getParentCallbackManager(): CallbackManager | undefined {
|
||||
return this.additionalData.parentCallbackManager;
|
||||
}
|
||||
|
||||
addExecutionHints(...hints: NodeExecutionHint[]) {
|
||||
this.hints.push(...hints);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,7 +47,6 @@ import {
|
||||
NodeHelpers,
|
||||
NodeConnectionType,
|
||||
ApplicationError,
|
||||
NodeExecutionOutput,
|
||||
sleep,
|
||||
ExecutionCancelledError,
|
||||
Node,
|
||||
@@ -1101,7 +1100,7 @@ export class WorkflowExecute {
|
||||
});
|
||||
}
|
||||
|
||||
return { data };
|
||||
return { data, hints: context.hints };
|
||||
} else if (nodeType.poll) {
|
||||
if (mode === 'manual') {
|
||||
// In manual mode run the poll function
|
||||
@@ -1507,10 +1506,8 @@ export class WorkflowExecute {
|
||||
tryIndex++;
|
||||
}
|
||||
|
||||
if (nodeSuccessData instanceof NodeExecutionOutput) {
|
||||
const hints = (nodeSuccessData as NodeExecutionOutput).getHints();
|
||||
|
||||
executionHints.push(...hints);
|
||||
if (runNodeData.hints?.length) {
|
||||
executionHints.push(...runNodeData.hints);
|
||||
}
|
||||
|
||||
if (nodeSuccessData && executionData.node.onError === 'continueErrorOutput') {
|
||||
|
||||
Reference in New Issue
Block a user