refactor: Migrate NodeConnectionType to const object type (no-changelog) (#14078)

Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
This commit is contained in:
Alex Grozav
2025-03-21 14:01:26 +02:00
committed by GitHub
parent 7e8179b848
commit 8215e0b59f
703 changed files with 3104 additions and 3018 deletions

View File

@@ -1,5 +1,6 @@
import {
NodeConnectionType,
NodeConnectionTypes,
type NodeConnectionType,
type INodeIssues,
type INode,
type INodeParameters,
@@ -3549,9 +3550,9 @@ describe('NodeHelpers', () => {
[false, null],
[false, { outputs: '={{random_expression}}' }],
[false, { outputs: [] }],
[false, { outputs: [NodeConnectionType.Main] }],
[true, { outputs: [NodeConnectionType.AiAgent] }],
[true, { outputs: [NodeConnectionType.Main, NodeConnectionType.AiAgent] }],
[false, { outputs: [NodeConnectionTypes.Main] }],
[true, { outputs: [NodeConnectionTypes.AiAgent] }],
[true, { outputs: [NodeConnectionTypes.Main, NodeConnectionTypes.AiAgent] }],
];
test.each(tests)('should return %p for %o', (expected, nodeType) => {
expect(isSubNodeType(nodeType)).toBe(expected);
@@ -4267,7 +4268,7 @@ describe('NodeHelpers', () => {
version: 1,
defaults: {},
inputs: [],
outputs: [NodeConnectionType.Main],
outputs: [NodeConnectionTypes.Main],
properties: [],
},
expected: true,
@@ -4282,7 +4283,7 @@ describe('NodeHelpers', () => {
version: 1,
defaults: {},
inputs: [],
outputs: [NodeConnectionType.Main],
outputs: [NodeConnectionTypes.Main],
properties: [],
},
expected: true,
@@ -4296,8 +4297,8 @@ describe('NodeHelpers', () => {
description: 'Regular node description',
version: 1,
defaults: {},
inputs: [NodeConnectionType.Main],
outputs: [NodeConnectionType.Main],
inputs: [NodeConnectionTypes.Main],
outputs: [NodeConnectionTypes.Main],
properties: [],
},
expected: false,
@@ -4311,8 +4312,8 @@ describe('NodeHelpers', () => {
description: 'Empty group node description',
version: 1,
defaults: {},
inputs: [NodeConnectionType.Main],
outputs: [NodeConnectionType.Main],
inputs: [NodeConnectionTypes.Main],
outputs: [NodeConnectionTypes.Main],
properties: [],
},
expected: false,
@@ -4327,8 +4328,8 @@ describe('NodeHelpers', () => {
description: 'Almost trigger node description',
version: 1,
defaults: {},
inputs: [NodeConnectionType.Main],
outputs: [NodeConnectionType.Main],
inputs: [NodeConnectionTypes.Main],
outputs: [NodeConnectionTypes.Main],
properties: [],
},
expected: false,
@@ -4346,7 +4347,7 @@ describe('NodeHelpers', () => {
describe('isExecutable', () => {
const workflowMock = {
expression: {
getSimpleParameterValue: jest.fn().mockReturnValue([NodeConnectionType.Main]),
getSimpleParameterValue: jest.fn().mockReturnValue([NodeConnectionTypes.Main]),
},
} as unknown as Workflow;
@@ -4375,7 +4376,7 @@ describe('NodeHelpers', () => {
version: 1,
defaults: {},
inputs: [],
outputs: [NodeConnectionType.Main],
outputs: [NodeConnectionTypes.Main],
properties: [],
},
expected: true,
@@ -4397,8 +4398,8 @@ describe('NodeHelpers', () => {
description: 'Node with Main output',
version: 1,
defaults: {},
inputs: [NodeConnectionType.Main],
outputs: [NodeConnectionType.Main],
inputs: [NodeConnectionTypes.Main],
outputs: [NodeConnectionTypes.Main],
properties: [],
},
expected: true,
@@ -4420,8 +4421,8 @@ describe('NodeHelpers', () => {
description: 'Node without Main output and not a trigger',
version: 1,
defaults: {},
inputs: [NodeConnectionType.Main],
outputs: [NodeConnectionType.AiAgent],
inputs: [NodeConnectionTypes.Main],
outputs: [NodeConnectionTypes.AiAgent],
properties: [],
},
expected: false,
@@ -4443,8 +4444,8 @@ describe('NodeHelpers', () => {
description: 'Node with multiple output types including Main',
version: 1,
defaults: {},
inputs: [NodeConnectionType.Main],
outputs: [NodeConnectionType.Main, NodeConnectionType.AiAgent],
inputs: [NodeConnectionTypes.Main],
outputs: [NodeConnectionTypes.Main, NodeConnectionTypes.AiAgent],
properties: [],
},
expected: true,
@@ -4467,7 +4468,7 @@ describe('NodeHelpers', () => {
version: 1,
defaults: {},
inputs: [],
outputs: [NodeConnectionType.AiTool], // Only AiTool output, no Main
outputs: [NodeConnectionTypes.AiTool], // Only AiTool output, no Main
properties: [],
},
expected: false,
@@ -4489,12 +4490,12 @@ describe('NodeHelpers', () => {
description: 'Node with dynamic outputs that resolve to only AiTool',
version: 1,
defaults: {},
inputs: [NodeConnectionType.Main],
inputs: [NodeConnectionTypes.Main],
outputs: '={{["ai_tool"]}}', // Dynamic expression that resolves to AiTool only
properties: [],
},
expected: false,
mockReturnValue: [NodeConnectionType.AiTool],
mockReturnValue: [NodeConnectionTypes.AiTool],
},
];

View File

@@ -1,7 +1,7 @@
import { mock } from 'jest-mock-extended';
import {
NodeConnectionType,
NodeConnectionTypes,
type IDataObject,
type INodeType,
type INodeTypeData,
@@ -62,8 +62,8 @@ const googleSheetsNode: LoadedClass<IVersionedNodeType> = {
defaults: {
name: 'Google Sheets',
},
inputs: [NodeConnectionType.Main],
outputs: [NodeConnectionType.Main],
inputs: [NodeConnectionTypes.Main],
outputs: [NodeConnectionTypes.Main],
credentials: [
{
name: 'googleApi',
@@ -288,9 +288,9 @@ const googleSheetsNode: LoadedClass<IVersionedNodeType> = {
displayName: 'Google Sheets',
group: ['input', 'output'],
icon: 'file:googleSheets.svg',
inputs: [NodeConnectionType.Main],
inputs: [NodeConnectionTypes.Main],
name: 'googleSheets',
outputs: [NodeConnectionType.Main],
outputs: [NodeConnectionTypes.Main],
properties: [
{
default: 'oAuth2',
@@ -553,8 +553,8 @@ const setNode: LoadedClass<INodeType> = {
name: 'Set',
color: '#0000FF',
},
inputs: [NodeConnectionType.Main],
outputs: [NodeConnectionType.Main],
inputs: [NodeConnectionTypes.Main],
outputs: [NodeConnectionTypes.Main],
properties: [
{
displayName: 'Value1',
@@ -590,7 +590,7 @@ const manualTriggerNode: LoadedClass<INodeType> = {
color: '#909298',
},
inputs: [],
outputs: [NodeConnectionType.Main],
outputs: [NodeConnectionTypes.Main],
properties: [
{
displayName:
@@ -848,8 +848,8 @@ export class NodeTypes implements INodeTypes {
name: 'Set Multi',
color: '#0000FF',
},
inputs: [NodeConnectionType.Main],
outputs: [NodeConnectionType.Main],
inputs: [NodeConnectionTypes.Main],
outputs: [NodeConnectionTypes.Main],
properties: [
{
displayName: 'Values',

View File

@@ -4,7 +4,7 @@ import { v5 as uuidv5, v3 as uuidv3, v4 as uuidv4, v1 as uuidv1 } from 'uuid';
import { STICKY_NODE_TYPE } from '@/Constants';
import { ApplicationError, ExpressionError, NodeApiError } from '@/errors';
import type { INode, INodeTypeDescription, IRun, IRunData } from '@/Interfaces';
import { NodeConnectionType, type IWorkflowBase } from '@/Interfaces';
import { type NodeConnectionType, NodeConnectionTypes, type IWorkflowBase } from '@/Interfaces';
import * as nodeHelpers from '@/NodeHelpers';
import {
ANONYMIZATION_CHARACTER as CHAR,
@@ -117,7 +117,7 @@ describe('generateNodesGraph', () => {
],
connections: {
'When clicking "Execute Workflow"': {
main: [[{ node: 'Google Sheets', type: NodeConnectionType.Main, index: 0 }]],
main: [[{ node: 'Google Sheets', type: NodeConnectionTypes.Main, index: 0 }]],
},
},
settings: { executionOrder: 'v1' },
@@ -221,7 +221,7 @@ describe('generateNodesGraph', () => {
],
connections: {
'When clicking "Execute Workflow"': {
main: [[{ node: 'Google Sheets', type: NodeConnectionType.Main, index: 0 }]],
main: [[{ node: 'Google Sheets', type: NodeConnectionTypes.Main, index: 0 }]],
},
},
settings: { executionOrder: 'v1' },
@@ -297,7 +297,7 @@ describe('generateNodesGraph', () => {
],
connections: {
'When clicking "Execute Workflow"': {
main: [[{ node: 'Google Sheets', type: NodeConnectionType.Main, index: 0 }]],
main: [[{ node: 'Google Sheets', type: NodeConnectionTypes.Main, index: 0 }]],
},
},
settings: { executionOrder: 'v1' },
@@ -375,7 +375,7 @@ describe('generateNodesGraph', () => {
],
connections: {
'When clicking "Execute Workflow"': {
main: [[{ node: 'Google Sheets', type: NodeConnectionType.Main, index: 0 }]],
main: [[{ node: 'Google Sheets', type: NodeConnectionTypes.Main, index: 0 }]],
},
},
settings: { executionOrder: 'v1' },
@@ -829,7 +829,7 @@ describe('generateNodesGraph', () => {
[
{
node: 'Chain',
type: NodeConnectionType.Main,
type: NodeConnectionTypes.Main,
index: 0,
},
],
@@ -840,7 +840,7 @@ describe('generateNodesGraph', () => {
[
{
node: 'Chain',
type: NodeConnectionType.AiLanguageModel,
type: NodeConnectionTypes.AiLanguageModel,
index: 0,
},
],

View File

@@ -1,6 +1,6 @@
import { mock } from 'jest-mock-extended';
import { NodeConnectionType } from '@/Interfaces';
import { NodeConnectionTypes } from '@/Interfaces';
import type { IConnection } from '@/Interfaces';
import type {
IBinaryKeyData,
@@ -64,7 +64,7 @@ describe('Workflow', () => {
[
{
node: 'Set',
type: NodeConnectionType.Main,
type: NodeConnectionTypes.Main,
index: 0,
},
],
@@ -75,7 +75,7 @@ describe('Workflow', () => {
[
{
node: 'Set1',
type: NodeConnectionType.Main,
type: NodeConnectionTypes.Main,
index: 0,
},
],
@@ -134,21 +134,21 @@ describe('Workflow', () => {
[
{
node: 'Set1',
type: NodeConnectionType.Main,
type: NodeConnectionTypes.Main,
index: 0,
},
],
[
{
node: 'Set',
type: NodeConnectionType.Main,
type: NodeConnectionTypes.Main,
index: 0,
},
],
[
{
node: 'Set',
type: NodeConnectionType.Main,
type: NodeConnectionTypes.Main,
index: 0,
},
],
@@ -159,7 +159,7 @@ describe('Workflow', () => {
[
{
node: 'Set2',
type: NodeConnectionType.Main,
type: NodeConnectionTypes.Main,
index: 0,
},
],
@@ -170,7 +170,7 @@ describe('Workflow', () => {
[
{
node: 'Set2',
type: NodeConnectionType.Main,
type: NodeConnectionTypes.Main,
index: 0,
},
],
@@ -234,7 +234,7 @@ describe('Workflow', () => {
[
{
node: 'Set',
type: NodeConnectionType.Main,
type: NodeConnectionTypes.Main,
index: 0,
},
],
@@ -242,7 +242,7 @@ describe('Workflow', () => {
[
{
node: 'Switch',
type: NodeConnectionType.Main,
type: NodeConnectionTypes.Main,
index: 0,
},
],
@@ -253,7 +253,7 @@ describe('Workflow', () => {
[
{
node: 'Set1',
type: NodeConnectionType.Main,
type: NodeConnectionTypes.Main,
index: 0,
},
],
@@ -264,12 +264,12 @@ describe('Workflow', () => {
[
{
node: 'Set1',
type: NodeConnectionType.Main,
type: NodeConnectionTypes.Main,
index: 0,
},
{
node: 'Switch',
type: NodeConnectionType.Main,
type: NodeConnectionTypes.Main,
index: 0,
},
],
@@ -280,7 +280,7 @@ describe('Workflow', () => {
[
{
node: 'Set1',
type: NodeConnectionType.Main,
type: NodeConnectionTypes.Main,
index: 0,
},
],
@@ -323,7 +323,7 @@ describe('Workflow', () => {
[
{
node: 'AINode',
type: NodeConnectionType.AiAgent,
type: NodeConnectionTypes.AiAgent,
index: 0,
},
],
@@ -334,7 +334,7 @@ describe('Workflow', () => {
[
{
node: 'Set1',
type: NodeConnectionType.Main,
type: NodeConnectionTypes.Main,
index: 0,
},
],
@@ -707,7 +707,7 @@ describe('Workflow', () => {
[
{
node: 'Node2',
type: NodeConnectionType.Main,
type: NodeConnectionTypes.Main,
index: 0,
},
],
@@ -738,7 +738,7 @@ describe('Workflow', () => {
[
{
node: 'Node2',
type: NodeConnectionType.Main,
type: NodeConnectionTypes.Main,
index: 0,
},
],
@@ -774,7 +774,7 @@ describe('Workflow', () => {
[
{
node: 'Node2',
type: NodeConnectionType.Main,
type: NodeConnectionTypes.Main,
index: 0,
},
],
@@ -805,7 +805,7 @@ describe('Workflow', () => {
[
{
node: 'Node2New',
type: NodeConnectionType.Main,
type: NodeConnectionTypes.Main,
index: 0,
},
],
@@ -862,7 +862,7 @@ describe('Workflow', () => {
[
{
node: 'Node3',
type: NodeConnectionType.Main,
type: NodeConnectionTypes.Main,
index: 0,
},
],
@@ -873,12 +873,12 @@ describe('Workflow', () => {
[
{
node: 'Node3',
type: NodeConnectionType.Main,
type: NodeConnectionTypes.Main,
index: 0,
},
{
node: 'Node5',
type: NodeConnectionType.Main,
type: NodeConnectionTypes.Main,
index: 0,
},
],
@@ -889,12 +889,12 @@ describe('Workflow', () => {
[
{
node: 'Node4',
type: NodeConnectionType.Main,
type: NodeConnectionTypes.Main,
index: 0,
},
{
node: 'Node5',
type: NodeConnectionType.Main,
type: NodeConnectionTypes.Main,
index: 0,
},
],
@@ -946,7 +946,7 @@ describe('Workflow', () => {
[
{
node: 'Node3New',
type: NodeConnectionType.Main,
type: NodeConnectionTypes.Main,
index: 0,
},
],
@@ -957,12 +957,12 @@ describe('Workflow', () => {
[
{
node: 'Node3New',
type: NodeConnectionType.Main,
type: NodeConnectionTypes.Main,
index: 0,
},
{
node: 'Node5',
type: NodeConnectionType.Main,
type: NodeConnectionTypes.Main,
index: 0,
},
],
@@ -973,12 +973,12 @@ describe('Workflow', () => {
[
{
node: 'Node4',
type: NodeConnectionType.Main,
type: NodeConnectionTypes.Main,
index: 0,
},
{
node: 'Node5',
type: NodeConnectionType.Main,
type: NodeConnectionTypes.Main,
index: 0,
},
],
@@ -1558,7 +1558,7 @@ describe('Workflow', () => {
[
{
node: 'Node2',
type: NodeConnectionType.Main,
type: NodeConnectionTypes.Main,
index: 0,
},
],
@@ -1569,7 +1569,7 @@ describe('Workflow', () => {
[
{
node: 'Node3',
type: NodeConnectionType.Main,
type: NodeConnectionTypes.Main,
index: 0,
},
],
@@ -1580,7 +1580,7 @@ describe('Workflow', () => {
[
{
node: 'Node2',
type: NodeConnectionType.Main,
type: NodeConnectionTypes.Main,
index: 0,
},
],
@@ -1884,10 +1884,10 @@ describe('Workflow', () => {
it('should return connections by destination node', () => {
const connections: IConnections = {
Node1: {
[NodeConnectionType.Main]: [
[NodeConnectionTypes.Main]: [
[
{ node: 'Node2', type: NodeConnectionType.Main, index: 0 },
{ node: 'Node3', type: NodeConnectionType.Main, index: 1 },
{ node: 'Node2', type: NodeConnectionTypes.Main, index: 0 },
{ node: 'Node3', type: NodeConnectionTypes.Main, index: 1 },
],
],
},
@@ -1895,12 +1895,14 @@ describe('Workflow', () => {
const result = Workflow.getConnectionsByDestination(connections);
expect(result).toEqual({
Node2: {
[NodeConnectionType.Main]: [[{ node: 'Node1', type: NodeConnectionType.Main, index: 0 }]],
[NodeConnectionTypes.Main]: [
[{ node: 'Node1', type: NodeConnectionTypes.Main, index: 0 }],
],
},
Node3: {
[NodeConnectionType.Main]: [
[NodeConnectionTypes.Main]: [
[],
[{ node: 'Node1', type: NodeConnectionType.Main, index: 0 }],
[{ node: 'Node1', type: NodeConnectionTypes.Main, index: 0 }],
],
},
});
@@ -1909,9 +1911,11 @@ describe('Workflow', () => {
it('should handle multiple connection types', () => {
const connections: IConnections = {
Node1: {
[NodeConnectionType.Main]: [[{ node: 'Node2', type: NodeConnectionType.Main, index: 0 }]],
[NodeConnectionType.AiAgent]: [
[{ node: 'Node3', type: NodeConnectionType.AiAgent, index: 0 }],
[NodeConnectionTypes.Main]: [
[{ node: 'Node2', type: NodeConnectionTypes.Main, index: 0 }],
],
[NodeConnectionTypes.AiAgent]: [
[{ node: 'Node3', type: NodeConnectionTypes.AiAgent, index: 0 }],
],
},
};
@@ -1919,11 +1923,13 @@ describe('Workflow', () => {
const result = Workflow.getConnectionsByDestination(connections);
expect(result).toEqual({
Node2: {
[NodeConnectionType.Main]: [[{ node: 'Node1', type: NodeConnectionType.Main, index: 0 }]],
[NodeConnectionTypes.Main]: [
[{ node: 'Node1', type: NodeConnectionTypes.Main, index: 0 }],
],
},
Node3: {
[NodeConnectionType.AiAgent]: [
[{ node: 'Node1', type: NodeConnectionType.AiAgent, index: 0 }],
[NodeConnectionTypes.AiAgent]: [
[{ node: 'Node1', type: NodeConnectionTypes.AiAgent, index: 0 }],
],
},
});
@@ -1932,7 +1938,7 @@ describe('Workflow', () => {
it('should handle nodes with no connections', () => {
const connections: IConnections = {
Node1: {
[NodeConnectionType.Main]: [[]],
[NodeConnectionTypes.Main]: [[]],
},
};
@@ -1944,9 +1950,9 @@ describe('Workflow', () => {
it('should handle nodes with null connections', () => {
const connections: IConnections = {
Node1: {
[NodeConnectionType.Main]: [
[NodeConnectionTypes.Main]: [
null as unknown as IConnection[],
[{ node: 'Node2', type: NodeConnectionType.Main, index: 0 }],
[{ node: 'Node2', type: NodeConnectionTypes.Main, index: 0 }],
],
},
};
@@ -1954,7 +1960,9 @@ describe('Workflow', () => {
const result = Workflow.getConnectionsByDestination(connections);
expect(result).toEqual({
Node2: {
[NodeConnectionType.Main]: [[{ node: 'Node1', type: NodeConnectionType.Main, index: 1 }]],
[NodeConnectionTypes.Main]: [
[{ node: 'Node1', type: NodeConnectionTypes.Main, index: 1 }],
],
},
});
});
@@ -1962,20 +1970,24 @@ describe('Workflow', () => {
it('should handle nodes with multiple input connections', () => {
const connections: IConnections = {
Node1: {
[NodeConnectionType.Main]: [[{ node: 'Node2', type: NodeConnectionType.Main, index: 0 }]],
[NodeConnectionTypes.Main]: [
[{ node: 'Node2', type: NodeConnectionTypes.Main, index: 0 }],
],
},
Node3: {
[NodeConnectionType.Main]: [[{ node: 'Node2', type: NodeConnectionType.Main, index: 0 }]],
[NodeConnectionTypes.Main]: [
[{ node: 'Node2', type: NodeConnectionTypes.Main, index: 0 }],
],
},
};
const result = Workflow.getConnectionsByDestination(connections);
expect(result).toEqual({
Node2: {
[NodeConnectionType.Main]: [
[NodeConnectionTypes.Main]: [
[
{ node: 'Node1', type: NodeConnectionType.Main, index: 0 },
{ node: 'Node3', type: NodeConnectionType.Main, index: 0 },
{ node: 'Node1', type: NodeConnectionTypes.Main, index: 0 },
{ node: 'Node3', type: NodeConnectionTypes.Main, index: 0 },
],
],
},
@@ -2030,10 +2042,10 @@ describe('Workflow', () => {
const connections = {
Node1: {
main: [[{ node: 'TargetNode', type: NodeConnectionType.Main, index: 0 }]],
main: [[{ node: 'TargetNode', type: NodeConnectionTypes.Main, index: 0 }]],
},
Node2: {
main: [[{ node: 'TargetNode', type: NodeConnectionType.Main, index: 0 }]],
main: [[{ node: 'TargetNode', type: NodeConnectionTypes.Main, index: 0 }]],
},
};
@@ -2056,10 +2068,10 @@ describe('Workflow', () => {
const connections = {
Node1: {
main: [[{ node: 'TargetNode', type: NodeConnectionType.Main, index: 0 }]],
main: [[{ node: 'TargetNode', type: NodeConnectionTypes.Main, index: 0 }]],
},
Node2: {
main: [[{ node: 'TargetNode', type: NodeConnectionType.Main, index: 0 }]],
main: [[{ node: 'TargetNode', type: NodeConnectionTypes.Main, index: 0 }]],
},
};
@@ -2084,12 +2096,12 @@ describe('Workflow', () => {
const connections = {
Node3: {
main: [
[{ node: 'Node1', type: NodeConnectionType.Main, index: 0 }],
[{ node: 'Node2', type: NodeConnectionType.Main, index: 0 }],
[{ node: 'Node1', type: NodeConnectionTypes.Main, index: 0 }],
[{ node: 'Node2', type: NodeConnectionTypes.Main, index: 0 }],
],
},
TargetNode: {
main: [[{ node: 'Node3', type: NodeConnectionType.Main, index: 0 }]],
main: [[{ node: 'Node3', type: NodeConnectionTypes.Main, index: 0 }]],
},
};
@@ -2112,10 +2124,10 @@ describe('Workflow', () => {
const connections = {
Node1: {
main: [[{ node: 'TargetNode', type: NodeConnectionType.Main, index: 0 }]],
main: [[{ node: 'TargetNode', type: NodeConnectionTypes.Main, index: 0 }]],
},
Node2: {
main: [[], [{ node: 'TargetNode', type: NodeConnectionType.Main, index: 1 }]],
main: [[], [{ node: 'TargetNode', type: NodeConnectionTypes.Main, index: 1 }]],
},
};
@@ -2141,13 +2153,13 @@ describe('Workflow', () => {
const connections = {
Node1: {
main: [[{ node: 'Node2', type: NodeConnectionType.Main, index: 0 }]],
main: [[{ node: 'Node2', type: NodeConnectionTypes.Main, index: 0 }]],
},
Node2: {
main: [[{ node: 'Node1', type: NodeConnectionType.Main, index: 0 }]],
main: [[{ node: 'Node1', type: NodeConnectionTypes.Main, index: 0 }]],
},
TargetNode: {
main: [[{ node: 'Node1', type: NodeConnectionType.Main, index: 0 }]],
main: [[{ node: 'Node1', type: NodeConnectionTypes.Main, index: 0 }]],
},
};
@@ -2169,10 +2181,10 @@ describe('Workflow', () => {
const connections = {
Node1: {
main: [[{ node: 'NonExistentNode', type: NodeConnectionType.Main, index: 0 }]],
main: [[{ node: 'NonExistentNode', type: NodeConnectionTypes.Main, index: 0 }]],
},
TargetNode: {
main: [[{ node: 'NonExistentNode', type: NodeConnectionType.Main, index: 0 }]],
main: [[{ node: 'NonExistentNode', type: NodeConnectionTypes.Main, index: 0 }]],
},
};
@@ -2195,10 +2207,10 @@ describe('Workflow', () => {
const connections = {
Node1: {
main: [[{ node: 'TargetNode', type: NodeConnectionType.Main, index: 0 }]],
main: [[{ node: 'TargetNode', type: NodeConnectionTypes.Main, index: 0 }]],
},
NonExistentNode: {
main: [[{ node: 'TargetNode', type: NodeConnectionType.Main, index: 0 }]],
main: [[{ node: 'TargetNode', type: NodeConnectionTypes.Main, index: 0 }]],
},
};
@@ -2272,7 +2284,7 @@ describe('Workflow', () => {
const result = SIMPLE_WORKFLOW.getNodeConnectionIndexes(
'Set',
'Start',
NodeConnectionType.Main,
NodeConnectionTypes.Main,
0,
);
expect(result).toBeUndefined();

View File

@@ -3,7 +3,8 @@ import { DateTime, Duration, Interval } from 'luxon';
import { ensureError } from '@/errors/ensure-error';
import { ExpressionError } from '@/errors/expression.error';
import {
NodeConnectionType,
NodeConnectionTypes,
type NodeConnectionType,
type IExecuteData,
type INode,
type IPinData,
@@ -38,7 +39,7 @@ const getProxyFromFixture = (
) => {
const taskData = run?.data.resultData.runData[activeNode]?.[opts?.runIndex ?? 0];
const lastNodeConnectionInputData =
taskData?.data?.[opts?.connectionType ?? NodeConnectionType.Main]?.[0];
taskData?.data?.[opts?.connectionType ?? NodeConnectionTypes.Main]?.[0];
let executeData: IExecuteData | undefined;
@@ -47,7 +48,7 @@ const getProxyFromFixture = (
data: taskData.data!,
node: workflow.nodes.find((node) => node.name === activeNode) as INode,
source: {
[opts?.connectionType ?? NodeConnectionType.Main]: taskData.source,
[opts?.connectionType ?? NodeConnectionTypes.Main]: taskData.source,
},
};
}
@@ -519,7 +520,7 @@ describe('WorkflowDataProxy', () => {
const fixture = loadFixture('from_ai_multiple_items');
const getFromAIProxy = (runIndex = 0) =>
getProxyFromFixture(fixture.workflow, fixture.run, 'Google Sheets1', 'manual', {
connectionType: NodeConnectionType.AiTool,
connectionType: NodeConnectionTypes.AiTool,
throwOnMissingExecutionData: false,
runIndex,
});
@@ -555,7 +556,7 @@ describe('WorkflowDataProxy', () => {
describe('$rawParameter', () => {
const fixture = loadFixture('rawParameter');
const proxy = getProxyFromFixture(fixture.workflow, fixture.run, 'Execute Workflow', 'manual', {
connectionType: NodeConnectionType.Main,
connectionType: NodeConnectionTypes.Main,
throwOnMissingExecutionData: false,
runIndex: 0,
});
@@ -582,7 +583,7 @@ describe('WorkflowDataProxy', () => {
'Execute Workflow',
'manual',
{
connectionType: NodeConnectionType.Main,
connectionType: NodeConnectionTypes.Main,
throwOnMissingExecutionData: false,
runIndex: 0,
},