mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2026-09-27 04:01:44 +02:00
refactor: Migrate NodeConnectionType to const object type (no-changelog) (#14078)
Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
This commit is contained in:
co-authored by
कारतोफ्फेलस्क्रिप्ट™
parent
7e8179b848
commit
8215e0b59f
+5
-5
@@ -9,7 +9,7 @@
|
||||
// XX denotes that the node is disabled
|
||||
// PD denotes that the node has pinned data
|
||||
|
||||
import { NodeConnectionType, type IRunData } from 'n8n-workflow';
|
||||
import { NodeConnectionTypes, type IRunData } from 'n8n-workflow';
|
||||
|
||||
import { createNodeData, toITaskData } from './helpers';
|
||||
import { cleanRunData } from '../clean-run-data';
|
||||
@@ -140,7 +140,7 @@ describe('cleanRunData', () => {
|
||||
.addNodes(node1, rootNode, subNode)
|
||||
.addConnections(
|
||||
{ from: node1, to: rootNode },
|
||||
{ from: subNode, to: rootNode, type: NodeConnectionType.AiLanguageModel },
|
||||
{ from: subNode, to: rootNode, type: NodeConnectionTypes.AiLanguageModel },
|
||||
);
|
||||
const runData: IRunData = {
|
||||
[node1.name]: [toITaskData([{ data: { value: 1 } }])],
|
||||
@@ -176,7 +176,7 @@ describe('cleanRunData', () => {
|
||||
.addConnections(
|
||||
{ from: node1, to: node2 },
|
||||
{ from: node2, to: rootNode },
|
||||
{ from: subNode, to: rootNode, type: NodeConnectionType.AiLanguageModel },
|
||||
{ from: subNode, to: rootNode, type: NodeConnectionTypes.AiLanguageModel },
|
||||
);
|
||||
const runData: IRunData = {
|
||||
[node1.name]: [toITaskData([{ data: { value: 1 } }])],
|
||||
@@ -213,8 +213,8 @@ describe('cleanRunData', () => {
|
||||
.addConnections(
|
||||
{ from: node1, to: rootNode1 },
|
||||
{ from: rootNode1, to: rootNode2 },
|
||||
{ from: subNode, to: rootNode1, type: NodeConnectionType.AiLanguageModel },
|
||||
{ from: subNode, to: rootNode2, type: NodeConnectionType.AiLanguageModel },
|
||||
{ from: subNode, to: rootNode1, type: NodeConnectionTypes.AiLanguageModel },
|
||||
{ from: subNode, to: rootNode2, type: NodeConnectionTypes.AiLanguageModel },
|
||||
);
|
||||
const runData: IRunData = {
|
||||
[node1.name]: [toITaskData([{ data: { value: 1 } }])],
|
||||
|
||||
+3
-3
@@ -10,7 +10,7 @@
|
||||
// PD denotes that the node has pinned data
|
||||
|
||||
import type { INode } from 'n8n-workflow';
|
||||
import { NodeConnectionType } from 'n8n-workflow';
|
||||
import { NodeConnectionTypes } from 'n8n-workflow';
|
||||
|
||||
import { createNodeData, defaultWorkflowParameter } from './helpers';
|
||||
import { DirectedGraph } from '../directed-graph';
|
||||
@@ -327,7 +327,7 @@ describe('DirectedGraph', () => {
|
||||
expect(newConnections[0]).toEqual({
|
||||
from: node0,
|
||||
outputIndex: 0,
|
||||
type: NodeConnectionType.Main,
|
||||
type: NodeConnectionTypes.Main,
|
||||
inputIndex: 0,
|
||||
to: node2,
|
||||
});
|
||||
@@ -372,7 +372,7 @@ describe('DirectedGraph', () => {
|
||||
expect(newConnections[0]).toEqual({
|
||||
from: node0,
|
||||
outputIndex: 1,
|
||||
type: NodeConnectionType.Main,
|
||||
type: NodeConnectionTypes.Main,
|
||||
inputIndex: 4,
|
||||
to: node2,
|
||||
});
|
||||
|
||||
+2
-2
@@ -9,7 +9,7 @@
|
||||
// XX denotes that the node is disabled
|
||||
// PD denotes that the node has pinned data
|
||||
|
||||
import { NodeConnectionType } from 'n8n-workflow';
|
||||
import { NodeConnectionTypes } from 'n8n-workflow';
|
||||
|
||||
import { createNodeData } from './helpers';
|
||||
import { DirectedGraph } from '../directed-graph';
|
||||
@@ -104,7 +104,7 @@ describe('filterDisabledNodes', () => {
|
||||
.addNodes(trigger, root, aiModel, destination)
|
||||
.addConnections(
|
||||
{ from: trigger, to: root },
|
||||
{ from: aiModel, type: NodeConnectionType.AiLanguageModel, to: root },
|
||||
{ from: aiModel, type: NodeConnectionTypes.AiLanguageModel, to: root },
|
||||
{ from: root, to: destination },
|
||||
);
|
||||
|
||||
|
||||
+4
-4
@@ -9,7 +9,7 @@
|
||||
// XX denotes that the node is disabled
|
||||
// PD denotes that the node has pinned data
|
||||
|
||||
import { NodeConnectionType } from 'n8n-workflow';
|
||||
import { NodeConnectionTypes } from 'n8n-workflow';
|
||||
|
||||
import { createNodeData } from './helpers';
|
||||
import { DirectedGraph } from '../directed-graph';
|
||||
@@ -191,7 +191,7 @@ describe('findSubgraph', () => {
|
||||
// ┌┴──────┐
|
||||
// │aiModel│
|
||||
// └───────┘
|
||||
test('always retain connections that have a different type than `NodeConnectionType.Main`', () => {
|
||||
test('always retain connections that have a different type than `NodeConnectionTypes.Main`', () => {
|
||||
// ARRANGE
|
||||
const trigger = createNodeData({ name: 'trigger' });
|
||||
const destination = createNodeData({ name: 'destination' });
|
||||
@@ -201,7 +201,7 @@ describe('findSubgraph', () => {
|
||||
.addNodes(trigger, destination, aiModel)
|
||||
.addConnections(
|
||||
{ from: trigger, to: destination },
|
||||
{ from: aiModel, type: NodeConnectionType.AiLanguageModel, to: destination },
|
||||
{ from: aiModel, type: NodeConnectionTypes.AiLanguageModel, to: destination },
|
||||
);
|
||||
|
||||
// ACT
|
||||
@@ -236,7 +236,7 @@ describe('findSubgraph', () => {
|
||||
.addNodes(trigger, root, aiModel, destination)
|
||||
.addConnections(
|
||||
{ from: trigger, to: aiModel },
|
||||
{ from: aiModel, type: NodeConnectionType.AiLanguageModel, to: root },
|
||||
{ from: aiModel, type: NodeConnectionTypes.AiLanguageModel, to: root },
|
||||
{ from: root, to: destination },
|
||||
);
|
||||
|
||||
|
||||
+19
-19
@@ -8,7 +8,7 @@
|
||||
// PD denotes that the node has pinned data
|
||||
|
||||
import type { IPinData } from 'n8n-workflow';
|
||||
import { NodeConnectionType, type IRunData } from 'n8n-workflow';
|
||||
import { NodeConnectionTypes, type IRunData } from 'n8n-workflow';
|
||||
|
||||
import { createNodeData, toITaskData } from './helpers';
|
||||
import { DirectedGraph } from '../directed-graph';
|
||||
@@ -56,14 +56,14 @@ describe('getSourceDataGroups', () => {
|
||||
expect(group1.connections[0]).toEqual({
|
||||
from: source1,
|
||||
outputIndex: 0,
|
||||
type: NodeConnectionType.Main,
|
||||
type: NodeConnectionTypes.Main,
|
||||
inputIndex: 0,
|
||||
to: node,
|
||||
});
|
||||
expect(group1.connections[1]).toEqual({
|
||||
from: source3,
|
||||
outputIndex: 0,
|
||||
type: NodeConnectionType.Main,
|
||||
type: NodeConnectionTypes.Main,
|
||||
inputIndex: 1,
|
||||
to: node,
|
||||
});
|
||||
@@ -73,7 +73,7 @@ describe('getSourceDataGroups', () => {
|
||||
expect(group2.connections[0]).toEqual({
|
||||
from: source2,
|
||||
outputIndex: 0,
|
||||
type: NodeConnectionType.Main,
|
||||
type: NodeConnectionTypes.Main,
|
||||
inputIndex: 0,
|
||||
to: node,
|
||||
});
|
||||
@@ -120,14 +120,14 @@ describe('getSourceDataGroups', () => {
|
||||
expect(group1.connections[0]).toEqual({
|
||||
from: source1,
|
||||
outputIndex: 0,
|
||||
type: NodeConnectionType.Main,
|
||||
type: NodeConnectionTypes.Main,
|
||||
inputIndex: 0,
|
||||
to: node,
|
||||
});
|
||||
expect(group1.connections[1]).toEqual({
|
||||
from: source3,
|
||||
outputIndex: 0,
|
||||
type: NodeConnectionType.Main,
|
||||
type: NodeConnectionTypes.Main,
|
||||
inputIndex: 1,
|
||||
to: node,
|
||||
});
|
||||
@@ -137,7 +137,7 @@ describe('getSourceDataGroups', () => {
|
||||
expect(group2.connections[0]).toEqual({
|
||||
from: source2,
|
||||
outputIndex: 0,
|
||||
type: NodeConnectionType.Main,
|
||||
type: NodeConnectionTypes.Main,
|
||||
inputIndex: 0,
|
||||
to: node,
|
||||
});
|
||||
@@ -184,14 +184,14 @@ describe('getSourceDataGroups', () => {
|
||||
expect(group1.connections[0]).toEqual({
|
||||
from: source2,
|
||||
outputIndex: 0,
|
||||
type: NodeConnectionType.Main,
|
||||
type: NodeConnectionTypes.Main,
|
||||
inputIndex: 0,
|
||||
to: node,
|
||||
});
|
||||
expect(group1.connections[1]).toEqual({
|
||||
from: source3,
|
||||
outputIndex: 0,
|
||||
type: NodeConnectionType.Main,
|
||||
type: NodeConnectionTypes.Main,
|
||||
inputIndex: 1,
|
||||
to: node,
|
||||
});
|
||||
@@ -205,7 +205,7 @@ describe('getSourceDataGroups', () => {
|
||||
expect(group1.connections[0]).toEqual({
|
||||
from: source1,
|
||||
outputIndex: 0,
|
||||
type: NodeConnectionType.Main,
|
||||
type: NodeConnectionTypes.Main,
|
||||
inputIndex: 0,
|
||||
to: node,
|
||||
});
|
||||
@@ -261,14 +261,14 @@ describe('getSourceDataGroups', () => {
|
||||
expect(group1.connections[0]).toEqual({
|
||||
from: source2,
|
||||
outputIndex: 0,
|
||||
type: NodeConnectionType.Main,
|
||||
type: NodeConnectionTypes.Main,
|
||||
inputIndex: 0,
|
||||
to: node,
|
||||
});
|
||||
expect(group1.connections[1]).toEqual({
|
||||
from: source3,
|
||||
outputIndex: 0,
|
||||
type: NodeConnectionType.Main,
|
||||
type: NodeConnectionTypes.Main,
|
||||
inputIndex: 1,
|
||||
to: node,
|
||||
});
|
||||
@@ -282,14 +282,14 @@ describe('getSourceDataGroups', () => {
|
||||
expect(group1.connections[0]).toEqual({
|
||||
from: source1,
|
||||
outputIndex: 0,
|
||||
type: NodeConnectionType.Main,
|
||||
type: NodeConnectionTypes.Main,
|
||||
inputIndex: 0,
|
||||
to: node,
|
||||
});
|
||||
expect(group1.connections[1]).toEqual({
|
||||
from: source4,
|
||||
outputIndex: 0,
|
||||
type: NodeConnectionType.Main,
|
||||
type: NodeConnectionTypes.Main,
|
||||
inputIndex: 1,
|
||||
to: node,
|
||||
});
|
||||
@@ -341,14 +341,14 @@ describe('getSourceDataGroups', () => {
|
||||
expect(group1.connections[0]).toEqual({
|
||||
from: source1,
|
||||
outputIndex: 0,
|
||||
type: NodeConnectionType.Main,
|
||||
type: NodeConnectionTypes.Main,
|
||||
inputIndex: 0,
|
||||
to: node,
|
||||
});
|
||||
expect(group1.connections[1]).toEqual({
|
||||
from: source3,
|
||||
outputIndex: 0,
|
||||
type: NodeConnectionType.Main,
|
||||
type: NodeConnectionTypes.Main,
|
||||
inputIndex: 1,
|
||||
to: node,
|
||||
});
|
||||
@@ -358,7 +358,7 @@ describe('getSourceDataGroups', () => {
|
||||
expect(group2.connections[0]).toEqual({
|
||||
from: source2,
|
||||
outputIndex: 0,
|
||||
type: NodeConnectionType.Main,
|
||||
type: NodeConnectionTypes.Main,
|
||||
inputIndex: 0,
|
||||
to: node,
|
||||
});
|
||||
@@ -461,7 +461,7 @@ describe('getSourceDataGroups', () => {
|
||||
expect(group1.connections[0]).toEqual({
|
||||
from: source1,
|
||||
outputIndex: 0,
|
||||
type: NodeConnectionType.Main,
|
||||
type: NodeConnectionTypes.Main,
|
||||
inputIndex: -1,
|
||||
to: node,
|
||||
});
|
||||
@@ -490,7 +490,7 @@ describe('getSourceDataGroups', () => {
|
||||
expect(group1.connections[0]).toEqual({
|
||||
from: source1,
|
||||
outputIndex: 0,
|
||||
type: NodeConnectionType.Main,
|
||||
type: NodeConnectionTypes.Main,
|
||||
inputIndex: 1,
|
||||
to: node,
|
||||
});
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
import { NodeConnectionType } from 'n8n-workflow';
|
||||
import type { INodeParameters, INode, ITaskData, IDataObject, IConnections } from 'n8n-workflow';
|
||||
import { NodeConnectionTypes } from 'n8n-workflow';
|
||||
import type {
|
||||
INodeParameters,
|
||||
INode,
|
||||
ITaskData,
|
||||
IDataObject,
|
||||
IConnections,
|
||||
NodeConnectionType,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
interface StubNode {
|
||||
name: string;
|
||||
@@ -38,7 +45,7 @@ export function toITaskData(taskData: TaskData[]): ITaskData {
|
||||
// NOTE: Here to make TS happy.
|
||||
result.data = result.data ?? {};
|
||||
for (const taskDatum of taskData) {
|
||||
const type = taskDatum.nodeConnectionType ?? NodeConnectionType.Main;
|
||||
const type = taskDatum.nodeConnectionType ?? NodeConnectionTypes.Main;
|
||||
const outputIndex = taskDatum.outputIndex ?? 0;
|
||||
|
||||
result.data[type] = result.data[type] ?? [];
|
||||
@@ -78,7 +85,7 @@ export function toIConnections(connections: Connection[]): IConnections {
|
||||
const result: IConnections = {};
|
||||
|
||||
for (const connection of connections) {
|
||||
const type = connection.type ?? NodeConnectionType.Main;
|
||||
const type = connection.type ?? NodeConnectionTypes.Main;
|
||||
const outputIndex = connection.outputIndex ?? 0;
|
||||
const inputIndex = connection.inputIndex ?? 0;
|
||||
|
||||
|
||||
+43
-43
@@ -16,7 +16,7 @@ import type {
|
||||
IWaitingForExecution,
|
||||
IWaitingForExecutionSource,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeConnectionType, type IPinData, type IRunData } from 'n8n-workflow';
|
||||
import { NodeConnectionTypes, type IPinData, type IRunData } from 'n8n-workflow';
|
||||
|
||||
import { createNodeData, toITaskData } from './helpers';
|
||||
import { DirectedGraph } from '../directed-graph';
|
||||
@@ -516,7 +516,7 @@ describe('addWaitingExecution', () => {
|
||||
waitingExecution,
|
||||
nodeName1,
|
||||
1, // runIndex
|
||||
NodeConnectionType.Main,
|
||||
NodeConnectionTypes.Main,
|
||||
1, // inputIndex
|
||||
executionData,
|
||||
);
|
||||
@@ -524,7 +524,7 @@ describe('addWaitingExecution', () => {
|
||||
[nodeName1]: {
|
||||
// runIndex
|
||||
1: {
|
||||
[NodeConnectionType.Main]: [undefined, executionData],
|
||||
[NodeConnectionTypes.Main]: [undefined, executionData],
|
||||
},
|
||||
},
|
||||
});
|
||||
@@ -536,7 +536,7 @@ describe('addWaitingExecution', () => {
|
||||
waitingExecution,
|
||||
nodeName1,
|
||||
1, // runIndex
|
||||
NodeConnectionType.Main,
|
||||
NodeConnectionTypes.Main,
|
||||
0, // inputIndex
|
||||
executionData,
|
||||
);
|
||||
@@ -544,7 +544,7 @@ describe('addWaitingExecution', () => {
|
||||
[nodeName1]: {
|
||||
// runIndex
|
||||
1: {
|
||||
[NodeConnectionType.Main]: [executionData, executionData],
|
||||
[NodeConnectionTypes.Main]: [executionData, executionData],
|
||||
},
|
||||
},
|
||||
});
|
||||
@@ -556,7 +556,7 @@ describe('addWaitingExecution', () => {
|
||||
waitingExecution,
|
||||
nodeName1,
|
||||
1, // runIndex
|
||||
NodeConnectionType.AiMemory,
|
||||
NodeConnectionTypes.AiMemory,
|
||||
0, // inputIndex
|
||||
executionData,
|
||||
);
|
||||
@@ -564,8 +564,8 @@ describe('addWaitingExecution', () => {
|
||||
[nodeName1]: {
|
||||
// runIndex
|
||||
1: {
|
||||
[NodeConnectionType.Main]: [executionData, executionData],
|
||||
[NodeConnectionType.AiMemory]: [executionData],
|
||||
[NodeConnectionTypes.Main]: [executionData, executionData],
|
||||
[NodeConnectionTypes.AiMemory]: [executionData],
|
||||
},
|
||||
},
|
||||
});
|
||||
@@ -577,7 +577,7 @@ describe('addWaitingExecution', () => {
|
||||
waitingExecution,
|
||||
nodeName1,
|
||||
0, // runIndex
|
||||
NodeConnectionType.AiChain,
|
||||
NodeConnectionTypes.AiChain,
|
||||
0, // inputIndex
|
||||
executionData,
|
||||
);
|
||||
@@ -585,11 +585,11 @@ describe('addWaitingExecution', () => {
|
||||
[nodeName1]: {
|
||||
// runIndex
|
||||
0: {
|
||||
[NodeConnectionType.AiChain]: [executionData],
|
||||
[NodeConnectionTypes.AiChain]: [executionData],
|
||||
},
|
||||
1: {
|
||||
[NodeConnectionType.Main]: [executionData, executionData],
|
||||
[NodeConnectionType.AiMemory]: [executionData],
|
||||
[NodeConnectionTypes.Main]: [executionData, executionData],
|
||||
[NodeConnectionTypes.AiMemory]: [executionData],
|
||||
},
|
||||
},
|
||||
});
|
||||
@@ -601,7 +601,7 @@ describe('addWaitingExecution', () => {
|
||||
waitingExecution,
|
||||
nodeName2,
|
||||
0, // runIndex
|
||||
NodeConnectionType.Main,
|
||||
NodeConnectionTypes.Main,
|
||||
2, // inputIndex
|
||||
executionData,
|
||||
);
|
||||
@@ -609,17 +609,17 @@ describe('addWaitingExecution', () => {
|
||||
[nodeName1]: {
|
||||
// runIndex
|
||||
0: {
|
||||
[NodeConnectionType.AiChain]: [executionData],
|
||||
[NodeConnectionTypes.AiChain]: [executionData],
|
||||
},
|
||||
1: {
|
||||
[NodeConnectionType.Main]: [executionData, executionData],
|
||||
[NodeConnectionType.AiMemory]: [executionData],
|
||||
[NodeConnectionTypes.Main]: [executionData, executionData],
|
||||
[NodeConnectionTypes.AiMemory]: [executionData],
|
||||
},
|
||||
},
|
||||
[nodeName2]: {
|
||||
// runIndex
|
||||
0: {
|
||||
[NodeConnectionType.Main]: [undefined, undefined, executionData],
|
||||
[NodeConnectionTypes.Main]: [undefined, undefined, executionData],
|
||||
},
|
||||
},
|
||||
});
|
||||
@@ -631,7 +631,7 @@ describe('addWaitingExecution', () => {
|
||||
waitingExecution,
|
||||
nodeName2,
|
||||
0, // runIndex
|
||||
NodeConnectionType.Main,
|
||||
NodeConnectionTypes.Main,
|
||||
0, // inputIndex
|
||||
null,
|
||||
);
|
||||
@@ -639,17 +639,17 @@ describe('addWaitingExecution', () => {
|
||||
[nodeName2]: {
|
||||
// runIndex
|
||||
0: {
|
||||
[NodeConnectionType.Main]: [null, undefined, executionData],
|
||||
[NodeConnectionTypes.Main]: [null, undefined, executionData],
|
||||
},
|
||||
},
|
||||
[nodeName1]: {
|
||||
// runIndex
|
||||
0: {
|
||||
[NodeConnectionType.AiChain]: [executionData],
|
||||
[NodeConnectionTypes.AiChain]: [executionData],
|
||||
},
|
||||
1: {
|
||||
[NodeConnectionType.Main]: [executionData, executionData],
|
||||
[NodeConnectionType.AiMemory]: [executionData],
|
||||
[NodeConnectionTypes.Main]: [executionData, executionData],
|
||||
[NodeConnectionTypes.AiMemory]: [executionData],
|
||||
},
|
||||
},
|
||||
});
|
||||
@@ -674,7 +674,7 @@ describe('addWaitingExecutionSource', () => {
|
||||
waitingExecutionSource,
|
||||
nodeName1,
|
||||
1, // runIndex
|
||||
NodeConnectionType.Main,
|
||||
NodeConnectionTypes.Main,
|
||||
1, // inputIndex
|
||||
sourceData,
|
||||
);
|
||||
@@ -682,7 +682,7 @@ describe('addWaitingExecutionSource', () => {
|
||||
[nodeName1]: {
|
||||
// runIndex
|
||||
1: {
|
||||
[NodeConnectionType.Main]: [undefined, sourceData],
|
||||
[NodeConnectionTypes.Main]: [undefined, sourceData],
|
||||
},
|
||||
},
|
||||
});
|
||||
@@ -694,7 +694,7 @@ describe('addWaitingExecutionSource', () => {
|
||||
waitingExecutionSource,
|
||||
nodeName1,
|
||||
1, // runIndex
|
||||
NodeConnectionType.Main,
|
||||
NodeConnectionTypes.Main,
|
||||
0, // inputIndex
|
||||
sourceData,
|
||||
);
|
||||
@@ -702,7 +702,7 @@ describe('addWaitingExecutionSource', () => {
|
||||
[nodeName1]: {
|
||||
// runIndex
|
||||
1: {
|
||||
[NodeConnectionType.Main]: [sourceData, sourceData],
|
||||
[NodeConnectionTypes.Main]: [sourceData, sourceData],
|
||||
},
|
||||
},
|
||||
});
|
||||
@@ -714,7 +714,7 @@ describe('addWaitingExecutionSource', () => {
|
||||
waitingExecutionSource,
|
||||
nodeName1,
|
||||
1, // runIndex
|
||||
NodeConnectionType.AiMemory,
|
||||
NodeConnectionTypes.AiMemory,
|
||||
0, // inputIndex
|
||||
sourceData,
|
||||
);
|
||||
@@ -722,8 +722,8 @@ describe('addWaitingExecutionSource', () => {
|
||||
[nodeName1]: {
|
||||
// runIndex
|
||||
1: {
|
||||
[NodeConnectionType.Main]: [sourceData, sourceData],
|
||||
[NodeConnectionType.AiMemory]: [sourceData],
|
||||
[NodeConnectionTypes.Main]: [sourceData, sourceData],
|
||||
[NodeConnectionTypes.AiMemory]: [sourceData],
|
||||
},
|
||||
},
|
||||
});
|
||||
@@ -735,7 +735,7 @@ describe('addWaitingExecutionSource', () => {
|
||||
waitingExecutionSource,
|
||||
nodeName1,
|
||||
0, // runIndex
|
||||
NodeConnectionType.AiChain,
|
||||
NodeConnectionTypes.AiChain,
|
||||
0, // inputIndex
|
||||
sourceData,
|
||||
);
|
||||
@@ -743,11 +743,11 @@ describe('addWaitingExecutionSource', () => {
|
||||
[nodeName1]: {
|
||||
// runIndex
|
||||
0: {
|
||||
[NodeConnectionType.AiChain]: [sourceData],
|
||||
[NodeConnectionTypes.AiChain]: [sourceData],
|
||||
},
|
||||
1: {
|
||||
[NodeConnectionType.Main]: [sourceData, sourceData],
|
||||
[NodeConnectionType.AiMemory]: [sourceData],
|
||||
[NodeConnectionTypes.Main]: [sourceData, sourceData],
|
||||
[NodeConnectionTypes.AiMemory]: [sourceData],
|
||||
},
|
||||
},
|
||||
});
|
||||
@@ -759,7 +759,7 @@ describe('addWaitingExecutionSource', () => {
|
||||
waitingExecutionSource,
|
||||
nodeName2,
|
||||
0, // runIndex
|
||||
NodeConnectionType.Main,
|
||||
NodeConnectionTypes.Main,
|
||||
2, // inputIndex
|
||||
sourceData,
|
||||
);
|
||||
@@ -767,17 +767,17 @@ describe('addWaitingExecutionSource', () => {
|
||||
[nodeName1]: {
|
||||
// runIndex
|
||||
0: {
|
||||
[NodeConnectionType.AiChain]: [sourceData],
|
||||
[NodeConnectionTypes.AiChain]: [sourceData],
|
||||
},
|
||||
1: {
|
||||
[NodeConnectionType.Main]: [sourceData, sourceData],
|
||||
[NodeConnectionType.AiMemory]: [sourceData],
|
||||
[NodeConnectionTypes.Main]: [sourceData, sourceData],
|
||||
[NodeConnectionTypes.AiMemory]: [sourceData],
|
||||
},
|
||||
},
|
||||
[nodeName2]: {
|
||||
// runIndex
|
||||
0: {
|
||||
[NodeConnectionType.Main]: [undefined, undefined, sourceData],
|
||||
[NodeConnectionTypes.Main]: [undefined, undefined, sourceData],
|
||||
},
|
||||
},
|
||||
});
|
||||
@@ -789,7 +789,7 @@ describe('addWaitingExecutionSource', () => {
|
||||
waitingExecutionSource,
|
||||
nodeName2,
|
||||
0, // runIndex
|
||||
NodeConnectionType.Main,
|
||||
NodeConnectionTypes.Main,
|
||||
0, // inputIndex
|
||||
null,
|
||||
);
|
||||
@@ -797,17 +797,17 @@ describe('addWaitingExecutionSource', () => {
|
||||
[nodeName1]: {
|
||||
// runIndex
|
||||
0: {
|
||||
[NodeConnectionType.AiChain]: [sourceData],
|
||||
[NodeConnectionTypes.AiChain]: [sourceData],
|
||||
},
|
||||
1: {
|
||||
[NodeConnectionType.Main]: [sourceData, sourceData],
|
||||
[NodeConnectionType.AiMemory]: [sourceData],
|
||||
[NodeConnectionTypes.Main]: [sourceData, sourceData],
|
||||
[NodeConnectionTypes.AiMemory]: [sourceData],
|
||||
},
|
||||
},
|
||||
[nodeName2]: {
|
||||
// runIndex
|
||||
0: {
|
||||
[NodeConnectionType.Main]: [null, undefined, sourceData],
|
||||
[NodeConnectionTypes.Main]: [null, undefined, sourceData],
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
import { NodeConnectionType } from 'n8n-workflow';
|
||||
import { NodeConnectionTypes } from 'n8n-workflow';
|
||||
|
||||
import { createNodeData, toIConnections } from './helpers';
|
||||
|
||||
@@ -7,7 +7,7 @@ test('toIConnections', () => {
|
||||
const node2 = createNodeData({ name: 'Basic Node 2' });
|
||||
|
||||
expect(
|
||||
toIConnections([{ from: node1, to: node2, type: NodeConnectionType.Main, outputIndex: 0 }]),
|
||||
toIConnections([{ from: node1, to: node2, type: NodeConnectionTypes.Main, outputIndex: 0 }]),
|
||||
).toEqual({
|
||||
[node1.name]: {
|
||||
// output group
|
||||
@@ -17,7 +17,7 @@ test('toIConnections', () => {
|
||||
// first connection
|
||||
{
|
||||
node: node2.name,
|
||||
type: NodeConnectionType.Main,
|
||||
type: NodeConnectionTypes.Main,
|
||||
index: 0,
|
||||
},
|
||||
],
|
||||
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
import { NodeConnectionType } from 'n8n-workflow';
|
||||
import { NodeConnectionTypes } from 'n8n-workflow';
|
||||
|
||||
import { toITaskData } from './helpers';
|
||||
|
||||
@@ -25,7 +25,7 @@ test('toITaskData', function () {
|
||||
|
||||
expect(
|
||||
toITaskData([
|
||||
{ data: { value: 1 }, outputIndex: 1, nodeConnectionType: NodeConnectionType.AiAgent },
|
||||
{ data: { value: 1 }, outputIndex: 1, nodeConnectionType: NodeConnectionTypes.AiAgent },
|
||||
]),
|
||||
).toEqual({
|
||||
executionStatus: 'success',
|
||||
@@ -33,7 +33,7 @@ test('toITaskData', function () {
|
||||
source: [],
|
||||
startTime: 0,
|
||||
data: {
|
||||
[NodeConnectionType.AiAgent]: [null, [{ json: { value: 1 } }]],
|
||||
[NodeConnectionTypes.AiAgent]: [null, [{ json: { value: 1 } }]],
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { NodeConnectionType, type INode, type IRunData } from 'n8n-workflow';
|
||||
import { NodeConnectionTypes, type INode, type IRunData } from 'n8n-workflow';
|
||||
|
||||
import type { DirectedGraph } from './directed-graph';
|
||||
|
||||
@@ -28,7 +28,7 @@ export function cleanRunData(
|
||||
for (const subNodeConnection of subNodeConnections) {
|
||||
// Sub nodes never use the Main connection type, so this filters out
|
||||
// the connection that goes upstream of the node to clean.
|
||||
if (subNodeConnection.type === NodeConnectionType.Main) {
|
||||
if (subNodeConnection.type === NodeConnectionTypes.Main) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as a from 'assert';
|
||||
import type { IConnections, INode, WorkflowParameters } from 'n8n-workflow';
|
||||
import { NodeConnectionType, Workflow } from 'n8n-workflow';
|
||||
import type { IConnections, INode, WorkflowParameters, NodeConnectionType } from 'n8n-workflow';
|
||||
import { NodeConnectionTypes, Workflow } from 'n8n-workflow';
|
||||
|
||||
export type GraphConnection = {
|
||||
from: INode;
|
||||
@@ -186,7 +186,7 @@ export class DirectedGraph {
|
||||
|
||||
const connection: GraphConnection = {
|
||||
...connectionInput,
|
||||
type: connectionInput.type ?? NodeConnectionType.Main,
|
||||
type: connectionInput.type ?? NodeConnectionTypes.Main,
|
||||
outputIndex: connectionInput.outputIndex ?? 0,
|
||||
inputIndex: connectionInput.inputIndex ?? 0,
|
||||
};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { NodeConnectionType } from 'n8n-workflow';
|
||||
import { NodeConnectionTypes } from 'n8n-workflow';
|
||||
|
||||
import type { DirectedGraph } from './directed-graph';
|
||||
|
||||
@@ -9,7 +9,7 @@ export function filterDisabledNodes(graph: DirectedGraph): DirectedGraph {
|
||||
if (node.disabled) {
|
||||
filteredGraph.removeNode(node, {
|
||||
reconnectConnections: true,
|
||||
skipConnectionFn: (c) => c.type !== NodeConnectionType.Main,
|
||||
skipConnectionFn: (c) => c.type !== NodeConnectionTypes.Main,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { NodeConnectionType, type INode, type IPinData, type IRunData } from 'n8n-workflow';
|
||||
import { NodeConnectionTypes, type INode, type IPinData, type IRunData } from 'n8n-workflow';
|
||||
|
||||
import type { DirectedGraph } from './directed-graph';
|
||||
import { getIncomingData, getIncomingDataFromAnyRun } from './get-incoming-data';
|
||||
@@ -82,7 +82,7 @@ function findStartNodesRecursive(
|
||||
current.name,
|
||||
// last run
|
||||
-1,
|
||||
NodeConnectionType.Main,
|
||||
NodeConnectionTypes.Main,
|
||||
0,
|
||||
);
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { NodeConnectionType, type INode } from 'n8n-workflow';
|
||||
import { NodeConnectionTypes, type INode } from 'n8n-workflow';
|
||||
|
||||
import type { GraphConnection } from './directed-graph';
|
||||
import { DirectedGraph } from './directed-graph';
|
||||
@@ -57,7 +57,7 @@ function findSubgraphRecursive(
|
||||
// Skip parents that are connected via non-Main connection types. They are
|
||||
// only utility nodes for AI and are not part of the data or control flow
|
||||
// and can never lead too the trigger.
|
||||
if (parentConnection.type !== NodeConnectionType.Main) {
|
||||
if (parentConnection.type !== NodeConnectionTypes.Main) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ export function findSubgraph(options: {
|
||||
const parentConnections = graph.getParentConnections(node);
|
||||
|
||||
for (const connection of parentConnections) {
|
||||
if (connection.type === NodeConnectionType.Main) {
|
||||
if (connection.type === NodeConnectionTypes.Main) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
+3
-2
@@ -1,6 +1,7 @@
|
||||
import * as a from 'assert/strict';
|
||||
import {
|
||||
NodeConnectionType,
|
||||
NodeConnectionTypes,
|
||||
type NodeConnectionType,
|
||||
type IExecuteData,
|
||||
type INode,
|
||||
type INodeExecutionData,
|
||||
@@ -99,7 +100,7 @@ export function recreateNodeExecutionStack(
|
||||
for (const startNode of startNodes) {
|
||||
const incomingStartNodeConnections = graph
|
||||
.getDirectParentConnections(startNode)
|
||||
.filter((c) => c.type === NodeConnectionType.Main);
|
||||
.filter((c) => c.type === NodeConnectionTypes.Main);
|
||||
|
||||
let incomingData: INodeExecutionData[][] = [];
|
||||
let incomingSourceData: ITaskDataConnectionsSource | null = null;
|
||||
|
||||
Reference in New Issue
Block a user