2024-06-04 00:18:17 -07:00
import type { NodeParameterValue } from './Interfaces' ;
2024-06-19 04:33:57 -07:00
export const DIGITS = '0123456789' ;
export const UPPERCASE_LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' ;
export const LOWERCASE_LETTERS = UPPERCASE_LETTERS . toLowerCase ( ) ;
export const ALPHABET = [ DIGITS , UPPERCASE_LETTERS , LOWERCASE_LETTERS ] . join ( '' ) ;
2023-03-09 09:13:15 -08:00
export const BINARY_ENCODING = 'base64' ;
export const WAIT_TIME_UNLIMITED = '3000-01-01T00:00:00.000Z' ;
2023-05-02 00:37:49 -07:00
2024-08-28 00:32:53 -07:00
export const LOG_LEVELS = [ 'silent' , 'error' , 'warn' , 'info' , 'debug' ] as const ;
2023-10-25 07:35:22 -07:00
2023-12-29 01:49:27 -08:00
export const CODE_LANGUAGES = [ 'javaScript' , 'python' ] as const ;
2023-05-04 11:00:00 -07:00
export const CODE_EXECUTION_MODES = [ 'runOnceForAllItems' , 'runOnceForEachItem' ] as const ;
2024-03-07 02:46:07 -08:00
// Arbitrary value to represent an empty credential value
2024-05-02 03:52:15 -07:00
export const CREDENTIAL_EMPTY_VALUE = '__n8n_EMPTY_VALUE_7b1af746-3729-4c60-9b9b-e08eb29e58da' ;
2024-03-07 02:46:07 -08:00
export const FORM_TRIGGER_PATH_IDENTIFIER = 'n8n-form' ;
2024-03-07 08:08:01 -08:00
export const UNKNOWN_ERROR_MESSAGE = 'There was an unknown issue while executing the node' ;
export const UNKNOWN_ERROR_DESCRIPTION =
'Double-check the node configuration and the service it connects to. Check the error details below and refer to the <a href="https://docs.n8n.io" target="_blank">n8n documentation</a> to troubleshoot the issue.' ;
export const UNKNOWN_ERROR_MESSAGE_CRED = 'UNKNOWN ERROR' ;
2024-03-07 02:46:07 -08:00
//n8n-nodes-base
export const STICKY_NODE_TYPE = 'n8n-nodes-base.stickyNote' ;
export const NO_OP_NODE_TYPE = 'n8n-nodes-base.noOp' ;
export const HTTP_REQUEST_NODE_TYPE = 'n8n-nodes-base.httpRequest' ;
export const WEBHOOK_NODE_TYPE = 'n8n-nodes-base.webhook' ;
export const MANUAL_TRIGGER_NODE_TYPE = 'n8n-nodes-base.manualTrigger' ;
export const ERROR_TRIGGER_NODE_TYPE = 'n8n-nodes-base.errorTrigger' ;
export const START_NODE_TYPE = 'n8n-nodes-base.start' ;
2024-07-04 05:16:15 -07:00
export const EXECUTE_WORKFLOW_NODE_TYPE = 'n8n-nodes-base.executeWorkflow' ;
2024-03-07 02:46:07 -08:00
export const EXECUTE_WORKFLOW_TRIGGER_NODE_TYPE = 'n8n-nodes-base.executeWorkflowTrigger' ;
export const CODE_NODE_TYPE = 'n8n-nodes-base.code' ;
export const FUNCTION_NODE_TYPE = 'n8n-nodes-base.function' ;
export const FUNCTION_ITEM_NODE_TYPE = 'n8n-nodes-base.functionItem' ;
2024-07-02 03:47:04 -07:00
export const MERGE_NODE_TYPE = 'n8n-nodes-base.merge' ;
2024-08-14 06:20:02 -07:00
export const AI_TRANSFORM_NODE_TYPE = 'n8n-nodes-base.aiTransform' ;
2024-03-07 02:46:07 -08:00
export const STARTING_NODE_TYPES = [
MANUAL_TRIGGER_NODE_TYPE ,
EXECUTE_WORKFLOW_TRIGGER_NODE_TYPE ,
ERROR_TRIGGER_NODE_TYPE ,
START_NODE_TYPE ,
] ;
2024-08-14 06:20:02 -07:00
export const SCRIPTING_NODE_TYPES = [
FUNCTION_NODE_TYPE ,
FUNCTION_ITEM_NODE_TYPE ,
CODE_NODE_TYPE ,
AI_TRANSFORM_NODE_TYPE ,
] ;
2024-03-07 02:46:07 -08:00
2023-05-02 00:37:49 -07:00
/ * *
* Nodes whose parameter values may refer to other nodes without expressions .
* Their content may need to be updated when the referenced node is renamed .
* /
export const NODES_WITH_RENAMABLE_CONTENT = new Set ( [
2024-03-07 02:46:07 -08:00
CODE_NODE_TYPE ,
FUNCTION_NODE_TYPE ,
FUNCTION_ITEM_NODE_TYPE ,
2024-08-14 06:20:02 -07:00
AI_TRANSFORM_NODE_TYPE ,
2023-05-02 00:37:49 -07:00
] ) ;
2023-06-23 09:23:28 -07:00
2024-03-07 02:46:07 -08:00
//@n8n/n8n-nodes-langchain
export const MANUAL_CHAT_TRIGGER_LANGCHAIN_NODE_TYPE = '@n8n/n8n-nodes-langchain.manualChatTrigger' ;
export const AGENT_LANGCHAIN_NODE_TYPE = '@n8n/n8n-nodes-langchain.agent' ;
2024-03-27 08:16:02 -07:00
export const CHAIN_LLM_LANGCHAIN_NODE_TYPE = '@n8n/n8n-nodes-langchain.chainLlm' ;
2024-03-07 02:46:07 -08:00
export const OPENAI_LANGCHAIN_NODE_TYPE = '@n8n/n8n-nodes-langchain.openAi' ;
export const CHAIN_SUMMARIZATION_LANGCHAIN_NODE_TYPE =
'@n8n/n8n-nodes-langchain.chainSummarization' ;
export const CODE_TOOL_LANGCHAIN_NODE_TYPE = '@n8n/n8n-nodes-langchain.toolCode' ;
export const WORKFLOW_TOOL_LANGCHAIN_NODE_TYPE = '@n8n/n8n-nodes-langchain.toolWorkflow' ;
2024-06-19 00:54:13 -07:00
export const HTTP_REQUEST_TOOL_LANGCHAIN_NODE_TYPE = '@n8n/n8n-nodes-langchain.toolHttpRequest' ;
2023-10-16 21:09:30 -07:00
2024-03-07 02:46:07 -08:00
export const LANGCHAIN_CUSTOM_TOOLS = [
CODE_TOOL_LANGCHAIN_NODE_TYPE ,
WORKFLOW_TOOL_LANGCHAIN_NODE_TYPE ,
2024-06-19 00:54:13 -07:00
HTTP_REQUEST_TOOL_LANGCHAIN_NODE_TYPE ,
2024-03-07 02:46:07 -08:00
] ;
2024-06-04 00:18:17 -07:00
//nodes that would execute only once with such parameters
//add 'undefined' to parameters values if it is parameter's default value
export const SINGLE_EXECUTION_NODES : { [ key : string ] : { [ key : string ] : NodeParameterValue [ ] } } = {
'n8n-nodes-base.code' : {
mode : [ undefined , 'runOnceForAllItems' ] ,
} ,
'n8n-nodes-base.executeWorkflow' : {
mode : [ undefined , 'once' ] ,
} ,
'n8n-nodes-base.crateDb' : {
operation : [ undefined , 'update' ] , // default insert
} ,
'n8n-nodes-base.timescaleDb' : {
operation : [ undefined , 'update' ] , // default insert
} ,
'n8n-nodes-base.microsoftSql' : {
operation : [ undefined , 'update' , 'delete' ] , // default insert
} ,
'n8n-nodes-base.questDb' : {
operation : [ undefined ] , // default insert
} ,
'n8n-nodes-base.mongoDb' : {
operation : [ 'insert' , 'update' ] ,
} ,
'n8n-nodes-base.redis' : {
operation : [ undefined ] , // default info
} ,
} ;