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

@@ -4,7 +4,7 @@ import { makeResolverFromLegacyOptions } from '@n8n/vm2';
import { JavaScriptSandbox } from 'n8n-nodes-base/dist/nodes/Code/JavaScriptSandbox';
import { getSandboxContext } from 'n8n-nodes-base/dist/nodes/Code/Sandbox';
import { standardizeOutput } from 'n8n-nodes-base/dist/nodes/Code/utils';
import { NodeOperationError, NodeConnectionType } from 'n8n-workflow';
import { NodeOperationError, NodeConnectionTypes } from 'n8n-workflow';
import type {
IExecuteFunctions,
INodeExecutionData,
@@ -24,16 +24,16 @@ const { NODE_FUNCTION_ALLOW_BUILTIN: builtIn, NODE_FUNCTION_ALLOW_EXTERNAL: exte
// TODO: Replace
const connectorTypes = {
[NodeConnectionType.AiChain]: 'Chain',
[NodeConnectionType.AiDocument]: 'Document',
[NodeConnectionType.AiEmbedding]: 'Embedding',
[NodeConnectionType.AiLanguageModel]: 'Language Model',
[NodeConnectionType.AiMemory]: 'Memory',
[NodeConnectionType.AiOutputParser]: 'Output Parser',
[NodeConnectionType.AiTextSplitter]: 'Text Splitter',
[NodeConnectionType.AiTool]: 'Tool',
[NodeConnectionType.AiVectorStore]: 'Vector Store',
[NodeConnectionType.Main]: 'Main',
[NodeConnectionTypes.AiChain]: 'Chain',
[NodeConnectionTypes.AiDocument]: 'Document',
[NodeConnectionTypes.AiEmbedding]: 'Embedding',
[NodeConnectionTypes.AiLanguageModel]: 'Language Model',
[NodeConnectionTypes.AiMemory]: 'Memory',
[NodeConnectionTypes.AiOutputParser]: 'Output Parser',
[NodeConnectionTypes.AiTextSplitter]: 'Text Splitter',
[NodeConnectionTypes.AiTool]: 'Tool',
[NodeConnectionTypes.AiVectorStore]: 'Vector Store',
[NodeConnectionTypes.Main]: 'Main',
};
const defaultCodeExecute = `const { PromptTemplate } = require('@langchain/core/prompts');
@@ -304,7 +304,7 @@ export class Code implements INodeType {
const outputs = this.getNodeOutputs();
const mainOutputs: INodeOutputConfiguration[] = outputs.filter(
(output) => output.type === NodeConnectionType.Main,
(output) => output.type === NodeConnectionTypes.Main,
);
const options = { multiOutput: mainOutputs.length !== 1 };