0
# Constants and Enums
1
2
Essential constants and enumeration values used throughout the n8n workflow system for node types, execution modes, and configuration.
3
4
## Capabilities
5
6
### Node Type Constants
7
8
Standard node type identifiers for common n8n nodes and triggers.
9
10
```typescript { .api }
11
// Core node types
12
const MANUAL_TRIGGER_NODE_TYPE = 'n8n-nodes-base.manualTrigger';
13
const START_NODE_TYPE = 'n8n-nodes-base.start';
14
const ERROR_TRIGGER_NODE_TYPE = 'n8n-nodes-base.errorTrigger';
15
const EXECUTE_WORKFLOW_NODE_TYPE = 'n8n-nodes-base.executeWorkflow';
16
const EXECUTE_WORKFLOW_TRIGGER_NODE_TYPE = 'n8n-nodes-base.executeWorkflowTrigger';
17
const WEBHOOK_NODE_TYPE = 'n8n-nodes-base.webhook';
18
const HTTP_REQUEST_NODE_TYPE = 'n8n-nodes-base.httpRequest';
19
const CODE_NODE_TYPE = 'n8n-nodes-base.code';
20
const FUNCTION_NODE_TYPE = 'n8n-nodes-base.function';
21
const FUNCTION_ITEM_NODE_TYPE = 'n8n-nodes-base.functionItem';
22
const AI_TRANSFORM_NODE_TYPE = 'n8n-nodes-base.aiTransform';
23
const MERGE_NODE_TYPE = 'n8n-nodes-base.merge';
24
const WAIT_NODE_TYPE = 'n8n-nodes-base.wait';
25
const FORM_NODE_TYPE = 'n8n-nodes-base.form';
26
const FORM_TRIGGER_NODE_TYPE = 'n8n-nodes-base.formTrigger';
27
const RESPOND_TO_WEBHOOK_NODE_TYPE = 'n8n-nodes-base.respondToWebhook';
28
const STICKY_NODE_TYPE = 'n8n-nodes-base.stickyNote';
29
const NO_OP_NODE_TYPE = 'n8n-nodes-base.noOp';
30
const HTML_NODE_TYPE = 'n8n-nodes-base.html';
31
const EVALUATION_TRIGGER_NODE_TYPE = 'n8n-nodes-base.evaluationTrigger';
32
const EVALUATION_NODE_TYPE = 'n8n-nodes-base.evaluation';
33
34
// Database node types
35
const POSTGRES_NODE_TYPE = 'n8n-nodes-base.postgres';
36
const MYSQL_NODE_TYPE = 'n8n-nodes-base.mySql';
37
38
// Service node types
39
const MAILGUN_NODE_TYPE = 'n8n-nodes-base.mailgun';
40
41
// LangChain node types
42
const CHAT_TRIGGER_NODE_TYPE = '@n8n/n8n-nodes-langchain.chatTrigger';
43
const MANUAL_CHAT_TRIGGER_LANGCHAIN_NODE_TYPE = '@n8n/n8n-nodes-langchain.manualChatTrigger';
44
const AGENT_LANGCHAIN_NODE_TYPE = '@n8n/n8n-nodes-langchain.agent';
45
const CHAIN_LLM_LANGCHAIN_NODE_TYPE = '@n8n/n8n-nodes-langchain.chainLlm';
46
const OPENAI_LANGCHAIN_NODE_TYPE = '@n8n/n8n-nodes-langchain.openAi';
47
const CHAIN_SUMMARIZATION_LANGCHAIN_NODE_TYPE = '@n8n/n8n-nodes-langchain.chainSummarization';
48
const AGENT_TOOL_LANGCHAIN_NODE_TYPE = '@n8n/n8n-nodes-langchain.agentTool';
49
const CODE_TOOL_LANGCHAIN_NODE_TYPE = '@n8n/n8n-nodes-langchain.toolCode';
50
const WORKFLOW_TOOL_LANGCHAIN_NODE_TYPE = '@n8n/n8n-nodes-langchain.toolWorkflow';
51
const HTTP_REQUEST_TOOL_LANGCHAIN_NODE_TYPE = '@n8n/n8n-nodes-langchain.toolHttpRequest';
52
```
53
54
### Node Type Collections
55
56
Predefined collections of node types for specific categories and use cases.
57
58
```typescript { .api }
59
// Starting node types that can begin workflow execution
60
const STARTING_NODE_TYPES: string[] = [
61
'n8n-nodes-base.manualTrigger',
62
'n8n-nodes-base.executeWorkflowTrigger',
63
'n8n-nodes-base.errorTrigger',
64
'n8n-nodes-base.start',
65
'n8n-nodes-base.evaluationTrigger'
66
];
67
68
// Node types that support scripting/code execution
69
const SCRIPTING_NODE_TYPES: string[] = [
70
'n8n-nodes-base.function',
71
'n8n-nodes-base.functionItem',
72
'n8n-nodes-base.code',
73
'n8n-nodes-base.aiTransform'
74
];
75
76
// LangChain custom tool node types
77
const LANGCHAIN_CUSTOM_TOOLS: string[] = [
78
'@n8n/n8n-nodes-langchain.toolCode',
79
'@n8n/n8n-nodes-langchain.toolWorkflow',
80
'@n8n/n8n-nodes-langchain.toolHttpRequest'
81
];
82
83
// Nodes with renamable content when referenced nodes are renamed
84
const NODES_WITH_RENAMABLE_CONTENT: Set<string>;
85
const NODES_WITH_RENAMABLE_FORM_HTML_CONTENT: Set<string>;
86
const NODES_WITH_RENAMEABLE_TOPLEVEL_HTML_CONTENT: Set<string>;
87
```
88
89
### Execution and Configuration Constants
90
91
Core constants for workflow execution modes, logging, and system configuration.
92
93
```typescript { .api }
94
// Log levels for system logging
95
const LOG_LEVELS: readonly ['silent', 'error', 'warn', 'info', 'debug'];
96
97
// Supported code execution languages
98
const CODE_LANGUAGES: readonly ['javaScript', 'python'];
99
100
// Code execution modes for script nodes
101
const CODE_EXECUTION_MODES: readonly ['runOnceForAllItems', 'runOnceForEachItem'];
102
103
// Binary data encoding format
104
const BINARY_ENCODING = 'base64';
105
106
// Wait indefinitely date constant
107
const WAIT_INDEFINITELY: Date;
108
109
// Character sets for string generation
110
const DIGITS = '0123456789';
111
const UPPERCASE_LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
112
const LOWERCASE_LETTERS = 'abcdefghijklmnopqrstuvwxyz';
113
const ALPHABET: string; // Combined digits and letters
114
115
// System constants
116
const CREDENTIAL_EMPTY_VALUE: string; // Placeholder for empty credential values
117
const FORM_TRIGGER_PATH_IDENTIFIER = 'n8n-form';
118
const PROJECT_ROOT = '0';
119
```
120
121
### Error and Status Constants
122
123
Constants for error handling, status reporting, and system messaging.
124
125
```typescript { .api }
126
// Error messages
127
const UNKNOWN_ERROR_MESSAGE = 'There was an unknown issue while executing the node';
128
const UNKNOWN_ERROR_DESCRIPTION: string; // Detailed error description with documentation link
129
const UNKNOWN_ERROR_MESSAGE_CRED = 'UNKNOWN ERROR';
130
131
// Operation constants
132
const SEND_AND_WAIT_OPERATION = 'sendAndWait';
133
const AI_TRANSFORM_CODE_GENERATED_FOR_PROMPT = 'codeGeneratedForPrompt';
134
const AI_TRANSFORM_JS_CODE = 'jsCode';
135
const ADD_FORM_NOTICE = 'addFormPage';
136
137
// System markers and keys
138
const TRIMMED_TASK_DATA_CONNECTIONS_KEY = '__isTrimmedManualExecutionDataItem';
139
const FROM_AI_AUTO_GENERATED_MARKER = '/*n8n-auto-generated-fromAI-override*/';
140
const WAITING_FORMS_EXECUTION_STATUS = 'n8n-execution-status';
141
const CHAT_WAIT_USER_REPLY = 'waitUserReply';
142
143
// AI and credential constants
144
const OPEN_AI_API_CREDENTIAL_TYPE = 'openAiApi';
145
const FREE_AI_CREDITS_ERROR_TYPE = 'free_ai_credits_request_error';
146
const FREE_AI_CREDITS_USED_ALL_CREDITS_ERROR_CODE = 400;
147
```
148
149
## Types
150
151
```typescript { .api }
152
type LogLevel = typeof LOG_LEVELS[number];
153
type CodeLanguage = typeof CODE_LANGUAGES[number];
154
type CodeExecutionMode = typeof CODE_EXECUTION_MODES[number];
155
```