@n8n/n8n-nodes-langchain 1.86.1 → 1.87.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/credentials/AnthropicApi.credentials.js +1 -0
- package/dist/credentials/AnthropicApi.credentials.js.map +1 -0
- package/dist/credentials/AzureOpenAiApi.credentials.js +1 -0
- package/dist/credentials/AzureOpenAiApi.credentials.js.map +1 -0
- package/dist/credentials/CohereApi.credentials.js +1 -0
- package/dist/credentials/CohereApi.credentials.js.map +1 -0
- package/dist/credentials/DeepSeekApi.credentials.js +1 -0
- package/dist/credentials/DeepSeekApi.credentials.js.map +1 -0
- package/dist/credentials/GooglePalmApi.credentials.js +1 -0
- package/dist/credentials/GooglePalmApi.credentials.js.map +1 -0
- package/dist/credentials/GroqApi.credentials.js +1 -0
- package/dist/credentials/GroqApi.credentials.js.map +1 -0
- package/dist/credentials/HuggingFaceApi.credentials.js +1 -0
- package/dist/credentials/HuggingFaceApi.credentials.js.map +1 -0
- package/dist/credentials/MistralCloudApi.credentials.js +1 -0
- package/dist/credentials/MistralCloudApi.credentials.js.map +1 -0
- package/dist/credentials/MotorheadApi.credentials.js +1 -0
- package/dist/credentials/MotorheadApi.credentials.js.map +1 -0
- package/dist/credentials/OllamaApi.credentials.js +1 -0
- package/dist/credentials/OllamaApi.credentials.js.map +1 -0
- package/dist/credentials/OpenRouterApi.credentials.js +1 -0
- package/dist/credentials/OpenRouterApi.credentials.js.map +1 -0
- package/dist/credentials/PineconeApi.credentials.js +1 -0
- package/dist/credentials/PineconeApi.credentials.js.map +1 -0
- package/dist/credentials/QdrantApi.credentials.js +1 -0
- package/dist/credentials/QdrantApi.credentials.js.map +1 -0
- package/dist/credentials/SerpApi.credentials.js +1 -0
- package/dist/credentials/SerpApi.credentials.js.map +1 -0
- package/dist/credentials/WolframAlphaApi.credentials.js +1 -0
- package/dist/credentials/WolframAlphaApi.credentials.js.map +1 -0
- package/dist/credentials/XAiApi.credentials.js +1 -0
- package/dist/credentials/XAiApi.credentials.js.map +1 -0
- package/dist/credentials/XataApi.credentials.js +1 -0
- package/dist/credentials/XataApi.credentials.js.map +1 -0
- package/dist/credentials/ZepApi.credentials.js +1 -0
- package/dist/credentials/ZepApi.credentials.js.map +1 -0
- package/dist/known/nodes.json +12 -0
- package/dist/nodes/agents/Agent/Agent.node.js +1 -0
- package/dist/nodes/agents/Agent/Agent.node.js.map +1 -0
- package/dist/nodes/agents/Agent/agents/ConversationalAgent/description.js +1 -0
- package/dist/nodes/agents/Agent/agents/ConversationalAgent/description.js.map +1 -0
- package/dist/nodes/agents/Agent/agents/ConversationalAgent/execute.js +1 -0
- package/dist/nodes/agents/Agent/agents/ConversationalAgent/execute.js.map +1 -0
- package/dist/nodes/agents/Agent/agents/ConversationalAgent/prompt.js +1 -0
- package/dist/nodes/agents/Agent/agents/ConversationalAgent/prompt.js.map +1 -0
- package/dist/nodes/agents/Agent/agents/OpenAiFunctionsAgent/description.js +1 -0
- package/dist/nodes/agents/Agent/agents/OpenAiFunctionsAgent/description.js.map +1 -0
- package/dist/nodes/agents/Agent/agents/OpenAiFunctionsAgent/execute.js +1 -0
- package/dist/nodes/agents/Agent/agents/OpenAiFunctionsAgent/execute.js.map +1 -0
- package/dist/nodes/agents/Agent/agents/OpenAiFunctionsAgent/prompt.js +1 -0
- package/dist/nodes/agents/Agent/agents/OpenAiFunctionsAgent/prompt.js.map +1 -0
- package/dist/nodes/agents/Agent/agents/PlanAndExecuteAgent/description.js +1 -0
- package/dist/nodes/agents/Agent/agents/PlanAndExecuteAgent/description.js.map +1 -0
- package/dist/nodes/agents/Agent/agents/PlanAndExecuteAgent/execute.js +1 -0
- package/dist/nodes/agents/Agent/agents/PlanAndExecuteAgent/execute.js.map +1 -0
- package/dist/nodes/agents/Agent/agents/PlanAndExecuteAgent/prompt.js +1 -0
- package/dist/nodes/agents/Agent/agents/PlanAndExecuteAgent/prompt.js.map +1 -0
- package/dist/nodes/agents/Agent/agents/ReActAgent/description.js +1 -0
- package/dist/nodes/agents/Agent/agents/ReActAgent/description.js.map +1 -0
- package/dist/nodes/agents/Agent/agents/ReActAgent/execute.js +1 -0
- package/dist/nodes/agents/Agent/agents/ReActAgent/execute.js.map +1 -0
- package/dist/nodes/agents/Agent/agents/ReActAgent/prompt.js +1 -0
- package/dist/nodes/agents/Agent/agents/ReActAgent/prompt.js.map +1 -0
- package/dist/nodes/agents/Agent/agents/SqlAgent/description.js +1 -0
- package/dist/nodes/agents/Agent/agents/SqlAgent/description.js.map +1 -0
- package/dist/nodes/agents/Agent/agents/SqlAgent/execute.js +1 -0
- package/dist/nodes/agents/Agent/agents/SqlAgent/execute.js.map +1 -0
- package/dist/nodes/agents/Agent/agents/SqlAgent/other/handlers/mysql.js +1 -0
- package/dist/nodes/agents/Agent/agents/SqlAgent/other/handlers/mysql.js.map +1 -0
- package/dist/nodes/agents/Agent/agents/SqlAgent/other/handlers/postgres.js +1 -0
- package/dist/nodes/agents/Agent/agents/SqlAgent/other/handlers/postgres.js.map +1 -0
- package/dist/nodes/agents/Agent/agents/SqlAgent/other/handlers/sqlite.js +1 -0
- package/dist/nodes/agents/Agent/agents/SqlAgent/other/handlers/sqlite.js.map +1 -0
- package/dist/nodes/agents/Agent/agents/SqlAgent/other/prompts.js +1 -0
- package/dist/nodes/agents/Agent/agents/SqlAgent/other/prompts.js.map +1 -0
- package/dist/nodes/agents/Agent/agents/ToolsAgent/description.js +1 -0
- package/dist/nodes/agents/Agent/agents/ToolsAgent/description.js.map +1 -0
- package/dist/nodes/agents/Agent/agents/ToolsAgent/execute.js +1 -0
- package/dist/nodes/agents/Agent/agents/ToolsAgent/execute.js.map +1 -0
- package/dist/nodes/agents/Agent/agents/ToolsAgent/prompt.js +1 -0
- package/dist/nodes/agents/Agent/agents/ToolsAgent/prompt.js.map +1 -0
- package/dist/nodes/agents/Agent/agents/utils.js +1 -0
- package/dist/nodes/agents/Agent/agents/utils.js.map +1 -0
- package/dist/nodes/agents/OpenAiAssistant/OpenAiAssistant.node.js +1 -0
- package/dist/nodes/agents/OpenAiAssistant/OpenAiAssistant.node.js.map +1 -0
- package/dist/nodes/agents/OpenAiAssistant/utils.js +1 -0
- package/dist/nodes/agents/OpenAiAssistant/utils.js.map +1 -0
- package/dist/nodes/chains/ChainLLM/ChainLlm.node.js +1 -0
- package/dist/nodes/chains/ChainLLM/ChainLlm.node.js.map +1 -0
- package/dist/nodes/chains/ChainLLM/methods/chainExecutor.js +1 -0
- package/dist/nodes/chains/ChainLLM/methods/chainExecutor.js.map +1 -0
- package/dist/nodes/chains/ChainLLM/methods/config.js +1 -0
- package/dist/nodes/chains/ChainLLM/methods/config.js.map +1 -0
- package/dist/nodes/chains/ChainLLM/methods/imageUtils.js +1 -0
- package/dist/nodes/chains/ChainLLM/methods/imageUtils.js.map +1 -0
- package/dist/nodes/chains/ChainLLM/methods/index.js +1 -0
- package/dist/nodes/chains/ChainLLM/methods/index.js.map +1 -0
- package/dist/nodes/chains/ChainLLM/methods/promptUtils.js +1 -0
- package/dist/nodes/chains/ChainLLM/methods/promptUtils.js.map +1 -0
- package/dist/nodes/chains/ChainLLM/methods/responseFormatter.js +1 -0
- package/dist/nodes/chains/ChainLLM/methods/responseFormatter.js.map +1 -0
- package/dist/nodes/chains/ChainLLM/methods/types.js +1 -0
- package/dist/nodes/chains/ChainLLM/methods/types.js.map +1 -0
- package/dist/nodes/chains/ChainRetrievalQA/ChainRetrievalQa.node.js +1 -0
- package/dist/nodes/chains/ChainRetrievalQA/ChainRetrievalQa.node.js.map +1 -0
- package/dist/nodes/chains/ChainSummarization/ChainSummarization.node.js +1 -0
- package/dist/nodes/chains/ChainSummarization/ChainSummarization.node.js.map +1 -0
- package/dist/nodes/chains/ChainSummarization/V1/ChainSummarizationV1.node.js +1 -0
- package/dist/nodes/chains/ChainSummarization/V1/ChainSummarizationV1.node.js.map +1 -0
- package/dist/nodes/chains/ChainSummarization/V2/ChainSummarizationV2.node.js +1 -0
- package/dist/nodes/chains/ChainSummarization/V2/ChainSummarizationV2.node.js.map +1 -0
- package/dist/nodes/chains/ChainSummarization/helpers.js +1 -0
- package/dist/nodes/chains/ChainSummarization/helpers.js.map +1 -0
- package/dist/nodes/chains/ChainSummarization/prompt.js +1 -0
- package/dist/nodes/chains/ChainSummarization/prompt.js.map +1 -0
- package/dist/nodes/chains/InformationExtractor/InformationExtractor.node.js +1 -0
- package/dist/nodes/chains/InformationExtractor/InformationExtractor.node.js.map +1 -0
- package/dist/nodes/chains/InformationExtractor/helpers.js +1 -0
- package/dist/nodes/chains/InformationExtractor/helpers.js.map +1 -0
- package/dist/nodes/chains/InformationExtractor/types.js +1 -0
- package/dist/nodes/chains/InformationExtractor/types.js.map +1 -0
- package/dist/nodes/chains/SentimentAnalysis/SentimentAnalysis.node.js +1 -0
- package/dist/nodes/chains/SentimentAnalysis/SentimentAnalysis.node.js.map +1 -0
- package/dist/nodes/chains/TextClassifier/TextClassifier.node.js +1 -0
- package/dist/nodes/chains/TextClassifier/TextClassifier.node.js.map +1 -0
- package/dist/nodes/code/Code.node.js +1 -0
- package/dist/nodes/code/Code.node.js.map +1 -0
- package/dist/nodes/document_loaders/DocumentBinaryInputLoader/DocumentBinaryInputLoader.node.js +1 -0
- package/dist/nodes/document_loaders/DocumentBinaryInputLoader/DocumentBinaryInputLoader.node.js.map +1 -0
- package/dist/nodes/document_loaders/DocumentDefaultDataLoader/DocumentDefaultDataLoader.node.js +1 -0
- package/dist/nodes/document_loaders/DocumentDefaultDataLoader/DocumentDefaultDataLoader.node.js.map +1 -0
- package/dist/nodes/document_loaders/DocumentGithubLoader/DocumentGithubLoader.node.js +1 -0
- package/dist/nodes/document_loaders/DocumentGithubLoader/DocumentGithubLoader.node.js.map +1 -0
- package/dist/nodes/document_loaders/DocumentJSONInputLoader/DocumentJsonInputLoader.node.js +1 -0
- package/dist/nodes/document_loaders/DocumentJSONInputLoader/DocumentJsonInputLoader.node.js.map +1 -0
- package/dist/nodes/embeddings/EmbeddingsAwsBedrock/EmbeddingsAwsBedrock.node.js +1 -0
- package/dist/nodes/embeddings/EmbeddingsAwsBedrock/EmbeddingsAwsBedrock.node.js.map +1 -0
- package/dist/nodes/embeddings/EmbeddingsAzureOpenAi/EmbeddingsAzureOpenAi.node.js +1 -0
- package/dist/nodes/embeddings/EmbeddingsAzureOpenAi/EmbeddingsAzureOpenAi.node.js.map +1 -0
- package/dist/nodes/embeddings/EmbeddingsCohere/EmbeddingsCohere.node.js +1 -0
- package/dist/nodes/embeddings/EmbeddingsCohere/EmbeddingsCohere.node.js.map +1 -0
- package/dist/nodes/embeddings/EmbeddingsGoogleGemini/EmbeddingsGoogleGemini.node.js +1 -0
- package/dist/nodes/embeddings/EmbeddingsGoogleGemini/EmbeddingsGoogleGemini.node.js.map +1 -0
- package/dist/nodes/embeddings/EmbeddingsGoogleVertex/EmbeddingsGoogleVertex.node.js +166 -0
- package/dist/nodes/embeddings/EmbeddingsGoogleVertex/EmbeddingsGoogleVertex.node.js.map +1 -0
- package/dist/nodes/embeddings/EmbeddingsGoogleVertex/google.svg +1 -0
- package/dist/nodes/embeddings/EmbeddingsHuggingFaceInference/EmbeddingsHuggingFaceInference.node.js +1 -0
- package/dist/nodes/embeddings/EmbeddingsHuggingFaceInference/EmbeddingsHuggingFaceInference.node.js.map +1 -0
- package/dist/nodes/embeddings/EmbeddingsMistralCloud/EmbeddingsMistralCloud.node.js +1 -0
- package/dist/nodes/embeddings/EmbeddingsMistralCloud/EmbeddingsMistralCloud.node.js.map +1 -0
- package/dist/nodes/embeddings/EmbeddingsOllama/EmbeddingsOllama.node.js +1 -0
- package/dist/nodes/embeddings/EmbeddingsOllama/EmbeddingsOllama.node.js.map +1 -0
- package/dist/nodes/embeddings/EmbeddingsOpenAI/EmbeddingsOpenAi.node.js +1 -0
- package/dist/nodes/embeddings/EmbeddingsOpenAI/EmbeddingsOpenAi.node.js.map +1 -0
- package/dist/nodes/llms/LMChatAnthropic/LmChatAnthropic.node.js +1 -0
- package/dist/nodes/llms/LMChatAnthropic/LmChatAnthropic.node.js.map +1 -0
- package/dist/nodes/llms/LMChatAnthropic/methods/searchModels.js +1 -0
- package/dist/nodes/llms/LMChatAnthropic/methods/searchModels.js.map +1 -0
- package/dist/nodes/llms/LMChatOllama/LmChatOllama.node.js +1 -0
- package/dist/nodes/llms/LMChatOllama/LmChatOllama.node.js.map +1 -0
- package/dist/nodes/llms/LMChatOpenAi/LmChatOpenAi.node.js +1 -0
- package/dist/nodes/llms/LMChatOpenAi/LmChatOpenAi.node.js.map +1 -0
- package/dist/nodes/llms/LMChatOpenAi/methods/loadModels.js +1 -0
- package/dist/nodes/llms/LMChatOpenAi/methods/loadModels.js.map +1 -0
- package/dist/nodes/llms/LMCohere/LmCohere.node.js +1 -0
- package/dist/nodes/llms/LMCohere/LmCohere.node.js.map +1 -0
- package/dist/nodes/llms/LMOllama/LmOllama.node.js +1 -0
- package/dist/nodes/llms/LMOllama/LmOllama.node.js.map +1 -0
- package/dist/nodes/llms/LMOllama/description.js +1 -0
- package/dist/nodes/llms/LMOllama/description.js.map +1 -0
- package/dist/nodes/llms/LMOpenAi/LmOpenAi.node.js +1 -0
- package/dist/nodes/llms/LMOpenAi/LmOpenAi.node.js.map +1 -0
- package/dist/nodes/llms/LMOpenHuggingFaceInference/LmOpenHuggingFaceInference.node.js +1 -0
- package/dist/nodes/llms/LMOpenHuggingFaceInference/LmOpenHuggingFaceInference.node.js.map +1 -0
- package/dist/nodes/llms/LmChatAwsBedrock/LmChatAwsBedrock.node.js +1 -0
- package/dist/nodes/llms/LmChatAwsBedrock/LmChatAwsBedrock.node.js.map +1 -0
- package/dist/nodes/llms/LmChatAzureOpenAi/LmChatAzureOpenAi.node.js +1 -0
- package/dist/nodes/llms/LmChatAzureOpenAi/LmChatAzureOpenAi.node.js.map +1 -0
- package/dist/nodes/llms/LmChatDeepSeek/LmChatDeepSeek.node.js +1 -0
- package/dist/nodes/llms/LmChatDeepSeek/LmChatDeepSeek.node.js.map +1 -0
- package/dist/nodes/llms/LmChatGoogleGemini/LmChatGoogleGemini.node.js +1 -0
- package/dist/nodes/llms/LmChatGoogleGemini/LmChatGoogleGemini.node.js.map +1 -0
- package/dist/nodes/llms/LmChatGoogleVertex/LmChatGoogleVertex.node.js +1 -0
- package/dist/nodes/llms/LmChatGoogleVertex/LmChatGoogleVertex.node.js.map +1 -0
- package/dist/nodes/llms/LmChatGoogleVertex/error-handling.js +1 -0
- package/dist/nodes/llms/LmChatGoogleVertex/error-handling.js.map +1 -0
- package/dist/nodes/llms/LmChatGroq/LmChatGroq.node.js +1 -0
- package/dist/nodes/llms/LmChatGroq/LmChatGroq.node.js.map +1 -0
- package/dist/nodes/llms/LmChatMistralCloud/LmChatMistralCloud.node.js +1 -0
- package/dist/nodes/llms/LmChatMistralCloud/LmChatMistralCloud.node.js.map +1 -0
- package/dist/nodes/llms/LmChatOpenRouter/LmChatOpenRouter.node.js +1 -0
- package/dist/nodes/llms/LmChatOpenRouter/LmChatOpenRouter.node.js.map +1 -0
- package/dist/nodes/llms/LmChatXAiGrok/LmChatXAiGrok.node.js +1 -0
- package/dist/nodes/llms/LmChatXAiGrok/LmChatXAiGrok.node.js.map +1 -0
- package/dist/nodes/llms/N8nLlmTracing.js +1 -0
- package/dist/nodes/llms/N8nLlmTracing.js.map +1 -0
- package/dist/nodes/llms/gemini-common/additional-options.js +1 -0
- package/dist/nodes/llms/gemini-common/additional-options.js.map +1 -0
- package/dist/nodes/llms/gemini-common/safety-options.js +1 -0
- package/dist/nodes/llms/gemini-common/safety-options.js.map +1 -0
- package/dist/nodes/llms/n8nDefaultFailedAttemptHandler.js +1 -0
- package/dist/nodes/llms/n8nDefaultFailedAttemptHandler.js.map +1 -0
- package/dist/nodes/llms/n8nLlmFailedAttemptHandler.js +1 -0
- package/dist/nodes/llms/n8nLlmFailedAttemptHandler.js.map +1 -0
- package/dist/nodes/memory/MemoryBufferWindow/MemoryBufferWindow.node.js +1 -0
- package/dist/nodes/memory/MemoryBufferWindow/MemoryBufferWindow.node.js.map +1 -0
- package/dist/nodes/memory/MemoryChatRetriever/MemoryChatRetriever.node.js +1 -0
- package/dist/nodes/memory/MemoryChatRetriever/MemoryChatRetriever.node.js.map +1 -0
- package/dist/nodes/memory/MemoryManager/MemoryManager.node.js +1 -0
- package/dist/nodes/memory/MemoryManager/MemoryManager.node.js.map +1 -0
- package/dist/nodes/memory/MemoryMongoDbChat/MemoryMongoDbChat.node.js +155 -0
- package/dist/nodes/memory/MemoryMongoDbChat/MemoryMongoDbChat.node.js.map +1 -0
- package/dist/nodes/memory/MemoryMongoDbChat/mongodb.dark.svg +3 -0
- package/dist/nodes/memory/MemoryMongoDbChat/mongodb.svg +3 -0
- package/dist/nodes/memory/MemoryMotorhead/MemoryMotorhead.node.js +1 -0
- package/dist/nodes/memory/MemoryMotorhead/MemoryMotorhead.node.js.map +1 -0
- package/dist/nodes/memory/MemoryPostgresChat/MemoryPostgresChat.node.js +1 -0
- package/dist/nodes/memory/MemoryPostgresChat/MemoryPostgresChat.node.js.map +1 -0
- package/dist/nodes/memory/MemoryRedisChat/MemoryRedisChat.node.js +1 -0
- package/dist/nodes/memory/MemoryRedisChat/MemoryRedisChat.node.js.map +1 -0
- package/dist/nodes/memory/MemoryXata/MemoryXata.node.js +1 -0
- package/dist/nodes/memory/MemoryXata/MemoryXata.node.js.map +1 -0
- package/dist/nodes/memory/MemoryZep/MemoryZep.node.js +1 -0
- package/dist/nodes/memory/MemoryZep/MemoryZep.node.js.map +1 -0
- package/dist/nodes/memory/descriptions.js +1 -0
- package/dist/nodes/memory/descriptions.js.map +1 -0
- package/dist/nodes/output_parser/OutputParserAutofixing/OutputParserAutofixing.node.js +1 -0
- package/dist/nodes/output_parser/OutputParserAutofixing/OutputParserAutofixing.node.js.map +1 -0
- package/dist/nodes/output_parser/OutputParserAutofixing/prompt.js +1 -0
- package/dist/nodes/output_parser/OutputParserAutofixing/prompt.js.map +1 -0
- package/dist/nodes/output_parser/OutputParserItemList/OutputParserItemList.node.js +1 -0
- package/dist/nodes/output_parser/OutputParserItemList/OutputParserItemList.node.js.map +1 -0
- package/dist/nodes/output_parser/OutputParserStructured/OutputParserStructured.node.js +1 -0
- package/dist/nodes/output_parser/OutputParserStructured/OutputParserStructured.node.js.map +1 -0
- package/dist/nodes/retrievers/RetrieverContextualCompression/RetrieverContextualCompression.node.js +1 -0
- package/dist/nodes/retrievers/RetrieverContextualCompression/RetrieverContextualCompression.node.js.map +1 -0
- package/dist/nodes/retrievers/RetrieverMultiQuery/RetrieverMultiQuery.node.js +1 -0
- package/dist/nodes/retrievers/RetrieverMultiQuery/RetrieverMultiQuery.node.js.map +1 -0
- package/dist/nodes/retrievers/RetrieverVectorStore/RetrieverVectorStore.node.js +1 -0
- package/dist/nodes/retrievers/RetrieverVectorStore/RetrieverVectorStore.node.js.map +1 -0
- package/dist/nodes/retrievers/RetrieverWorkflow/RetrieverWorkflow.node.js +1 -0
- package/dist/nodes/retrievers/RetrieverWorkflow/RetrieverWorkflow.node.js.map +1 -0
- package/dist/nodes/text_splitters/TextSplitterCharacterTextSplitter/TextSplitterCharacterTextSplitter.node.js +1 -0
- package/dist/nodes/text_splitters/TextSplitterCharacterTextSplitter/TextSplitterCharacterTextSplitter.node.js.map +1 -0
- package/dist/nodes/text_splitters/TextSplitterRecursiveCharacterTextSplitter/TextSplitterRecursiveCharacterTextSplitter.node.js +1 -0
- package/dist/nodes/text_splitters/TextSplitterRecursiveCharacterTextSplitter/TextSplitterRecursiveCharacterTextSplitter.node.js.map +1 -0
- package/dist/nodes/text_splitters/TextSplitterTokenSplitter/TextSplitterTokenSplitter.node.js +1 -0
- package/dist/nodes/text_splitters/TextSplitterTokenSplitter/TextSplitterTokenSplitter.node.js.map +1 -0
- package/dist/nodes/tools/ToolCalculator/ToolCalculator.node.js +1 -0
- package/dist/nodes/tools/ToolCalculator/ToolCalculator.node.js.map +1 -0
- package/dist/nodes/tools/ToolCode/ToolCode.node.js +1 -0
- package/dist/nodes/tools/ToolCode/ToolCode.node.js.map +1 -0
- package/dist/nodes/tools/ToolHttpRequest/ToolHttpRequest.node.js +1 -0
- package/dist/nodes/tools/ToolHttpRequest/ToolHttpRequest.node.js.map +1 -0
- package/dist/nodes/tools/ToolHttpRequest/descriptions.js +1 -0
- package/dist/nodes/tools/ToolHttpRequest/descriptions.js.map +1 -0
- package/dist/nodes/tools/ToolHttpRequest/interfaces.js +1 -0
- package/dist/nodes/tools/ToolHttpRequest/interfaces.js.map +1 -0
- package/dist/nodes/tools/ToolHttpRequest/utils.js +3 -2
- package/dist/nodes/tools/ToolHttpRequest/utils.js.map +1 -0
- package/dist/nodes/tools/ToolSerpApi/ToolSerpApi.node.js +1 -0
- package/dist/nodes/tools/ToolSerpApi/ToolSerpApi.node.js.map +1 -0
- package/dist/nodes/tools/ToolThink/ToolThink.node.js +94 -0
- package/dist/nodes/tools/ToolThink/ToolThink.node.js.map +1 -0
- package/dist/nodes/tools/ToolVectorStore/ToolVectorStore.node.js +1 -0
- package/dist/nodes/tools/ToolVectorStore/ToolVectorStore.node.js.map +1 -0
- package/dist/nodes/tools/ToolWikipedia/ToolWikipedia.node.js +1 -0
- package/dist/nodes/tools/ToolWikipedia/ToolWikipedia.node.js.map +1 -0
- package/dist/nodes/tools/ToolWolframAlpha/ToolWolframAlpha.node.js +1 -0
- package/dist/nodes/tools/ToolWolframAlpha/ToolWolframAlpha.node.js.map +1 -0
- package/dist/nodes/tools/ToolWorkflow/ToolWorkflow.node.js +1 -0
- package/dist/nodes/tools/ToolWorkflow/ToolWorkflow.node.js.map +1 -0
- package/dist/nodes/tools/ToolWorkflow/v1/ToolWorkflowV1.node.js +1 -0
- package/dist/nodes/tools/ToolWorkflow/v1/ToolWorkflowV1.node.js.map +1 -0
- package/dist/nodes/tools/ToolWorkflow/v1/versionDescription.js +1 -0
- package/dist/nodes/tools/ToolWorkflow/v1/versionDescription.js.map +1 -0
- package/dist/nodes/tools/ToolWorkflow/v2/ToolWorkflowV2.node.js +1 -0
- package/dist/nodes/tools/ToolWorkflow/v2/ToolWorkflowV2.node.js.map +1 -0
- package/dist/nodes/tools/ToolWorkflow/v2/methods/index.js +1 -0
- package/dist/nodes/tools/ToolWorkflow/v2/methods/index.js.map +1 -0
- package/dist/nodes/tools/ToolWorkflow/v2/methods/localResourceMapping.js +1 -0
- package/dist/nodes/tools/ToolWorkflow/v2/methods/localResourceMapping.js.map +1 -0
- package/dist/nodes/tools/ToolWorkflow/v2/utils/WorkflowToolService.js +1 -0
- package/dist/nodes/tools/ToolWorkflow/v2/utils/WorkflowToolService.js.map +1 -0
- package/dist/nodes/tools/ToolWorkflow/v2/versionDescription.js +1 -0
- package/dist/nodes/tools/ToolWorkflow/v2/versionDescription.js.map +1 -0
- package/dist/nodes/trigger/ChatTrigger/ChatTrigger.node.js +1 -0
- package/dist/nodes/trigger/ChatTrigger/ChatTrigger.node.js.map +1 -0
- package/dist/nodes/trigger/ChatTrigger/GenericFunctions.js +1 -0
- package/dist/nodes/trigger/ChatTrigger/GenericFunctions.js.map +1 -0
- package/dist/nodes/trigger/ChatTrigger/constants.js +1 -0
- package/dist/nodes/trigger/ChatTrigger/constants.js.map +1 -0
- package/dist/nodes/trigger/ChatTrigger/error.js +1 -0
- package/dist/nodes/trigger/ChatTrigger/error.js.map +1 -0
- package/dist/nodes/trigger/ChatTrigger/templates.js +1 -0
- package/dist/nodes/trigger/ChatTrigger/templates.js.map +1 -0
- package/dist/nodes/trigger/ChatTrigger/types.js +1 -0
- package/dist/nodes/trigger/ChatTrigger/types.js.map +1 -0
- package/dist/nodes/trigger/ManualChatTrigger/ManualChatTrigger.node.js +1 -0
- package/dist/nodes/trigger/ManualChatTrigger/ManualChatTrigger.node.js.map +1 -0
- package/dist/nodes/vector_store/VectorStoreInMemory/VectorStoreInMemory.node.js +1 -0
- package/dist/nodes/vector_store/VectorStoreInMemory/VectorStoreInMemory.node.js.map +1 -0
- package/dist/nodes/vector_store/VectorStoreInMemoryInsert/VectorStoreInMemoryInsert.node.js +1 -0
- package/dist/nodes/vector_store/VectorStoreInMemoryInsert/VectorStoreInMemoryInsert.node.js.map +1 -0
- package/dist/nodes/vector_store/VectorStoreInMemoryLoad/VectorStoreInMemoryLoad.node.js +1 -0
- package/dist/nodes/vector_store/VectorStoreInMemoryLoad/VectorStoreInMemoryLoad.node.js.map +1 -0
- package/dist/nodes/vector_store/VectorStoreMongoDBAtlas/VectorStoreMongoDBAtlas.node.js +1 -0
- package/dist/nodes/vector_store/VectorStoreMongoDBAtlas/VectorStoreMongoDBAtlas.node.js.map +1 -0
- package/dist/nodes/vector_store/VectorStorePGVector/VectorStorePGVector.node.js +1 -0
- package/dist/nodes/vector_store/VectorStorePGVector/VectorStorePGVector.node.js.map +1 -0
- package/dist/nodes/vector_store/VectorStorePinecone/VectorStorePinecone.node.js +1 -0
- package/dist/nodes/vector_store/VectorStorePinecone/VectorStorePinecone.node.js.map +1 -0
- package/dist/nodes/vector_store/VectorStorePineconeInsert/VectorStorePineconeInsert.node.js +1 -0
- package/dist/nodes/vector_store/VectorStorePineconeInsert/VectorStorePineconeInsert.node.js.map +1 -0
- package/dist/nodes/vector_store/VectorStorePineconeLoad/VectorStorePineconeLoad.node.js +1 -0
- package/dist/nodes/vector_store/VectorStorePineconeLoad/VectorStorePineconeLoad.node.js.map +1 -0
- package/dist/nodes/vector_store/VectorStoreQdrant/VectorStoreQdrant.node.js +1 -0
- package/dist/nodes/vector_store/VectorStoreQdrant/VectorStoreQdrant.node.js.map +1 -0
- package/dist/nodes/vector_store/VectorStoreSupabase/VectorStoreSupabase.node.js +1 -0
- package/dist/nodes/vector_store/VectorStoreSupabase/VectorStoreSupabase.node.js.map +1 -0
- package/dist/nodes/vector_store/VectorStoreSupabaseInsert/VectorStoreSupabaseInsert.node.js +1 -0
- package/dist/nodes/vector_store/VectorStoreSupabaseInsert/VectorStoreSupabaseInsert.node.js.map +1 -0
- package/dist/nodes/vector_store/VectorStoreSupabaseLoad/VectorStoreSupabaseLoad.node.js +1 -0
- package/dist/nodes/vector_store/VectorStoreSupabaseLoad/VectorStoreSupabaseLoad.node.js.map +1 -0
- package/dist/nodes/vector_store/VectorStoreZep/VectorStoreZep.node.js +1 -0
- package/dist/nodes/vector_store/VectorStoreZep/VectorStoreZep.node.js.map +1 -0
- package/dist/nodes/vector_store/VectorStoreZepInsert/VectorStoreZepInsert.node.js +1 -0
- package/dist/nodes/vector_store/VectorStoreZepInsert/VectorStoreZepInsert.node.js.map +1 -0
- package/dist/nodes/vector_store/VectorStoreZepLoad/VectorStoreZepLoad.node.js +1 -0
- package/dist/nodes/vector_store/VectorStoreZepLoad/VectorStoreZepLoad.node.js.map +1 -0
- package/dist/nodes/vector_store/shared/MemoryManager/MemoryCalculator.js +1 -0
- package/dist/nodes/vector_store/shared/MemoryManager/MemoryCalculator.js.map +1 -0
- package/dist/nodes/vector_store/shared/MemoryManager/MemoryVectorStoreManager.js +1 -0
- package/dist/nodes/vector_store/shared/MemoryManager/MemoryVectorStoreManager.js.map +1 -0
- package/dist/nodes/vector_store/shared/MemoryManager/StoreCleanupService.js +1 -0
- package/dist/nodes/vector_store/shared/MemoryManager/StoreCleanupService.js.map +1 -0
- package/dist/nodes/vector_store/shared/MemoryManager/config.js +1 -0
- package/dist/nodes/vector_store/shared/MemoryManager/config.js.map +1 -0
- package/dist/nodes/vector_store/shared/MemoryManager/types.js +1 -0
- package/dist/nodes/vector_store/shared/MemoryManager/types.js.map +1 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/constants.js +1 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/constants.js.map +1 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/createVectorStoreNode.js +1 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/createVectorStoreNode.js.map +1 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/methods/listSearch.js +1 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/methods/listSearch.js.map +1 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/index.js +1 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/index.js.map +1 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/insertOperation.js +1 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/insertOperation.js.map +1 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/loadOperation.js +1 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/loadOperation.js.map +1 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/retrieveAsToolOperation.js +1 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/retrieveAsToolOperation.js.map +1 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/retrieveOperation.js +1 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/retrieveOperation.js.map +1 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/updateOperation.js +1 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/updateOperation.js.map +1 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/types.js +1 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/types.js.map +1 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/utils.js +1 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/utils.js.map +1 -0
- package/dist/nodes/vector_store/shared/descriptions.js +1 -0
- package/dist/nodes/vector_store/shared/descriptions.js.map +1 -0
- package/dist/nodes/vector_store/shared/processDocuments.js +1 -0
- package/dist/nodes/vector_store/shared/processDocuments.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/OpenAi.node.js +1 -0
- package/dist/nodes/vendors/OpenAi/OpenAi.node.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/actions/assistant/create.operation.js +1 -0
- package/dist/nodes/vendors/OpenAi/actions/assistant/create.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/actions/assistant/deleteAssistant.operation.js +1 -0
- package/dist/nodes/vendors/OpenAi/actions/assistant/deleteAssistant.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/actions/assistant/index.js +1 -0
- package/dist/nodes/vendors/OpenAi/actions/assistant/index.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/actions/assistant/list.operation.js +1 -0
- package/dist/nodes/vendors/OpenAi/actions/assistant/list.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/actions/assistant/message.operation.js +1 -0
- package/dist/nodes/vendors/OpenAi/actions/assistant/message.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/actions/assistant/update.operation.js +1 -0
- package/dist/nodes/vendors/OpenAi/actions/assistant/update.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/actions/audio/generate.operation.js +1 -0
- package/dist/nodes/vendors/OpenAi/actions/audio/generate.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/actions/audio/index.js +1 -0
- package/dist/nodes/vendors/OpenAi/actions/audio/index.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/actions/audio/transcribe.operation.js +1 -0
- package/dist/nodes/vendors/OpenAi/actions/audio/transcribe.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/actions/audio/translate.operation.js +1 -0
- package/dist/nodes/vendors/OpenAi/actions/audio/translate.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/actions/descriptions.js +1 -0
- package/dist/nodes/vendors/OpenAi/actions/descriptions.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/actions/file/deleteFile.operation.js +1 -0
- package/dist/nodes/vendors/OpenAi/actions/file/deleteFile.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/actions/file/index.js +1 -0
- package/dist/nodes/vendors/OpenAi/actions/file/index.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/actions/file/list.operation.js +1 -0
- package/dist/nodes/vendors/OpenAi/actions/file/list.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/actions/file/upload.operation.js +1 -0
- package/dist/nodes/vendors/OpenAi/actions/file/upload.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/actions/image/analyze.operation.js +1 -0
- package/dist/nodes/vendors/OpenAi/actions/image/analyze.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/actions/image/generate.operation.js +1 -0
- package/dist/nodes/vendors/OpenAi/actions/image/generate.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/actions/image/index.js +1 -0
- package/dist/nodes/vendors/OpenAi/actions/image/index.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/actions/node.type.js +1 -0
- package/dist/nodes/vendors/OpenAi/actions/node.type.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/actions/router.js +1 -0
- package/dist/nodes/vendors/OpenAi/actions/router.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/actions/text/classify.operation.js +1 -0
- package/dist/nodes/vendors/OpenAi/actions/text/classify.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/actions/text/index.js +1 -0
- package/dist/nodes/vendors/OpenAi/actions/text/index.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/actions/text/message.operation.js +1 -0
- package/dist/nodes/vendors/OpenAi/actions/text/message.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/actions/versionDescription.js +1 -0
- package/dist/nodes/vendors/OpenAi/actions/versionDescription.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/helpers/constants.js +1 -0
- package/dist/nodes/vendors/OpenAi/helpers/constants.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/helpers/error-handling.js +1 -0
- package/dist/nodes/vendors/OpenAi/helpers/error-handling.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/helpers/interfaces.js +1 -0
- package/dist/nodes/vendors/OpenAi/helpers/interfaces.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/helpers/utils.js +1 -0
- package/dist/nodes/vendors/OpenAi/helpers/utils.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/methods/index.js +1 -0
- package/dist/nodes/vendors/OpenAi/methods/index.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/methods/listSearch.js +1 -0
- package/dist/nodes/vendors/OpenAi/methods/listSearch.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/methods/loadOptions.js +1 -0
- package/dist/nodes/vendors/OpenAi/methods/loadOptions.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/transport/index.js +1 -0
- package/dist/nodes/vendors/OpenAi/transport/index.js.map +1 -0
- package/dist/types/nodes.json +3 -0
- package/dist/types/types.js +1 -0
- package/dist/types/types.js.map +1 -0
- package/dist/types/zod.types.js +1 -0
- package/dist/types/zod.types.js.map +1 -0
- package/dist/utils/N8nBinaryLoader.js +1 -0
- package/dist/utils/N8nBinaryLoader.js.map +1 -0
- package/dist/utils/N8nJsonLoader.js +1 -0
- package/dist/utils/N8nJsonLoader.js.map +1 -0
- package/dist/utils/N8nTool.js +1 -0
- package/dist/utils/N8nTool.js.map +1 -0
- package/dist/utils/descriptions.js +1 -0
- package/dist/utils/descriptions.js.map +1 -0
- package/dist/utils/helpers.js +1 -0
- package/dist/utils/helpers.js.map +1 -0
- package/dist/utils/logWrapper.js +1 -0
- package/dist/utils/logWrapper.js.map +1 -0
- package/dist/utils/output_parsers/N8nItemListOutputParser.js +1 -0
- package/dist/utils/output_parsers/N8nItemListOutputParser.js.map +1 -0
- package/dist/utils/output_parsers/N8nOutputFixingParser.js +1 -0
- package/dist/utils/output_parsers/N8nOutputFixingParser.js.map +1 -0
- package/dist/utils/output_parsers/N8nOutputParser.js +1 -0
- package/dist/utils/output_parsers/N8nOutputParser.js.map +1 -0
- package/dist/utils/output_parsers/N8nStructuredOutputParser.js +1 -0
- package/dist/utils/output_parsers/N8nStructuredOutputParser.js.map +1 -0
- package/dist/utils/output_parsers/prompt.js +1 -0
- package/dist/utils/output_parsers/prompt.js.map +1 -0
- package/dist/utils/schemaParsing.js +1 -0
- package/dist/utils/schemaParsing.js.map +1 -0
- package/dist/utils/sharedFields.js +1 -0
- package/dist/utils/sharedFields.js.map +1 -0
- package/dist/utils/tracing.js +1 -0
- package/dist/utils/tracing.js.map +1 -0
- package/package.json +9 -6
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../nodes/tools/ToolCalculator/ToolCalculator.node.ts"],"sourcesContent":["/* eslint-disable n8n-nodes-base/node-dirname-against-convention */\nimport { Calculator } from '@langchain/community/tools/calculator';\nimport {\n\tNodeConnectionTypes,\n\ttype INodeType,\n\ttype INodeTypeDescription,\n\ttype ISupplyDataFunctions,\n\ttype SupplyData,\n} from 'n8n-workflow';\n\nimport { logWrapper } from '@utils/logWrapper';\nimport { getConnectionHintNoticeField } from '@utils/sharedFields';\n\nexport class ToolCalculator implements INodeType {\n\tdescription: INodeTypeDescription = {\n\t\tdisplayName: 'Calculator',\n\t\tname: 'toolCalculator',\n\t\ticon: 'fa:calculator',\n\t\ticonColor: 'black',\n\t\tgroup: ['transform'],\n\t\tversion: 1,\n\t\tdescription: 'Make it easier for AI agents to perform arithmetic',\n\t\tdefaults: {\n\t\t\tname: 'Calculator',\n\t\t},\n\t\tcodex: {\n\t\t\tcategories: ['AI'],\n\t\t\tsubcategories: {\n\t\t\t\tAI: ['Tools'],\n\t\t\t\tTools: ['Other Tools'],\n\t\t\t},\n\t\t\tresources: {\n\t\t\t\tprimaryDocumentation: [\n\t\t\t\t\t{\n\t\t\t\t\t\turl: 'https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.toolcalculator/',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\t\t// eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node\n\t\tinputs: [],\n\t\t// eslint-disable-next-line n8n-nodes-base/node-class-description-outputs-wrong\n\t\toutputs: [NodeConnectionTypes.AiTool],\n\t\toutputNames: ['Tool'],\n\t\tproperties: [getConnectionHintNoticeField([NodeConnectionTypes.AiAgent])],\n\t};\n\n\tasync supplyData(this: ISupplyDataFunctions): Promise<SupplyData> {\n\t\treturn {\n\t\t\tresponse: logWrapper(new Calculator(), this),\n\t\t};\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,wBAA2B;AAC3B,0BAMO;AAEP,wBAA2B;AAC3B,0BAA6C;AAEtC,MAAM,eAAoC;AAAA,EAA1C;AACN,uBAAoC;AAAA,MACnC,aAAa;AAAA,MACb,MAAM;AAAA,MACN,MAAM;AAAA,MACN,WAAW;AAAA,MACX,OAAO,CAAC,WAAW;AAAA,MACnB,SAAS;AAAA,MACT,aAAa;AAAA,MACb,UAAU;AAAA,QACT,MAAM;AAAA,MACP;AAAA,MACA,OAAO;AAAA,QACN,YAAY,CAAC,IAAI;AAAA,QACjB,eAAe;AAAA,UACd,IAAI,CAAC,OAAO;AAAA,UACZ,OAAO,CAAC,aAAa;AAAA,QACtB;AAAA,QACA,WAAW;AAAA,UACV,sBAAsB;AAAA,YACrB;AAAA,cACC,KAAK;AAAA,YACN;AAAA,UACD;AAAA,QACD;AAAA,MACD;AAAA;AAAA,MAEA,QAAQ,CAAC;AAAA;AAAA,MAET,SAAS,CAAC,wCAAoB,MAAM;AAAA,MACpC,aAAa,CAAC,MAAM;AAAA,MACpB,YAAY,KAAC,kDAA6B,CAAC,wCAAoB,OAAO,CAAC,CAAC;AAAA,IACzE;AAAA;AAAA,EAEA,MAAM,aAA4D;AACjE,WAAO;AAAA,MACN,cAAU,8BAAW,IAAI,6BAAW,GAAG,IAAI;AAAA,IAC5C;AAAA,EACD;AACD;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../nodes/tools/ToolCode/ToolCode.node.ts"],"sourcesContent":["/* eslint-disable n8n-nodes-base/node-dirname-against-convention */\nimport { DynamicStructuredTool, DynamicTool } from '@langchain/core/tools';\nimport type { JSONSchema7 } from 'json-schema';\nimport { JavaScriptSandbox } from 'n8n-nodes-base/dist/nodes/Code/JavaScriptSandbox';\nimport { PythonSandbox } from 'n8n-nodes-base/dist/nodes/Code/PythonSandbox';\nimport type { Sandbox } from 'n8n-nodes-base/dist/nodes/Code/Sandbox';\nimport { getSandboxContext } from 'n8n-nodes-base/dist/nodes/Code/Sandbox';\nimport type {\n\tINodeType,\n\tINodeTypeDescription,\n\tISupplyDataFunctions,\n\tSupplyData,\n\tExecutionError,\n\tIDataObject,\n} from 'n8n-workflow';\nimport { jsonParse, NodeConnectionTypes, NodeOperationError } from 'n8n-workflow';\n\nimport {\n\tbuildInputSchemaField,\n\tbuildJsonSchemaExampleField,\n\tschemaTypeField,\n} from '@utils/descriptions';\nimport { convertJsonSchemaToZod, generateSchema } from '@utils/schemaParsing';\nimport { getConnectionHintNoticeField } from '@utils/sharedFields';\n\nimport type { DynamicZodObject } from '../../../types/zod.types';\n\nexport class ToolCode implements INodeType {\n\tdescription: INodeTypeDescription = {\n\t\tdisplayName: 'Code Tool',\n\t\tname: 'toolCode',\n\t\ticon: 'fa:code',\n\t\ticonColor: 'black',\n\t\tgroup: ['transform'],\n\t\tversion: [1, 1.1],\n\t\tdescription: 'Write a tool in JS or Python',\n\t\tdefaults: {\n\t\t\tname: 'Code Tool',\n\t\t},\n\t\tcodex: {\n\t\t\tcategories: ['AI'],\n\t\t\tsubcategories: {\n\t\t\t\tAI: ['Tools'],\n\t\t\t\tTools: ['Recommended Tools'],\n\t\t\t},\n\t\t\tresources: {\n\t\t\t\tprimaryDocumentation: [\n\t\t\t\t\t{\n\t\t\t\t\t\turl: 'https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.toolcode/',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\t\t// eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node\n\t\tinputs: [],\n\t\t// eslint-disable-next-line n8n-nodes-base/node-class-description-outputs-wrong\n\t\toutputs: [NodeConnectionTypes.AiTool],\n\t\toutputNames: ['Tool'],\n\t\tproperties: [\n\t\t\tgetConnectionHintNoticeField([NodeConnectionTypes.AiAgent]),\n\t\t\t{\n\t\t\t\tdisplayName:\n\t\t\t\t\t'See an example of a conversational agent with custom tool written in JavaScript <a href=\"/templates/1963\" target=\"_blank\">here</a>.',\n\t\t\t\tname: 'noticeTemplateExample',\n\t\t\t\ttype: 'notice',\n\t\t\t\tdefault: '',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Name',\n\t\t\t\tname: 'name',\n\t\t\t\ttype: 'string',\n\t\t\t\tdefault: '',\n\t\t\t\tplaceholder: 'My_Tool',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\t'@version': [1],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Name',\n\t\t\t\tname: 'name',\n\t\t\t\ttype: 'string',\n\t\t\t\tdefault: '',\n\t\t\t\tplaceholder: 'e.g. My_Tool',\n\t\t\t\tvalidateType: 'string-alphanumeric',\n\t\t\t\tdescription:\n\t\t\t\t\t'The name of the function to be called, could contain letters, numbers, and underscores only',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\t'@version': [{ _cnd: { gte: 1.1 } }],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Description',\n\t\t\t\tname: 'description',\n\t\t\t\ttype: 'string',\n\t\t\t\tdefault: '',\n\t\t\t\tplaceholder:\n\t\t\t\t\t'Call this tool to get a random color. The input should be a string with comma separted names of colors to exclude.',\n\t\t\t\ttypeOptions: {\n\t\t\t\t\trows: 3,\n\t\t\t\t},\n\t\t\t},\n\n\t\t\t{\n\t\t\t\tdisplayName: 'Language',\n\t\t\t\tname: 'language',\n\t\t\t\ttype: 'options',\n\t\t\t\tnoDataExpression: true,\n\t\t\t\toptions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'JavaScript',\n\t\t\t\t\t\tvalue: 'javaScript',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Python (Beta)',\n\t\t\t\t\t\tvalue: 'python',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tdefault: 'javaScript',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'JavaScript',\n\t\t\t\tname: 'jsCode',\n\t\t\t\ttype: 'string',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tlanguage: ['javaScript'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\ttypeOptions: {\n\t\t\t\t\teditor: 'jsEditor',\n\t\t\t\t},\n\t\t\t\tdefault:\n\t\t\t\t\t'// Example: convert the incoming query to uppercase and return it\\nreturn query.toUpperCase()',\n\t\t\t\t// TODO: Add proper text here later\n\t\t\t\thint: 'You can access the input the tool receives via the input property \"query\". The returned value should be a single string.',\n\t\t\t\t// eslint-disable-next-line n8n-nodes-base/node-param-description-missing-final-period\n\t\t\t\tdescription: 'E.g. Converts any text to uppercase',\n\t\t\t\tnoDataExpression: true,\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Python',\n\t\t\t\tname: 'pythonCode',\n\t\t\t\ttype: 'string',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tlanguage: ['python'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\ttypeOptions: {\n\t\t\t\t\teditor: 'codeNodeEditor', // TODO: create a separate `pythonEditor` component\n\t\t\t\t\teditorLanguage: 'python',\n\t\t\t\t},\n\t\t\t\tdefault:\n\t\t\t\t\t'# Example: convert the incoming query to uppercase and return it\\nreturn query.upper()',\n\t\t\t\t// TODO: Add proper text here later\n\t\t\t\thint: 'You can access the input the tool receives via the input property \"query\". The returned value should be a single string.',\n\t\t\t\t// eslint-disable-next-line n8n-nodes-base/node-param-description-missing-final-period\n\t\t\t\tdescription: 'E.g. Converts any text to uppercase',\n\t\t\t\tnoDataExpression: true,\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Specify Input Schema',\n\t\t\t\tname: 'specifyInputSchema',\n\t\t\t\ttype: 'boolean',\n\t\t\t\tdescription:\n\t\t\t\t\t'Whether to specify the schema for the function. This would require the LLM to provide the input in the correct format and would validate it against the schema.',\n\t\t\t\tnoDataExpression: true,\n\t\t\t\tdefault: false,\n\t\t\t},\n\t\t\t{ ...schemaTypeField, displayOptions: { show: { specifyInputSchema: [true] } } },\n\t\t\tbuildJsonSchemaExampleField({ showExtraProps: { specifyInputSchema: [true] } }),\n\t\t\tbuildInputSchemaField({ showExtraProps: { specifyInputSchema: [true] } }),\n\t\t],\n\t};\n\n\tasync supplyData(this: ISupplyDataFunctions, itemIndex: number): Promise<SupplyData> {\n\t\tconst node = this.getNode();\n\t\tconst workflowMode = this.getMode();\n\n\t\tconst name = this.getNodeParameter('name', itemIndex) as string;\n\t\tconst description = this.getNodeParameter('description', itemIndex) as string;\n\n\t\tconst useSchema = this.getNodeParameter('specifyInputSchema', itemIndex) as boolean;\n\n\t\tconst language = this.getNodeParameter('language', itemIndex) as string;\n\t\tlet code = '';\n\t\tif (language === 'javaScript') {\n\t\t\tcode = this.getNodeParameter('jsCode', itemIndex) as string;\n\t\t} else {\n\t\t\tcode = this.getNodeParameter('pythonCode', itemIndex) as string;\n\t\t}\n\n\t\tconst getSandbox = (query: string | IDataObject, index = 0) => {\n\t\t\tconst context = getSandboxContext.call(this, index);\n\t\t\tcontext.query = query;\n\n\t\t\tlet sandbox: Sandbox;\n\t\t\tif (language === 'javaScript') {\n\t\t\t\tsandbox = new JavaScriptSandbox(context, code, this.helpers);\n\t\t\t} else {\n\t\t\t\tsandbox = new PythonSandbox(context, code, this.helpers);\n\t\t\t}\n\n\t\t\tsandbox.on(\n\t\t\t\t'output',\n\t\t\t\tworkflowMode === 'manual'\n\t\t\t\t\t? this.sendMessageToUI.bind(this)\n\t\t\t\t\t: (...args: unknown[]) =>\n\t\t\t\t\t\t\tconsole.log(`[Workflow \"${this.getWorkflow().id}\"][Node \"${node.name}\"]`, ...args),\n\t\t\t);\n\t\t\treturn sandbox;\n\t\t};\n\n\t\tconst runFunction = async (query: string | IDataObject): Promise<string> => {\n\t\t\tconst sandbox = getSandbox(query, itemIndex);\n\t\t\treturn await sandbox.runCode<string>();\n\t\t};\n\n\t\tconst toolHandler = async (query: string | IDataObject): Promise<string> => {\n\t\t\tconst { index } = this.addInputData(NodeConnectionTypes.AiTool, [[{ json: { query } }]]);\n\n\t\t\tlet response: string = '';\n\t\t\tlet executionError: ExecutionError | undefined;\n\t\t\ttry {\n\t\t\t\tresponse = await runFunction(query);\n\t\t\t} catch (error: unknown) {\n\t\t\t\texecutionError = new NodeOperationError(this.getNode(), error as ExecutionError);\n\t\t\t\tresponse = `There was an error: \"${executionError.message}\"`;\n\t\t\t}\n\n\t\t\tif (typeof response === 'number') {\n\t\t\t\tresponse = (response as number).toString();\n\t\t\t}\n\n\t\t\tif (typeof response !== 'string') {\n\t\t\t\t// TODO: Do some more testing. Issues here should actually fail the workflow\n\t\t\t\texecutionError = new NodeOperationError(this.getNode(), 'Wrong output type returned', {\n\t\t\t\t\tdescription: `The response property should be a string, but it is an ${typeof response}`,\n\t\t\t\t});\n\t\t\t\tresponse = `There was an error: \"${executionError.message}\"`;\n\t\t\t}\n\n\t\t\tif (executionError) {\n\t\t\t\tvoid this.addOutputData(NodeConnectionTypes.AiTool, index, executionError);\n\t\t\t} else {\n\t\t\t\tvoid this.addOutputData(NodeConnectionTypes.AiTool, index, [[{ json: { response } }]]);\n\t\t\t}\n\n\t\t\treturn response;\n\t\t};\n\n\t\tconst commonToolOptions = {\n\t\t\tname,\n\t\t\tdescription,\n\t\t\tfunc: toolHandler,\n\t\t};\n\n\t\tlet tool: DynamicTool | DynamicStructuredTool | undefined = undefined;\n\n\t\tif (useSchema) {\n\t\t\ttry {\n\t\t\t\t// We initialize these even though one of them will always be empty\n\t\t\t\t// it makes it easier to navigate the ternary operator\n\t\t\t\tconst jsonExample = this.getNodeParameter('jsonSchemaExample', itemIndex, '') as string;\n\t\t\t\tconst inputSchema = this.getNodeParameter('inputSchema', itemIndex, '') as string;\n\n\t\t\t\tconst schemaType = this.getNodeParameter('schemaType', itemIndex) as 'fromJson' | 'manual';\n\t\t\t\tconst jsonSchema =\n\t\t\t\t\tschemaType === 'fromJson'\n\t\t\t\t\t\t? generateSchema(jsonExample)\n\t\t\t\t\t\t: jsonParse<JSONSchema7>(inputSchema);\n\n\t\t\t\tconst zodSchema = convertJsonSchemaToZod<DynamicZodObject>(jsonSchema);\n\n\t\t\t\ttool = new DynamicStructuredTool({\n\t\t\t\t\tschema: zodSchema,\n\t\t\t\t\t...commonToolOptions,\n\t\t\t\t});\n\t\t\t} catch (error) {\n\t\t\t\tthrow new NodeOperationError(\n\t\t\t\t\tthis.getNode(),\n\t\t\t\t\t'Error during parsing of JSON Schema. \\n ' + error,\n\t\t\t\t);\n\t\t\t}\n\t\t} else {\n\t\t\ttool = new DynamicTool(commonToolOptions);\n\t\t}\n\n\t\treturn {\n\t\t\tresponse: tool,\n\t\t};\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAmD;AAEnD,+BAAkC;AAClC,2BAA8B;AAE9B,qBAAkC;AASlC,0BAAmE;AAEnE,0BAIO;AACP,2BAAuD;AACvD,0BAA6C;AAItC,MAAM,SAA8B;AAAA,EAApC;AACN,uBAAoC;AAAA,MACnC,aAAa;AAAA,MACb,MAAM;AAAA,MACN,MAAM;AAAA,MACN,WAAW;AAAA,MACX,OAAO,CAAC,WAAW;AAAA,MACnB,SAAS,CAAC,GAAG,GAAG;AAAA,MAChB,aAAa;AAAA,MACb,UAAU;AAAA,QACT,MAAM;AAAA,MACP;AAAA,MACA,OAAO;AAAA,QACN,YAAY,CAAC,IAAI;AAAA,QACjB,eAAe;AAAA,UACd,IAAI,CAAC,OAAO;AAAA,UACZ,OAAO,CAAC,mBAAmB;AAAA,QAC5B;AAAA,QACA,WA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AO,aAAa,UAAU;AAEjC,yBAAiB,IAAI,uCAAmB,KAAK,QAAQ,GAAG,8BAA8B;AAAA,UACrF,aAAa,0DAA0D,OAAO,QAAQ;AAAA,QACvF,CAAC;AACD,mBAAW,wBAAwB,eAAe,OAAO;AAAA,MAC1D;AAEA,UAAI,gBAAgB;AACnB,aAAK,KAAK,cAAc,wCAAoB,QAAQ,OAAO,cAAc;AAAA,MAC1E,OAAO;AACN,aAAK,KAAK,cAAc,wCAAoB,QAAQ,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;AAAA,MACtF;AAEA,aAAO;AAAA,IACR;AAEA,UAAM,oBAAoB;AAAA,MACzB;AAAA,MACA;AAAA,MACA,MAAM;AAAA,IACP;AAEA,QAAI,OAAwD;AAE5D,QAAI,WAAW;AACd,UAAI;AAGH,cAAM,cAAc,KAAK,iBAAiB,qBAAqB,WAAW,EAAE;AAC5E,cAAM,cAAc,KAAK,iBAAiB,eAAe,WAAW,EAAE;AAEtE,cAAM,aAAa,KAAK,iBAAiB,cAAc,SAAS;AAChE,cAAM,aACL,eAAe,iBACZ,qCAAe,WAAW,QAC1B,+BAAuB,WAAW;AAEtC,cAAM,gBAAY,6CAAyC,UAAU;AAErE,eAAO,IAAI,mCAAsB;AAAA,UAChC,QAAQ;AAAA,UACR,GAAG;AAAA,QACJ,CAAC;AAAA,MACF,SAAS,OAAO;AACf,cAAM,IAAI;AAAA,UACT,KAAK,QAAQ;AAAA,UACb,6CAA6C;AAAA,QAC9C;AAAA,MACD;AAAA,IACD,OAAO;AACN,aAAO,IAAI,yBAAY,iBAAiB;AAAA,IACzC;AAEA,WAAO;AAAA,MACN,UAAU;AAAA,IACX;AAAA,EACD;AACD;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../nodes/tools/ToolHttpRequest/ToolHttpRequest.node.ts"],"sourcesContent":["/* eslint-disable n8n-nodes-base/node-dirname-against-convention */\nimport { DynamicTool } from '@langchain/core/tools';\nimport type {\n\tINodeType,\n\tINodeTypeDescription,\n\tISupplyDataFunctions,\n\tSupplyData,\n\tIHttpRequestMethods,\n\tIHttpRequestOptions,\n} from 'n8n-workflow';\nimport {\n\tNodeConnectionTypes,\n\tNodeOperationError,\n\ttryToParseAlphanumericString,\n} from 'n8n-workflow';\n\nimport { N8nTool } from '@utils/N8nTool';\nimport { getConnectionHintNoticeField } from '@utils/sharedFields';\n\nimport {\n\tauthenticationProperties,\n\tjsonInput,\n\toptimizeResponseProperties,\n\tparametersCollection,\n\tplaceholderDefinitionsCollection,\n\tspecifyBySelector,\n} from './descriptions';\nimport type { PlaceholderDefinition, ToolParameter } from './interfaces';\nimport {\n\tconfigureHttpRequestFunction,\n\tconfigureResponseOptimizer,\n\textractParametersFromText,\n\tprepareToolDescription,\n\tconfigureToolFunction,\n\tupdateParametersAndOptions,\n\tmakeToolInputSchema,\n} from './utils';\n\nexport class ToolHttpRequest implements INodeType {\n\tdescription: INodeTypeDescription = {\n\t\tdisplayName: 'HTTP Request Tool',\n\t\tname: 'toolHttpRequest',\n\t\ticon: { light: 'file:httprequest.svg', dark: 'file:httprequest.dark.svg' },\n\t\tgroup: ['output'],\n\t\tversion: [1, 1.1],\n\t\tdescription: 'Makes an HTTP request and returns the response data',\n\t\tsubtitle: '={{ $parameter.toolDescription }}',\n\t\tdefaults: {\n\t\t\tname: 'HTTP Request',\n\t\t},\n\t\tcredentials: [],\n\t\tcodex: {\n\t\t\tcategories: ['AI'],\n\t\t\tsubcategories: {\n\t\t\t\tAI: ['Tools'],\n\t\t\t\tTools: ['Recommended Tools'],\n\t\t\t},\n\t\t\tresources: {\n\t\t\t\tprimaryDocumentation: [\n\t\t\t\t\t{\n\t\t\t\t\t\turl: 'https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.toolhttprequest/',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\t\t// eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node\n\t\tinputs: [],\n\t\t// eslint-disable-next-line n8n-nodes-base/node-class-description-outputs-wrong\n\t\toutputs: [NodeConnectionTypes.AiTool],\n\t\toutputNames: ['Tool'],\n\t\tproperties: [\n\t\t\tgetConnectionHintNoticeField([NodeConnectionTypes.AiAgent]),\n\t\t\t{\n\t\t\t\tdisplayName: 'Description',\n\t\t\t\tname: 'toolDescription',\n\t\t\t\ttype: 'string',\n\t\t\t\tdescription:\n\t\t\t\t\t'Explain to LLM what this tool does, better description would allow LLM to produce expected result',\n\t\t\t\tplaceholder: 'e.g. Get the current weather in the requested city',\n\t\t\t\tdefault: '',\n\t\t\t\ttypeOptions: {\n\t\t\t\t\trows: 3,\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Method',\n\t\t\t\tname: 'method',\n\t\t\t\ttype: 'options',\n\t\t\t\toptions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'DELETE',\n\t\t\t\t\t\tvalue: 'DELETE',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'GET',\n\t\t\t\t\t\tvalue: 'GET',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'PATCH',\n\t\t\t\t\t\tvalue: 'PATCH',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'POST',\n\t\t\t\t\t\tvalue: 'POST',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'PUT',\n\t\t\t\t\t\tvalue: 'PUT',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tdefault: 'GET',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName:\n\t\t\t\t\t'Tip: You can use a {placeholder} for any part of the request to be filled by the model. Provide more context about them in the placeholders section',\n\t\t\t\tname: 'placeholderNotice',\n\t\t\t\ttype: 'notice',\n\t\t\t\tdefault: '',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'URL',\n\t\t\t\tname: 'url',\n\t\t\t\ttype: 'string',\n\t\t\t\tdefault: '',\n\t\t\t\trequired: true,\n\t\t\t\tplaceholder: 'e.g. http://www.example.com/{path}',\n\t\t\t},\n\t\t\t...authenticationProperties,\n\t\t\t//----------------------------------------------------------------\n\t\t\t{\n\t\t\t\tdisplayName: 'Send Query Parameters',\n\t\t\t\tname: 'sendQuery',\n\t\t\t\ttype: 'boolean',\n\t\t\t\tdefault: false,\n\t\t\t\tnoDataExpression: true,\n\t\t\t\tdescription: 'Whether the request has query params or not',\n\t\t\t},\n\t\t\t{\n\t\t\t\t...specifyBySelector,\n\t\t\t\tdisplayName: 'Specify Query Parameters',\n\t\t\t\tname: 'specifyQuery',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tsendQuery: [true],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\t...parametersCollection,\n\t\t\t\tdisplayName: 'Query Parameters',\n\t\t\t\tname: 'parametersQuery',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tsendQuery: [true],\n\t\t\t\t\t\tspecifyQuery: ['keypair'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\t...jsonInput,\n\t\t\t\tname: 'jsonQuery',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tsendQuery: [true],\n\t\t\t\t\t\tspecifyQuery: ['json'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t//----------------------------------------------------------------\n\t\t\t{\n\t\t\t\tdisplayName: 'Send Headers',\n\t\t\t\tname: 'sendHeaders',\n\t\t\t\ttype: 'boolean',\n\t\t\t\tdefault: false,\n\t\t\t\tnoDataExpression: true,\n\t\t\t\tdescription: 'Whether the request has headers or not',\n\t\t\t},\n\t\t\t{\n\t\t\t\t...specifyBySelector,\n\t\t\t\tdisplayName: 'Specify Headers',\n\t\t\t\tname: 'specifyHeaders',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tsendHeaders: [true],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\t...parametersCollection,\n\t\t\t\tdisplayName: 'Header Parameters',\n\t\t\t\tname: 'parametersHeaders',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tsendHeaders: [true],\n\t\t\t\t\t\tspecifyHeaders: ['keypair'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\t...jsonInput,\n\t\t\t\tname: 'jsonHeaders',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tsendHeaders: [true],\n\t\t\t\t\t\tspecifyHeaders: ['json'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t//----------------------------------------------------------------\n\t\t\t{\n\t\t\t\tdisplayName: 'Send Body',\n\t\t\t\tname: 'sendBody',\n\t\t\t\ttype: 'boolean',\n\t\t\t\tdefault: false,\n\t\t\t\tnoDataExpression: true,\n\t\t\t\tdescription: 'Whether the request has body or not',\n\t\t\t},\n\t\t\t{\n\t\t\t\t...specifyBySelector,\n\t\t\t\tdisplayName: 'Specify Body',\n\t\t\t\tname: 'specifyBody',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tsendBody: [true],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\t...parametersCollection,\n\t\t\t\tdisplayName: 'Body Parameters',\n\t\t\t\tname: 'parametersBody',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tsendBody: [true],\n\t\t\t\t\t\tspecifyBody: ['keypair'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\t...jsonInput,\n\t\t\t\tname: 'jsonBody',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tsendBody: [true],\n\t\t\t\t\t\tspecifyBody: ['json'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t//----------------------------------------------------------------\n\t\t\tplaceholderDefinitionsCollection,\n\t\t\t...optimizeResponseProperties,\n\t\t],\n\t};\n\n\tasync supplyData(this: ISupplyDataFunctions, itemIndex: number): Promise<SupplyData> {\n\t\tconst name = this.getNode().name.replace(/ /g, '_');\n\t\ttry {\n\t\t\ttryToParseAlphanumericString(name);\n\t\t} catch (error) {\n\t\t\tthrow new NodeOperationError(\n\t\t\t\tthis.getNode(),\n\t\t\t\t'The name of this tool is not a valid alphanumeric string',\n\t\t\t\t{\n\t\t\t\t\titemIndex,\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t\"Only alphanumeric characters and underscores are allowed in the tool's name, and the name cannot start with a number\",\n\t\t\t\t},\n\t\t\t);\n\t\t}\n\n\t\tconst toolDescription = this.getNodeParameter('toolDescription', itemIndex) as string;\n\t\tconst sendQuery = this.getNodeParameter('sendQuery', itemIndex, false) as boolean;\n\t\tconst sendHeaders = this.getNodeParameter('sendHeaders', itemIndex, false) as boolean;\n\t\tconst sendBody = this.getNodeParameter('sendBody', itemIndex, false) as boolean;\n\n\t\tconst requestOptions: IHttpRequestOptions = {\n\t\t\tmethod: this.getNodeParameter('method', itemIndex, 'GET') as IHttpRequestMethods,\n\t\t\turl: this.getNodeParameter('url', itemIndex) as string,\n\t\t\tqs: {},\n\t\t\theaders: {\n\t\t\t\t// FIXME: This is a workaround to prevent the node from sending a default User-Agent (`n8n`) when the header is not set.\n\t\t\t\t// Needs to be replaced with a proper fix after NODE-1777 is resolved\n\t\t\t\t'User-Agent': undefined,\n\t\t\t},\n\t\t\tbody: {},\n\t\t\t// We will need a full response object later to extract the headers and check the response's content type.\n\t\t\treturnFullResponse: true,\n\t\t};\n\n\t\tconst authentication = this.getNodeParameter('authentication', itemIndex, 'none') as\n\t\t\t| 'predefinedCredentialType'\n\t\t\t| 'genericCredentialType'\n\t\t\t| 'none';\n\n\t\tif (authentication !== 'none') {\n\t\t\tconst domain = new URL(requestOptions.url).hostname;\n\t\t\tif (domain.includes('{') && domain.includes('}')) {\n\t\t\t\tthrow new NodeOperationError(\n\t\t\t\t\tthis.getNode(),\n\t\t\t\t\t\"Can't use a placeholder for the domain when using authentication\",\n\t\t\t\t\t{\n\t\t\t\t\t\titemIndex,\n\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t'This is for security reasons, to prevent the model accidentally sending your credentials to an unauthorized domain',\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tconst httpRequest = await configureHttpRequestFunction(this, authentication, itemIndex);\n\t\tconst optimizeResponse = configureResponseOptimizer(this, itemIndex);\n\n\t\tconst rawRequestOptions: { [key: string]: string } = {\n\t\t\tqs: '',\n\t\t\theaders: '',\n\t\t\tbody: '',\n\t\t};\n\n\t\tconst placeholdersDefinitions = (\n\t\t\tthis.getNodeParameter(\n\t\t\t\t'placeholderDefinitions.values',\n\t\t\t\titemIndex,\n\t\t\t\t[],\n\t\t\t) as PlaceholderDefinition[]\n\t\t).map((p) => {\n\t\t\tif (p.name.startsWith('{') && p.name.endsWith('}')) {\n\t\t\t\tp.name = p.name.slice(1, -1);\n\t\t\t}\n\t\t\treturn p;\n\t\t});\n\n\t\tconst toolParameters: ToolParameter[] = [];\n\n\t\ttoolParameters.push(\n\t\t\t...extractParametersFromText(placeholdersDefinitions, requestOptions.url, 'path'),\n\t\t);\n\n\t\tif (sendQuery) {\n\t\t\tupdateParametersAndOptions({\n\t\t\t\tctx: this,\n\t\t\t\titemIndex,\n\t\t\t\ttoolParameters,\n\t\t\t\tplaceholdersDefinitions,\n\t\t\t\trequestOptions,\n\t\t\t\trawRequestOptions,\n\t\t\t\trequestOptionsProperty: 'qs',\n\t\t\t\tinputTypePropertyName: 'specifyQuery',\n\t\t\t\tjsonPropertyName: 'jsonQuery',\n\t\t\t\tparametersPropertyName: 'parametersQuery.values',\n\t\t\t});\n\t\t}\n\n\t\tif (sendHeaders) {\n\t\t\tupdateParametersAndOptions({\n\t\t\t\tctx: this,\n\t\t\t\titemIndex,\n\t\t\t\ttoolParameters,\n\t\t\t\tplaceholdersDefinitions,\n\t\t\t\trequestOptions,\n\t\t\t\trawRequestOptions,\n\t\t\t\trequestOptionsProperty: 'headers',\n\t\t\t\tinputTypePropertyName: 'specifyHeaders',\n\t\t\t\tjsonPropertyName: 'jsonHeaders',\n\t\t\t\tparametersPropertyName: 'parametersHeaders.values',\n\t\t\t});\n\t\t}\n\n\t\tif (sendBody) {\n\t\t\tupdateParametersAndOptions({\n\t\t\t\tctx: this,\n\t\t\t\titemIndex,\n\t\t\t\ttoolParameters,\n\t\t\t\tplaceholdersDefinitions,\n\t\t\t\trequestOptions,\n\t\t\t\trawRequestOptions,\n\t\t\t\trequestOptionsProperty: 'body',\n\t\t\t\tinputTypePropertyName: 'specifyBody',\n\t\t\t\tjsonPropertyName: 'jsonBody',\n\t\t\t\tparametersPropertyName: 'parametersBody.values',\n\t\t\t});\n\t\t}\n\n\t\tfor (const placeholder of placeholdersDefinitions) {\n\t\t\tif (!toolParameters.find((parameter) => parameter.name === placeholder.name)) {\n\t\t\t\tthrow new NodeOperationError(\n\t\t\t\t\tthis.getNode(),\n\t\t\t\t\t`Misconfigured placeholder '${placeholder.name}'`,\n\t\t\t\t\t{\n\t\t\t\t\t\titemIndex,\n\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\"This placeholder is defined in the 'Placeholder Definitions' but isn't used anywhere. Either remove the definition, or add the placeholder to a part of the request.\",\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tconst func = configureToolFunction(\n\t\t\tthis,\n\t\t\titemIndex,\n\t\t\ttoolParameters,\n\t\t\trequestOptions,\n\t\t\trawRequestOptions,\n\t\t\thttpRequest,\n\t\t\toptimizeResponse,\n\t\t);\n\n\t\tlet tool: DynamicTool | N8nTool;\n\n\t\t// If the node version is 1.1 or higher, we use the N8nTool wrapper:\n\t\t// it allows to use tool as a DynamicStructuredTool and have a fallback to DynamicTool\n\t\tif (this.getNode().typeVersion >= 1.1) {\n\t\t\tconst schema = makeToolInputSchema(toolParameters);\n\n\t\t\ttool = new N8nTool(this, {\n\t\t\t\tname,\n\t\t\t\tdescription: toolDescription,\n\t\t\t\tfunc,\n\t\t\t\tschema,\n\t\t\t});\n\t\t} else {\n\t\t\t// Keep the old behavior for nodes with version 1.0\n\t\t\tconst description = prepareToolDescription(toolDescription, toolParameters);\n\t\t\ttool = new DynamicTool({ name, description, func });\n\t\t}\n\n\t\treturn {\n\t\t\tresponse: tool,\n\t\t};\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAA4B;AAS5B,0BAIO;AAEP,qBAAwB;AACxB,0BAA6C;AAE7C,0BAOO;AAEP,mBAQO;AAEA,MAAM,gBAAqC;AAAA,EAA3C;AACN,uBAAoC;AAAA,MACnC,aAAa;AAAA,MACb,MAAM;AAAA,MACN,MAAM,EAAE,OAAO,wBAAwB,MAAM,4BAA4B;AAAA,MACzE,OAAO,CAAC,QAAQ;AAAA,MAChB,SAAS,CAAC,GAAG,GAAG;AAAA,MAChB,aAAa;AAAA,MACb,UAAU;AAAA,MACV,UAAU;AAAA,QACT,MAAM;AAAA,MACP;AAAA,MACA,aAAa,CAAC;AAAA,MACd,OAAO;AAAA,QACN,YAAY,CAAC,IAAI;AAAA,QACjB,eAAe;AAAA,UACd,IAAI,CAAC,OAAO;AAAA,UACZ,OAAO,CAAC,mBAAmB;AAAA,QAC5B;AAAA,QACA,WAAW;AAAA,UACV,sBAAsB;AAAA,YACrB;AAAA,cACC,KAAK;AAAA,YACN;AAAA,UACD;AAAA,QACD;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A,QACA;AAAA,QACA,wBAAwB;AAAA,QACxB,uBAAuB;AAAA,QACvB,kBAAkB;AAAA,QAClB,wBAAwB;AAAA,MACzB,CAAC;AAAA,IACF;AAEA,QAAI,UAAU;AACb,mDAA2B;AAAA,QAC1B,KAAK;AAAA,QACL;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,wBAAwB;AAAA,QACxB,uBAAuB;AAAA,QACvB,kBAAkB;AAAA,QAClB,wBAAwB;AAAA,MACzB,CAAC;AAAA,IACF;AAEA,eAAW,eAAe,yBAAyB;AAClD,UAAI,CAAC,eAAe,KAAK,CAAC,cAAc,UAAU,SAAS,YAAY,IAAI,GAAG;AAC7E,cAAM,IAAI;AAAA,UACT,KAAK,QAAQ;AAAA,UACb,8BAA8B,YAAY,IAAI;AAAA,UAC9C;AAAA,YACC;AAAA,YACA,aACC;AAAA,UACF;AAAA,QACD;AAAA,MACD;AAAA,IACD;AAEA,UAAM,WAAO;AAAA,MACZ;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACD;AAEA,QAAI;AAIJ,QAAI,KAAK,QAAQ,EAAE,eAAe,KAAK;AACtC,YAAM,aAAS,kCAAoB,cAAc;AAEjD,aAAO,IAAI,uBAAQ,MAAM;AAAA,QACxB;AAAA,QACA,aAAa;AAAA,QACb;AAAA,QACA;AAAA,MACD,CAAC;AAAA,IACF,OAAO;AAEN,YAAM,kBAAc,qCAAuB,iBAAiB,cAAc;AAC1E,aAAO,IAAI,yBAAY,EAAE,MAAM,aAAa,KAAK,CAAC;AAAA,IACnD;AAEA,WAAO;AAAA,MACN,UAAU;AAAA,IACX;AAAA,EACD;AACD;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../nodes/tools/ToolHttpRequest/descriptions.ts"],"sourcesContent":["import type { INodeProperties } from 'n8n-workflow';\n\nexport const specifyBySelector: INodeProperties = {\n\tdisplayName: 'Specify By',\n\tname: 'specifyBy',\n\ttype: 'options',\n\toptions: [\n\t\t{\n\t\t\tname: 'Using Fields Below',\n\t\t\tvalue: 'keypair',\n\t\t},\n\t\t{\n\t\t\tname: 'Using JSON Below',\n\t\t\tvalue: 'json',\n\t\t},\n\t\t{\n\t\t\tname: 'Let Model Specify Entire Body',\n\t\t\tvalue: 'model',\n\t\t},\n\t],\n\tdefault: 'keypair',\n};\n\nexport const parametersCollection: INodeProperties = {\n\tdisplayName: 'Parameters',\n\tname: 'parameters',\n\ttype: 'fixedCollection',\n\ttypeOptions: {\n\t\tmultipleValues: true,\n\t},\n\tplaceholder: 'Add Parameter',\n\tdefault: {\n\t\tvalues: [\n\t\t\t{\n\t\t\t\tname: '',\n\t\t\t},\n\t\t],\n\t},\n\toptions: [\n\t\t{\n\t\t\tname: 'values',\n\t\t\tdisplayName: 'Values',\n\t\t\tvalues: [\n\t\t\t\t{\n\t\t\t\t\tdisplayName: 'Name',\n\t\t\t\t\tname: 'name',\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tdefault: '',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tdisplayName: 'Value Provided',\n\t\t\t\t\tname: 'valueProvider',\n\t\t\t\t\ttype: 'options',\n\t\t\t\t\toptions: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// eslint-disable-next-line n8n-nodes-base/node-param-display-name-miscased\n\t\t\t\t\t\t\tname: 'By Model (and is required)',\n\t\t\t\t\t\t\tvalue: 'modelRequired',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// eslint-disable-next-line n8n-nodes-base/node-param-display-name-miscased\n\t\t\t\t\t\t\tname: 'By Model (but is optional)',\n\t\t\t\t\t\t\tvalue: 'modelOptional',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tname: 'Using Field Below',\n\t\t\t\t\t\t\tvalue: 'fieldValue',\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\tdefault: 'modelRequired',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tdisplayName: 'Value',\n\t\t\t\t\tname: 'value',\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tdefault: '',\n\t\t\t\t\thint: 'Use a {placeholder} for any data to be filled in by the model',\n\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\tshow: {\n\t\t\t\t\t\t\tvalueProvider: ['fieldValue'],\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t],\n};\nexport const placeholderDefinitionsCollection: INodeProperties = {\n\tdisplayName: 'Placeholder Definitions',\n\tname: 'placeholderDefinitions',\n\ttype: 'fixedCollection',\n\ttypeOptions: {\n\t\tmultipleValues: true,\n\t},\n\tplaceholder: 'Add Definition',\n\tdefault: [],\n\toptions: [\n\t\t{\n\t\t\tname: 'values',\n\t\t\tdisplayName: 'Values',\n\t\t\tvalues: [\n\t\t\t\t{\n\t\t\t\t\tdisplayName: 'Placeholder Name',\n\t\t\t\t\tname: 'name',\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tdefault: '',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tdisplayName: 'Description',\n\t\t\t\t\tname: 'description',\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tdefault: '',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tdisplayName: 'Type',\n\t\t\t\t\tname: 'type',\n\t\t\t\t\ttype: 'options',\n\t\t\t\t\t// eslint-disable-next-line n8n-nodes-base/node-param-options-type-unsorted-items\n\t\t\t\t\toptions: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tname: 'Not Specified (Default)',\n\t\t\t\t\t\t\tvalue: 'not specified',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tname: 'String',\n\t\t\t\t\t\t\tvalue: 'string',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tname: 'Number',\n\t\t\t\t\t\t\tvalue: 'number',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tname: 'Boolean',\n\t\t\t\t\t\t\tvalue: 'boolean',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tname: 'JSON',\n\t\t\t\t\t\t\tvalue: 'json',\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\tdefault: 'not specified',\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t],\n};\n\nexport const jsonInput: INodeProperties = {\n\tdisplayName: 'JSON',\n\tname: 'json',\n\ttype: 'string',\n\ttypeOptions: {\n\t\trows: 5,\n\t},\n\thint: 'Use a {placeholder} for any data to be filled in by the model',\n\tdefault: '',\n};\n\nexport const authenticationProperties: INodeProperties[] = [\n\t{\n\t\tdisplayName: 'Authentication',\n\t\tname: 'authentication',\n\t\tdescription:\n\t\t\t'Select the type of authentication to use if needed, authentication would be done by n8n and your credentials will not be shared with the LLM',\n\t\tnoDataExpression: true,\n\t\ttype: 'options',\n\t\toptions: [\n\t\t\t{\n\t\t\t\tname: 'None',\n\t\t\t\tvalue: 'none',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'Predefined Credential Type',\n\t\t\t\tvalue: 'predefinedCredentialType',\n\t\t\t\tdescription:\n\t\t\t\t\t\"We've already implemented auth for many services so that you don't have to set it up manually\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'Generic Credential Type',\n\t\t\t\tvalue: 'genericCredentialType',\n\t\t\t\tdescription: 'Fully customizable. Choose between basic, header, OAuth2, etc.',\n\t\t\t},\n\t\t],\n\t\tdefault: 'none',\n\t},\n\t{\n\t\tdisplayName: 'Credential Type',\n\t\tname: 'nodeCredentialType',\n\t\ttype: 'credentialsSelect',\n\t\tnoDataExpression: true,\n\t\trequired: true,\n\t\tdefault: '',\n\t\tcredentialTypes: ['extends:oAuth2Api', 'extends:oAuth1Api', 'has:authenticate'],\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\tauthentication: ['predefinedCredentialType'],\n\t\t\t},\n\t\t},\n\t},\n\t{\n\t\tdisplayName:\n\t\t\t'Make sure you have specified the scope(s) for the Service Account in the credential',\n\t\tname: 'googleApiWarning',\n\t\ttype: 'notice',\n\t\tdefault: '',\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\tnodeCredentialType: ['googleApi'],\n\t\t\t},\n\t\t},\n\t},\n\t{\n\t\tdisplayName: 'Generic Auth Type',\n\t\tname: 'genericAuthType',\n\t\ttype: 'credentialsSelect',\n\t\trequired: true,\n\t\tdefault: '',\n\t\tcredentialTypes: ['has:genericAuth'],\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\tauthentication: ['genericCredentialType'],\n\t\t\t},\n\t\t},\n\t},\n];\n\nexport const optimizeResponseProperties: INodeProperties[] = [\n\t{\n\t\tdisplayName: 'Optimize Response',\n\t\tname: 'optimizeResponse',\n\t\ttype: 'boolean',\n\t\tdefault: false,\n\t\tnoDataExpression: true,\n\t\tdescription:\n\t\t\t'Whether the optimize the tool response to reduce amount of data passed to the LLM that could lead to better result and reduce cost',\n\t},\n\t{\n\t\tdisplayName: 'Expected Response Type',\n\t\tname: 'responseType',\n\t\ttype: 'options',\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\toptimizeResponse: [true],\n\t\t\t},\n\t\t},\n\t\toptions: [\n\t\t\t{\n\t\t\t\tname: 'JSON',\n\t\t\t\tvalue: 'json',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'HTML',\n\t\t\t\tvalue: 'html',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'Text',\n\t\t\t\tvalue: 'text',\n\t\t\t},\n\t\t],\n\t\tdefault: 'json',\n\t},\n\t{\n\t\tdisplayName: 'Field Containing Data',\n\t\tname: 'dataField',\n\t\ttype: 'string',\n\t\tdefault: '',\n\t\tplaceholder: 'e.g. records',\n\t\tdescription: 'Specify the name of the field in the response containing the data',\n\t\thint: 'leave blank to use whole response',\n\t\trequiresDataPath: 'single',\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\toptimizeResponse: [true],\n\t\t\t\tresponseType: ['json'],\n\t\t\t},\n\t\t},\n\t},\n\t{\n\t\tdisplayName: 'Include Fields',\n\t\tname: 'fieldsToInclude',\n\t\ttype: 'options',\n\t\tdescription: 'What fields response object should include',\n\t\tdefault: 'all',\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\toptimizeResponse: [true],\n\t\t\t\tresponseType: ['json'],\n\t\t\t},\n\t\t},\n\t\toptions: [\n\t\t\t{\n\t\t\t\tname: 'All',\n\t\t\t\tvalue: 'all',\n\t\t\t\tdescription: 'Include all fields',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'Selected',\n\t\t\t\tvalue: 'selected',\n\t\t\t\tdescription: 'Include only fields specified below',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'Except',\n\t\t\t\tvalue: 'except',\n\t\t\t\tdescription: 'Exclude fields specified below',\n\t\t\t},\n\t\t],\n\t},\n\t{\n\t\tdisplayName: 'Fields',\n\t\tname: 'fields',\n\t\ttype: 'string',\n\t\tdefault: '',\n\t\tplaceholder: 'e.g. field1,field2',\n\t\tdescription:\n\t\t\t'Comma-separated list of the field names. Supports dot notation. You can drag the selected fields from the input panel.',\n\t\trequiresDataPath: 'multiple',\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\toptimizeResponse: [true],\n\t\t\t\tresponseType: ['json'],\n\t\t\t},\n\t\t\thide: {\n\t\t\t\tfieldsToInclude: ['all'],\n\t\t\t},\n\t\t},\n\t},\n\t{\n\t\tdisplayName: 'Selector (CSS)',\n\t\tname: 'cssSelector',\n\t\ttype: 'string',\n\t\tdescription:\n\t\t\t'Select specific element(e.g. body) or multiple elements(e.g. div) of chosen type in the response HTML.',\n\t\tplaceholder: 'e.g. body',\n\t\tdefault: 'body',\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\toptimizeResponse: [true],\n\t\t\t\tresponseType: ['html'],\n\t\t\t},\n\t\t},\n\t},\n\t{\n\t\tdisplayName: 'Return Only Content',\n\t\tname: 'onlyContent',\n\t\ttype: 'boolean',\n\t\tdefault: false,\n\t\tdescription:\n\t\t\t'Whether to return only content of html elements, stripping html tags and attributes',\n\t\thint: 'Uses less tokens and may be easier for model to understand',\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\toptimizeResponse: [true],\n\t\t\t\tresponseType: ['html'],\n\t\t\t},\n\t\t},\n\t},\n\t{\n\t\tdisplayName: 'Elements To Omit',\n\t\tname: 'elementsToOmit',\n\t\ttype: 'string',\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\toptimizeResponse: [true],\n\t\t\t\tresponseType: ['html'],\n\t\t\t\tonlyContent: [true],\n\t\t\t},\n\t\t},\n\t\tdefault: '',\n\t\tplaceholder: 'e.g. img, .className, #ItemId',\n\t\tdescription: 'Comma-separated list of selectors that would be excluded when extracting content',\n\t},\n\t{\n\t\tdisplayName: 'Truncate Response',\n\t\tname: 'truncateResponse',\n\t\ttype: 'boolean',\n\t\tdefault: false,\n\t\thint: 'Helps save tokens',\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\toptimizeResponse: [true],\n\t\t\t\tresponseType: ['text', 'html'],\n\t\t\t},\n\t\t},\n\t},\n\t{\n\t\tdisplayName: 'Max Response Characters',\n\t\tname: 'maxLength',\n\t\ttype: 'number',\n\t\tdefault: 1000,\n\t\ttypeOptions: {\n\t\t\tminValue: 1,\n\t\t},\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\toptimizeResponse: [true],\n\t\t\t\tresponseType: ['text', 'html'],\n\t\t\t\ttruncateResponse: [true],\n\t\t\t},\n\t\t},\n\t},\n];\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAA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;AAAA,MACxB;AAAA,IACD;AAAA,EACD;AACD;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../nodes/tools/ToolHttpRequest/interfaces.ts"],"sourcesContent":["export type ToolParameter = {\n\tname: string;\n\trequired: boolean;\n\ttype?: string;\n\tdescription?: string;\n\tsendIn: SendIn;\n\tkey?: string;\n};\n\nexport type PlaceholderDefinition = {\n\tname: string;\n\ttype?: string;\n\tdescription: string;\n};\n\nexport type ParametersValues = Array<{\n\tname: string;\n\tvalueProvider: 'modelRequired' | 'modelOptional' | 'fieldValue';\n\tvalue?: string;\n}>;\n\nexport type ParameterInputType = 'keypair' | 'json' | 'model';\nexport type SendIn = 'body' | 'qs' | 'path' | 'headers';\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
@@ -102,7 +102,7 @@ const genericCredentialRequest = async (ctx, itemIndex) => {
|
|
|
102
102
|
}
|
|
103
103
|
if (genericType === "oAuth2Api") {
|
|
104
104
|
return async (options) => {
|
|
105
|
-
return await ctx.helpers.requestOAuth2.call(ctx, "
|
|
105
|
+
return await ctx.helpers.requestOAuth2.call(ctx, "oAuth2Api", options, {
|
|
106
106
|
tokenType: "Bearer"
|
|
107
107
|
});
|
|
108
108
|
};
|
|
@@ -596,7 +596,7 @@ const configureToolFunction = (ctx, itemIndex, toolParameters, requestOptions, r
|
|
|
596
596
|
if (fullResponse.body && isBinary(fullResponse.body)) {
|
|
597
597
|
throw new import_n8n_workflow.NodeOperationError(ctx.getNode(), "Binary data is not supported");
|
|
598
598
|
}
|
|
599
|
-
response = optimizeResponse(fullResponse.body);
|
|
599
|
+
response = optimizeResponse(fullResponse.body ?? fullResponse);
|
|
600
600
|
} catch (error) {
|
|
601
601
|
response = `There was an error: "${error.message}"`;
|
|
602
602
|
}
|
|
@@ -654,3 +654,4 @@ function makeToolInputSchema(parameters) {
|
|
|
654
654
|
prepareToolDescription,
|
|
655
655
|
updateParametersAndOptions
|
|
656
656
|
});
|
|
657
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../nodes/tools/ToolHttpRequest/utils.ts"],"sourcesContent":["import { Readability } from '@mozilla/readability';\nimport * as cheerio from 'cheerio';\nimport { convert } from 'html-to-text';\nimport { JSDOM } from 'jsdom';\nimport get from 'lodash/get';\nimport set from 'lodash/set';\nimport unset from 'lodash/unset';\nimport { getOAuth2AdditionalParameters } from 'n8n-nodes-base/dist/nodes/HttpRequest/GenericFunctions';\nimport type {\n\tIDataObject,\n\tIHttpRequestOptions,\n\tIRequestOptionsSimplified,\n\tExecutionError,\n\tNodeApiError,\n\tISupplyDataFunctions,\n} from 'n8n-workflow';\nimport { NodeConnectionTypes, NodeOperationError, jsonParse } from 'n8n-workflow';\nimport { z } from 'zod';\n\nimport type {\n\tParameterInputType,\n\tParametersValues,\n\tPlaceholderDefinition,\n\tParametersValues as RawParametersValues,\n\tSendIn,\n\tToolParameter,\n} from './interfaces';\nimport type { DynamicZodObject } from '../../../types/zod.types';\n\nconst genericCredentialRequest = async (ctx: ISupplyDataFunctions, itemIndex: number) => {\n\tconst genericType = ctx.getNodeParameter('genericAuthType', itemIndex) as string;\n\n\tif (genericType === 'httpBasicAuth' || genericType === 'httpDigestAuth') {\n\t\tconst basicAuth = await ctx.getCredentials('httpBasicAuth', itemIndex);\n\t\tconst sendImmediately = genericType === 'httpDigestAuth' ? false : undefined;\n\n\t\treturn async (options: IHttpRequestOptions) => {\n\t\t\toptions.auth = {\n\t\t\t\tusername: basicAuth.user as string,\n\t\t\t\tpassword: basicAuth.password as string,\n\t\t\t\tsendImmediately,\n\t\t\t};\n\t\t\treturn await ctx.helpers.httpRequest(options);\n\t\t};\n\t}\n\n\tif (genericType === 'httpHeaderAuth') {\n\t\tconst headerAuth = await ctx.getCredentials('httpHeaderAuth', itemIndex);\n\n\t\treturn async (options: IHttpRequestOptions) => {\n\t\t\tif (!options.headers) options.headers = {};\n\t\t\toptions.headers[headerAuth.name as string] = headerAuth.value;\n\t\t\treturn await ctx.helpers.httpRequest(options);\n\t\t};\n\t}\n\n\tif (genericType === 'httpQueryAuth') {\n\t\tconst queryAuth = await ctx.getCredentials('httpQueryAuth', itemIndex);\n\n\t\treturn async (options: IHttpRequestOptions) => {\n\t\t\tif (!options.qs) options.qs = {};\n\t\t\toptions.qs[queryAuth.name as string] = queryAuth.value;\n\t\t\treturn await ctx.helpers.httpRequest(options);\n\t\t};\n\t}\n\n\tif (genericType === 'httpCustomAuth') {\n\t\tconst customAuth = await ctx.getCredentials('httpCustomAuth', itemIndex);\n\n\t\treturn async (options: IHttpRequestOptions) => {\n\t\t\tconst auth = jsonParse<IRequestOptionsSimplified>((customAuth.json as string) || '{}', {\n\t\t\t\terrorMessage: 'Invalid Custom Auth JSON',\n\t\t\t});\n\t\t\tif (auth.headers) {\n\t\t\t\toptions.headers = { ...options.headers, ...auth.headers };\n\t\t\t}\n\t\t\tif (auth.body) {\n\t\t\t\toptions.body = { ...(options.body as IDataObject), ...auth.body };\n\t\t\t}\n\t\t\tif (auth.qs) {\n\t\t\t\toptions.qs = { ...options.qs, ...auth.qs };\n\t\t\t}\n\t\t\treturn await ctx.helpers.httpRequest(options);\n\t\t};\n\t}\n\n\tif (genericType === 'oAuth1Api') {\n\t\treturn async (options: IHttpRequestOptions) => {\n\t\t\treturn await ctx.helpers.requestOAuth1.call(ctx, 'oAuth1Api', options);\n\t\t};\n\t}\n\n\tif (genericType === 'oAuth2Api') {\n\t\treturn async (options: IHttpRequestOptions) => {\n\t\t\treturn await ctx.helpers.requestOAuth2.call(ctx, 'oAuth2Api', options, {\n\t\t\t\ttokenType: 'Bearer',\n\t\t\t});\n\t\t};\n\t}\n\n\tthrow new NodeOperationError(ctx.getNode(), `The type ${genericType} is not supported`, {\n\t\titemIndex,\n\t});\n};\n\nconst predefinedCredentialRequest = async (ctx: ISupplyDataFunctions, itemIndex: number) => {\n\tconst predefinedType = ctx.getNodeParameter('nodeCredentialType', itemIndex) as string;\n\tconst additionalOptions = getOAuth2AdditionalParameters(predefinedType);\n\n\treturn async (options: IHttpRequestOptions) => {\n\t\treturn await ctx.helpers.httpRequestWithAuthentication.call(\n\t\t\tctx,\n\t\t\tpredefinedType,\n\t\t\toptions,\n\t\t\tadditionalOptions && { oauth2: additionalOptions },\n\t\t);\n\t};\n};\n\nexport const configureHttpRequestFunction = async (\n\tctx: ISupplyDataFunctions,\n\tcredentialsType: 'predefinedCredentialType' | 'genericCredentialType' | 'none',\n\titemIndex: number,\n) => {\n\tswitch (credentialsType) {\n\t\tcase 'genericCredentialType':\n\t\t\treturn await genericCredentialRequest(ctx, itemIndex);\n\t\tcase 'predefinedCredentialType':\n\t\t\treturn await predefinedCredentialRequest(ctx, itemIndex);\n\t\tdefault:\n\t\t\treturn async (options: IHttpRequestOptions) => {\n\t\t\t\treturn await ctx.helpers.httpRequest(options);\n\t\t\t};\n\t}\n};\n\nconst defaultOptimizer = <T>(response: T) => {\n\tif (typeof response === 'string') {\n\t\treturn response;\n\t}\n\tif (typeof response === 'object') {\n\t\treturn JSON.stringify(response, null, 2);\n\t}\n\n\treturn String(response);\n};\n\nfunction isBinary(data: unknown) {\n\t// Check if data is a Buffer\n\tif (Buffer.isBuffer(data)) {\n\t\treturn true;\n\t}\n\n\t// If data is a string, assume it's text unless it contains null characters.\n\tif (typeof data === 'string') {\n\t\t// If the string contains a null character, it's likely binary.\n\t\tif (data.includes('\\0')) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\t// For any other type, assume it's not binary.\n\treturn false;\n}\n\nconst htmlOptimizer = (ctx: ISupplyDataFunctions, itemIndex: number, maxLength: number) => {\n\tconst cssSelector = ctx.getNodeParameter('cssSelector', itemIndex, '') as string;\n\tconst onlyContent = ctx.getNodeParameter('onlyContent', itemIndex, false) as boolean;\n\tlet elementsToOmit: string[] = [];\n\n\tif (onlyContent) {\n\t\tconst elementsToOmitUi = ctx.getNodeParameter('elementsToOmit', itemIndex, '') as\n\t\t\t| string\n\t\t\t| string[];\n\n\t\tif (typeof elementsToOmitUi === 'string') {\n\t\t\telementsToOmit = elementsToOmitUi\n\t\t\t\t.split(',')\n\t\t\t\t.filter((s) => s)\n\t\t\t\t.map((s) => s.trim());\n\t\t}\n\t}\n\n\treturn <T>(response: T) => {\n\t\tif (typeof response !== 'string') {\n\t\t\tthrow new NodeOperationError(\n\t\t\t\tctx.getNode(),\n\t\t\t\t`The response type must be a string. Received: ${typeof response}`,\n\t\t\t\t{ itemIndex },\n\t\t\t);\n\t\t}\n\t\tconst returnData: string[] = [];\n\n\t\tconst html = cheerio.load(response);\n\t\tconst htmlElements = html(cssSelector);\n\n\t\thtmlElements.each((_, el) => {\n\t\t\tlet value = html(el).html() || '';\n\n\t\t\tif (onlyContent) {\n\t\t\t\tlet htmlToTextOptions;\n\n\t\t\t\tif (elementsToOmit?.length) {\n\t\t\t\t\thtmlToTextOptions = {\n\t\t\t\t\t\tselectors: elementsToOmit.map((selector) => ({\n\t\t\t\t\t\t\tselector,\n\t\t\t\t\t\t\tformat: 'skip',\n\t\t\t\t\t\t})),\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tvalue = convert(value, htmlToTextOptions);\n\t\t\t}\n\n\t\t\tvalue = value\n\t\t\t\t.trim()\n\t\t\t\t.replace(/^\\s+|\\s+$/g, '')\n\t\t\t\t.replace(/(\\r\\n|\\n|\\r)/gm, '')\n\t\t\t\t.replace(/\\s+/g, ' ');\n\n\t\t\treturnData.push(value);\n\t\t});\n\n\t\tconst text = JSON.stringify(returnData, null, 2);\n\n\t\tif (maxLength > 0 && text.length > maxLength) {\n\t\t\treturn text.substring(0, maxLength);\n\t\t}\n\n\t\treturn text;\n\t};\n};\n\nconst textOptimizer = (ctx: ISupplyDataFunctions, itemIndex: number, maxLength: number) => {\n\treturn (response: string | IDataObject) => {\n\t\tif (typeof response === 'object') {\n\t\t\ttry {\n\t\t\t\tresponse = JSON.stringify(response, null, 2);\n\t\t\t} catch (error) {}\n\t\t}\n\n\t\tif (typeof response !== 'string') {\n\t\t\tthrow new NodeOperationError(\n\t\t\t\tctx.getNode(),\n\t\t\t\t`The response type must be a string. Received: ${typeof response}`,\n\t\t\t\t{ itemIndex },\n\t\t\t);\n\t\t}\n\n\t\tconst dom = new JSDOM(response);\n\t\tconst article = new Readability(dom.window.document, {\n\t\t\tkeepClasses: true,\n\t\t}).parse();\n\n\t\tconst text = article?.textContent || '';\n\n\t\tif (maxLength > 0 && text.length > maxLength) {\n\t\t\treturn text.substring(0, maxLength);\n\t\t}\n\n\t\treturn text;\n\t};\n};\n\nconst jsonOptimizer = (ctx: ISupplyDataFunctions, itemIndex: number) => {\n\treturn (response: string): string => {\n\t\tlet responseData: IDataObject | IDataObject[] | string = response;\n\n\t\tif (typeof responseData === 'string') {\n\t\t\tresponseData = jsonParse(response);\n\t\t}\n\n\t\tif (typeof responseData !== 'object' || !responseData) {\n\t\t\tthrow new NodeOperationError(\n\t\t\t\tctx.getNode(),\n\t\t\t\t'The response type must be an object or an array of objects',\n\t\t\t\t{ itemIndex },\n\t\t\t);\n\t\t}\n\n\t\tconst dataField = ctx.getNodeParameter('dataField', itemIndex, '') as string;\n\t\tlet returnData: IDataObject[] = [];\n\n\t\tif (!Array.isArray(responseData)) {\n\t\t\tif (dataField) {\n\t\t\t\tconst data = responseData[dataField] as IDataObject | IDataObject[];\n\t\t\t\tif (Array.isArray(data)) {\n\t\t\t\t\tresponseData = data;\n\t\t\t\t} else {\n\t\t\t\t\tresponseData = [data];\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tresponseData = [responseData];\n\t\t\t}\n\t\t} else {\n\t\t\tif (dataField) {\n\t\t\t\tresponseData = responseData.map((data) => data[dataField]) as IDataObject[];\n\t\t\t}\n\t\t}\n\n\t\tconst fieldsToInclude = ctx.getNodeParameter('fieldsToInclude', itemIndex, 'all') as\n\t\t\t| 'all'\n\t\t\t| 'selected'\n\t\t\t| 'except';\n\n\t\tlet fields: string | string[] = [];\n\n\t\tif (fieldsToInclude !== 'all') {\n\t\t\tfields = ctx.getNodeParameter('fields', itemIndex, []) as string[] | string;\n\n\t\t\tif (typeof fields === 'string') {\n\t\t\t\tfields = fields.split(',').map((field) => field.trim());\n\t\t\t}\n\t\t} else {\n\t\t\treturnData = responseData;\n\t\t}\n\n\t\tif (fieldsToInclude === 'selected') {\n\t\t\tfor (const item of responseData) {\n\t\t\t\tconst newItem: IDataObject = {};\n\n\t\t\t\tfor (const field of fields) {\n\t\t\t\t\tset(newItem, field, get(item, field));\n\t\t\t\t}\n\n\t\t\t\treturnData.push(newItem);\n\t\t\t}\n\t\t}\n\n\t\tif (fieldsToInclude === 'except') {\n\t\t\tfor (const item of responseData) {\n\t\t\t\tfor (const field of fields) {\n\t\t\t\t\tunset(item, field);\n\t\t\t\t}\n\n\t\t\t\treturnData.push(item);\n\t\t\t}\n\t\t}\n\n\t\treturn JSON.stringify(returnData, null, 2);\n\t};\n};\n\nexport const configureResponseOptimizer = (ctx: ISupplyDataFunctions, itemIndex: number) => {\n\tconst optimizeResponse = ctx.getNodeParameter('optimizeResponse', itemIndex, false) as boolean;\n\n\tif (optimizeResponse) {\n\t\tconst responseType = ctx.getNodeParameter('responseType', itemIndex) as\n\t\t\t| 'json'\n\t\t\t| 'text'\n\t\t\t| 'html';\n\n\t\tlet maxLength = 0;\n\t\tconst truncateResponse = ctx.getNodeParameter('truncateResponse', itemIndex, false) as boolean;\n\n\t\tif (truncateResponse) {\n\t\t\tmaxLength = ctx.getNodeParameter('maxLength', itemIndex, 0) as number;\n\t\t}\n\n\t\tswitch (responseType) {\n\t\t\tcase 'html':\n\t\t\t\treturn htmlOptimizer(ctx, itemIndex, maxLength);\n\t\t\tcase 'text':\n\t\t\t\treturn textOptimizer(ctx, itemIndex, maxLength);\n\t\t\tcase 'json':\n\t\t\t\treturn jsonOptimizer(ctx, itemIndex);\n\t\t}\n\t}\n\n\treturn defaultOptimizer;\n};\n\nconst extractPlaceholders = (text: string): string[] => {\n\tconst placeholder = /(\\{[a-zA-Z0-9_-]+\\})/g;\n\tconst returnData: string[] = [];\n\n\tconst matches = text.matchAll(placeholder);\n\n\tfor (const match of matches) {\n\t\treturnData.push(match[0].replace(/{|}/g, ''));\n\t}\n\n\treturn returnData;\n};\n\nexport const extractParametersFromText = (\n\tplaceholders: PlaceholderDefinition[],\n\ttext: string,\n\tsendIn: SendIn,\n\tkey?: string,\n): ToolParameter[] => {\n\tif (typeof text !== 'string') return [];\n\n\tconst parameters = extractPlaceholders(text);\n\n\tif (parameters.length) {\n\t\t// eslint-disable-next-line @typescript-eslint/no-use-before-define\n\t\tconst inputParameters = prepareParameters(\n\t\t\tparameters.map((name) => ({\n\t\t\t\tname,\n\t\t\t\tvalueProvider: 'modelRequired',\n\t\t\t})),\n\t\t\tplaceholders,\n\t\t\t'keypair',\n\t\t\tsendIn,\n\t\t\t'',\n\t\t);\n\n\t\treturn key\n\t\t\t? inputParameters.parameters.map((p) => ({ ...p, key }))\n\t\t\t: inputParameters.parameters;\n\t}\n\n\treturn [];\n};\n\nfunction prepareParameters(\n\trawParameters: RawParametersValues,\n\tplaceholders: PlaceholderDefinition[],\n\tparametersInputType: 'model' | 'keypair' | 'json',\n\tsendIn: SendIn,\n\tmodelInputDescription: string,\n\tjsonWithPlaceholders?: string,\n): { parameters: ToolParameter[]; values: IDataObject } {\n\tconst parameters: ToolParameter[] = [];\n\tconst values: IDataObject = {};\n\n\tif (parametersInputType === 'model') {\n\t\treturn {\n\t\t\tparameters: [\n\t\t\t\t{\n\t\t\t\t\tname: sendIn,\n\t\t\t\t\trequired: true,\n\t\t\t\t\ttype: 'json',\n\t\t\t\t\tdescription: modelInputDescription,\n\t\t\t\t\tsendIn,\n\t\t\t\t},\n\t\t\t],\n\t\t\tvalues: {},\n\t\t};\n\t}\n\n\tif (parametersInputType === 'keypair') {\n\t\tfor (const entry of rawParameters) {\n\t\t\tif (entry.valueProvider.includes('model')) {\n\t\t\t\tconst placeholder = placeholders.find((p) => p.name === entry.name);\n\n\t\t\t\tconst parameter: ToolParameter = {\n\t\t\t\t\tname: entry.name,\n\t\t\t\t\trequired: entry.valueProvider === 'modelRequired',\n\t\t\t\t\tsendIn,\n\t\t\t\t};\n\n\t\t\t\tif (placeholder) {\n\t\t\t\t\tparameter.type = placeholder.type;\n\t\t\t\t\tparameter.description = placeholder.description;\n\t\t\t\t}\n\n\t\t\t\tparameters.push(parameter);\n\t\t\t} else if (entry.value) {\n\t\t\t\t// if value has placeholders push them to parameters\n\t\t\t\tparameters.push(\n\t\t\t\t\t...extractParametersFromText(placeholders, entry.value, sendIn, entry.name),\n\t\t\t\t);\n\t\t\t\tvalues[entry.name] = entry.value; //push to user provided values\n\t\t\t}\n\t\t}\n\t}\n\n\tif (parametersInputType === 'json' && jsonWithPlaceholders) {\n\t\tparameters.push(\n\t\t\t...extractParametersFromText(placeholders, jsonWithPlaceholders, sendIn, `${sendIn + 'Raw'}`),\n\t\t);\n\t}\n\n\treturn {\n\t\tparameters,\n\t\tvalues,\n\t};\n}\n\nconst MODEL_INPUT_DESCRIPTION = {\n\tqs: 'Query parameters for request as key value pairs',\n\theaders: 'Headers parameters for request as key value pairs',\n\tbody: 'Body parameters for request as key value pairs',\n};\n\nexport const updateParametersAndOptions = (options: {\n\tctx: ISupplyDataFunctions;\n\titemIndex: number;\n\ttoolParameters: ToolParameter[];\n\tplaceholdersDefinitions: PlaceholderDefinition[];\n\trequestOptions: IHttpRequestOptions;\n\trawRequestOptions: { [key: string]: string };\n\trequestOptionsProperty: 'headers' | 'qs' | 'body';\n\tinputTypePropertyName: string;\n\tjsonPropertyName: string;\n\tparametersPropertyName: string;\n}) => {\n\tconst {\n\t\tctx,\n\t\titemIndex,\n\t\ttoolParameters,\n\t\tplaceholdersDefinitions,\n\t\trequestOptions,\n\t\trawRequestOptions,\n\t\trequestOptionsProperty,\n\t\tinputTypePropertyName,\n\t\tjsonPropertyName,\n\t\tparametersPropertyName,\n\t} = options;\n\n\tconst inputType = ctx.getNodeParameter(\n\t\tinputTypePropertyName,\n\t\titemIndex,\n\t\t'keypair',\n\t) as ParameterInputType;\n\n\tlet parametersValues: ParametersValues = [];\n\n\tif (inputType === 'json') {\n\t\trawRequestOptions[requestOptionsProperty] = ctx.getNodeParameter(\n\t\t\tjsonPropertyName,\n\t\t\titemIndex,\n\t\t\t'',\n\t\t) as string;\n\t} else {\n\t\tparametersValues = ctx.getNodeParameter(\n\t\t\tparametersPropertyName,\n\t\t\titemIndex,\n\t\t\t[],\n\t\t) as ParametersValues;\n\t}\n\n\tconst inputParameters = prepareParameters(\n\t\tparametersValues,\n\t\tplaceholdersDefinitions,\n\t\tinputType,\n\t\trequestOptionsProperty,\n\t\tMODEL_INPUT_DESCRIPTION[requestOptionsProperty],\n\t\trawRequestOptions[requestOptionsProperty],\n\t);\n\n\ttoolParameters.push(...inputParameters.parameters);\n\n\trequestOptions[requestOptionsProperty] = {\n\t\t...(requestOptions[requestOptionsProperty] as IDataObject),\n\t\t...inputParameters.values,\n\t};\n};\n\nconst getParametersDescription = (parameters: ToolParameter[]) =>\n\tparameters\n\t\t.map(\n\t\t\t(p) =>\n\t\t\t\t`${p.name}: (description: ${p.description ?? ''}, type: ${p.type ?? 'string'}, required: ${!!p.required})`,\n\t\t)\n\t\t.join(',\\n ');\n\nexport const prepareToolDescription = (\n\ttoolDescription: string,\n\ttoolParameters: ToolParameter[],\n) => {\n\tlet description = `${toolDescription}`;\n\n\tif (toolParameters.length) {\n\t\tdescription += `\n\tTool expects valid stringified JSON object with ${toolParameters.length} properties.\n\tProperty names with description, type and required status:\n\t${getParametersDescription(toolParameters)}\n\tALL parameters marked as required must be provided`;\n\t}\n\n\treturn description;\n};\n\nexport const configureToolFunction = (\n\tctx: ISupplyDataFunctions,\n\titemIndex: number,\n\ttoolParameters: ToolParameter[],\n\trequestOptions: IHttpRequestOptions,\n\trawRequestOptions: { [key: string]: string },\n\thttpRequest: (options: IHttpRequestOptions) => Promise<any>,\n\toptimizeResponse: (response: string) => string,\n) => {\n\treturn async (query: string | IDataObject): Promise<string> => {\n\t\tconst { index } = ctx.addInputData(NodeConnectionTypes.AiTool, [[{ json: { query } }]]);\n\n\t\t// Clone options and rawRequestOptions to avoid mutating the original objects\n\t\tconst options: IHttpRequestOptions | null = structuredClone(requestOptions);\n\t\tconst clonedRawRequestOptions: { [key: string]: string } = structuredClone(rawRequestOptions);\n\t\tlet fullResponse: any;\n\t\tlet response: string = '';\n\t\tlet executionError: Error | undefined = undefined;\n\n\t\tif (!toolParameters.length) {\n\t\t\tquery = '{}';\n\t\t}\n\n\t\ttry {\n\t\t\tif (query) {\n\t\t\t\tlet dataFromModel;\n\n\t\t\t\tif (typeof query === 'string') {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tdataFromModel = jsonParse<IDataObject>(query);\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tif (toolParameters.length === 1) {\n\t\t\t\t\t\t\tdataFromModel = { [toolParameters[0].name]: query };\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tthrow new NodeOperationError(\n\t\t\t\t\t\t\t\tctx.getNode(),\n\t\t\t\t\t\t\t\t`Input is not a valid JSON: ${error.message}`,\n\t\t\t\t\t\t\t\t{ itemIndex },\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tdataFromModel = query;\n\t\t\t\t}\n\n\t\t\t\tfor (const parameter of toolParameters) {\n\t\t\t\t\tif (\n\t\t\t\t\t\tparameter.required &&\n\t\t\t\t\t\t(dataFromModel[parameter.name] === undefined || dataFromModel[parameter.name] === null)\n\t\t\t\t\t) {\n\t\t\t\t\t\tthrow new NodeOperationError(\n\t\t\t\t\t\t\tctx.getNode(),\n\t\t\t\t\t\t\t`Model did not provide parameter '${parameter.name}' which is required and must be present in the input`,\n\t\t\t\t\t\t\t{ itemIndex },\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tfor (const parameter of toolParameters) {\n\t\t\t\t\tlet argument = dataFromModel[parameter.name];\n\n\t\t\t\t\tif (\n\t\t\t\t\t\targument &&\n\t\t\t\t\t\tparameter.type === 'json' &&\n\t\t\t\t\t\t!['qsRaw', 'headersRaw', 'bodyRaw'].includes(parameter.key ?? '') &&\n\t\t\t\t\t\ttypeof argument !== 'object'\n\t\t\t\t\t) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\targument = jsonParse(String(argument));\n\t\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t\tthrow new NodeOperationError(\n\t\t\t\t\t\t\t\tctx.getNode(),\n\t\t\t\t\t\t\t\t`Parameter ${parameter.name} is not a valid JSON: ${error.message}`,\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\titemIndex,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (parameter.sendIn === 'path') {\n\t\t\t\t\t\targument = String(argument);\n\n\t\t\t\t\t\t//remove \" or ' from start or end\n\t\t\t\t\t\targument = argument.replace(/^['\"]+|['\"]+$/g, '');\n\n\t\t\t\t\t\toptions.url = options.url.replace(`{${parameter.name}}`, argument);\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (parameter.sendIn === parameter.name) {\n\t\t\t\t\t\tset(options, [parameter.sendIn], argument);\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (['qsRaw', 'headersRaw', 'bodyRaw'].includes(parameter.key ?? '')) {\n\t\t\t\t\t\t//enclose string in quotes as user and model could omit them\n\t\t\t\t\t\tif (parameter.type === 'string') {\n\t\t\t\t\t\t\targument = String(argument);\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t!argument.startsWith('\"') &&\n\t\t\t\t\t\t\t\t!clonedRawRequestOptions[parameter.sendIn].includes(`\"{${parameter.name}}\"`)\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\targument = `\"${argument}\"`;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (typeof argument === 'object') {\n\t\t\t\t\t\t\targument = JSON.stringify(argument);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tclonedRawRequestOptions[parameter.sendIn] = clonedRawRequestOptions[\n\t\t\t\t\t\t\tparameter.sendIn\n\t\t\t\t\t\t].replace(`{${parameter.name}}`, String(argument));\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (parameter.key) {\n\t\t\t\t\t\tlet requestOptionsValue = get(options, [parameter.sendIn, parameter.key]);\n\n\t\t\t\t\t\tif (typeof requestOptionsValue === 'string') {\n\t\t\t\t\t\t\trequestOptionsValue = requestOptionsValue.replace(\n\t\t\t\t\t\t\t\t`{${parameter.name}}`,\n\t\t\t\t\t\t\t\tString(argument),\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tset(options, [parameter.sendIn, parameter.key], requestOptionsValue);\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\tset(options, [parameter.sendIn, parameter.name], argument);\n\t\t\t\t}\n\n\t\t\t\tfor (const [key, value] of Object.entries(clonedRawRequestOptions)) {\n\t\t\t\t\tif (value) {\n\t\t\t\t\t\tlet parsedValue;\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tparsedValue = jsonParse<IDataObject>(value);\n\t\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t\tlet recoveredData = '';\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\trecoveredData = value\n\t\t\t\t\t\t\t\t\t.replace(/'/g, '\"') // Replace single quotes with double quotes\n\t\t\t\t\t\t\t\t\t.replace(/(['\"])?([a-zA-Z0-9_]+)(['\"])?:/g, '\"$2\":') // Wrap keys in double quotes\n\t\t\t\t\t\t\t\t\t.replace(/,\\s*([\\]}])/g, '$1') // Remove trailing commas from objects\n\t\t\t\t\t\t\t\t\t.replace(/,+$/, ''); // Remove trailing comma\n\t\t\t\t\t\t\t\tparsedValue = jsonParse<IDataObject>(recoveredData);\n\t\t\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\t\t\tthrow new NodeOperationError(\n\t\t\t\t\t\t\t\t\tctx.getNode(),\n\t\t\t\t\t\t\t\t\t`Could not replace placeholders in ${key}: ${error.message}`,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\toptions[key as 'qs' | 'headers' | 'body'] = parsedValue;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (options) {\n\t\t\t\toptions.url = encodeURI(options.url);\n\n\t\t\t\tif (options.headers && !Object.keys(options.headers).length) {\n\t\t\t\t\tdelete options.headers;\n\t\t\t\t}\n\t\t\t\tif (options.qs && !Object.keys(options.qs).length) {\n\t\t\t\t\tdelete options.qs;\n\t\t\t\t}\n\t\t\t\tif (options.body && !Object.keys(options.body).length) {\n\t\t\t\t\tdelete options.body;\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tconst errorMessage = 'Input provided by model is not valid';\n\n\t\t\tif (error instanceof NodeOperationError) {\n\t\t\t\texecutionError = error;\n\t\t\t} else {\n\t\t\t\texecutionError = new NodeOperationError(ctx.getNode(), errorMessage, {\n\t\t\t\t\titemIndex,\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tresponse = errorMessage;\n\t\t}\n\n\t\tif (options) {\n\t\t\ttry {\n\t\t\t\tfullResponse = await httpRequest(options);\n\t\t\t} catch (error) {\n\t\t\t\tconst httpCode = (error as NodeApiError).httpCode;\n\t\t\t\tresponse = `${httpCode ? `HTTP ${httpCode} ` : ''}There was an error: \"${error.message}\"`;\n\t\t\t}\n\n\t\t\tif (!response) {\n\t\t\t\ttry {\n\t\t\t\t\t// Check if the response is binary data\n\t\t\t\t\tif (fullResponse.body && isBinary(fullResponse.body)) {\n\t\t\t\t\t\tthrow new NodeOperationError(ctx.getNode(), 'Binary data is not supported');\n\t\t\t\t\t}\n\n\t\t\t\t\tresponse = optimizeResponse(fullResponse.body ?? fullResponse);\n\t\t\t\t} catch (error) {\n\t\t\t\t\tresponse = `There was an error: \"${error.message}\"`;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (typeof response !== 'string') {\n\t\t\texecutionError = new NodeOperationError(ctx.getNode(), 'Wrong output type returned', {\n\t\t\t\tdescription: `The response property should be a string, but it is an ${typeof response}`,\n\t\t\t});\n\t\t\tresponse = `There was an error: \"${executionError.message}\"`;\n\t\t}\n\n\t\tif (executionError) {\n\t\t\tvoid ctx.addOutputData(NodeConnectionTypes.AiTool, index, executionError as ExecutionError);\n\t\t} else {\n\t\t\tvoid ctx.addOutputData(NodeConnectionTypes.AiTool, index, [[{ json: { response } }]]);\n\t\t}\n\n\t\treturn response;\n\t};\n};\n\nfunction makeParameterZodSchema(parameter: ToolParameter) {\n\tlet schema: z.ZodTypeAny;\n\n\tif (parameter.type === 'string') {\n\t\tschema = z.string();\n\t} else if (parameter.type === 'number') {\n\t\tschema = z.number();\n\t} else if (parameter.type === 'boolean') {\n\t\tschema = z.boolean();\n\t} else if (parameter.type === 'json') {\n\t\tschema = z.record(z.any());\n\t} else {\n\t\tschema = z.string();\n\t}\n\n\tif (!parameter.required) {\n\t\tschema = schema.optional();\n\t}\n\n\tif (parameter.description) {\n\t\tschema = schema.describe(parameter.description);\n\t}\n\n\treturn schema;\n}\n\nexport function makeToolInputSchema(parameters: ToolParameter[]): DynamicZodObject {\n\tconst schemaEntries = parameters.map((parameter) => [\n\t\tparameter.name,\n\t\tmakeParameterZodSchema(parameter),\n\t]);\n\n\treturn z.object(Object.fromEntries(schemaEntries));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA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SAAS,uBAAuB,WAA0B;AACzD,MAAI;AAEJ,MAAI,UAAU,SAAS,UAAU;AAChC,aAAS,aAAE,OAAO;AAAA,EACnB,WAAW,UAAU,SAAS,UAAU;AACvC,aAAS,aAAE,OAAO;AAAA,EACnB,WAAW,UAAU,SAAS,WAAW;AACxC,aAAS,aAAE,QAAQ;AAAA,EACpB,WAAW,UAAU,SAAS,QAAQ;AACrC,aAAS,aAAE,OAAO,aAAE,IAAI,CAAC;AAAA,EAC1B,OAAO;AACN,aAAS,aAAE,OAAO;AAAA,EACnB;AAEA,MAAI,CAAC,UAAU,UAAU;AACxB,aAAS,OAAO,SAAS;AAAA,EAC1B;AAEA,MAAI,UAAU,aAAa;AAC1B,aAAS,OAAO,SAAS,UAAU,WAAW;AAAA,EAC/C;AAEA,SAAO;AACR;AAEO,SAAS,oBAAoB,YAA+C;AAClF,QAAM,gBAAgB,WAAW,IAAI,CAAC,cAAc;AAAA,IACnD,UAAU;AAAA,IACV,uBAAuB,SAAS;AAAA,EACjC,CAAC;AAED,SAAO,aAAE,OAAO,OAAO,YAAY,aAAa,CAAC;AAClD;","names":["set","get","unset"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../nodes/tools/ToolSerpApi/ToolSerpApi.node.ts"],"sourcesContent":["/* eslint-disable n8n-nodes-base/node-dirname-against-convention */\nimport { SerpAPI } from '@langchain/community/tools/serpapi';\nimport {\n\tNodeConnectionTypes,\n\ttype INodeType,\n\ttype INodeTypeDescription,\n\ttype ISupplyDataFunctions,\n\ttype SupplyData,\n} from 'n8n-workflow';\n\nimport { logWrapper } from '@utils/logWrapper';\nimport { getConnectionHintNoticeField } from '@utils/sharedFields';\n\nexport class ToolSerpApi implements INodeType {\n\tdescription: INodeTypeDescription = {\n\t\tdisplayName: 'SerpApi (Google Search)',\n\t\tname: 'toolSerpApi',\n\t\ticon: 'file:serpApi.svg',\n\t\tgroup: ['transform'],\n\t\tversion: 1,\n\t\tdescription: 'Search in Google using SerpAPI',\n\t\tdefaults: {\n\t\t\tname: 'SerpAPI',\n\t\t},\n\t\tcodex: {\n\t\t\tcategories: ['AI'],\n\t\t\tsubcategories: {\n\t\t\t\tAI: ['Tools'],\n\t\t\t\tTools: ['Other Tools'],\n\t\t\t},\n\t\t\tresources: {\n\t\t\t\tprimaryDocumentation: [\n\t\t\t\t\t{\n\t\t\t\t\t\turl: 'https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.toolserpapi/',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\t\t// eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node\n\t\tinputs: [],\n\t\t// eslint-disable-next-line n8n-nodes-base/node-class-description-outputs-wrong\n\t\toutputs: [NodeConnectionTypes.AiTool],\n\t\toutputNames: ['Tool'],\n\t\tcredentials: [\n\t\t\t{\n\t\t\t\tname: 'serpApi',\n\t\t\t\trequired: true,\n\t\t\t},\n\t\t],\n\t\tproperties: [\n\t\t\tgetConnectionHintNoticeField([NodeConnectionTypes.AiAgent]),\n\t\t\t{\n\t\t\t\tdisplayName: 'Options',\n\t\t\t\tname: 'options',\n\t\t\t\ttype: 'collection',\n\t\t\t\tplaceholder: 'Add Option',\n\t\t\t\tdefault: {},\n\t\t\t\toptions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tdisplayName: 'Country',\n\t\t\t\t\t\tname: 'gl',\n\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\tdefault: 'us',\n\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t'Defines the country to use for search. Head to <a href=\"https://serpapi.com/google-countries\">Google countries page</a> for a full list of supported countries.',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tdisplayName: 'Device',\n\t\t\t\t\t\tname: 'device',\n\t\t\t\t\t\ttype: 'options',\n\t\t\t\t\t\toptions: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: 'Desktop',\n\t\t\t\t\t\t\t\tvalue: 'desktop',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: 'Mobile',\n\t\t\t\t\t\t\t\tvalue: 'mobile',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: 'Tablet',\n\t\t\t\t\t\t\t\tvalue: 'tablet',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t\tdefault: 'desktop',\n\t\t\t\t\t\tdescription: 'Device to use to get the results',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tdisplayName: 'Explicit Array',\n\t\t\t\t\t\tname: 'no_cache',\n\t\t\t\t\t\ttype: 'boolean',\n\t\t\t\t\t\tdefault: false,\n\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t'Whether to force SerpApi to fetch the Google results even if a cached version is already present. Cache expires after 1h. Cached searches are free, and are not counted towards your searches per month.',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tdisplayName: 'Google Domain',\n\t\t\t\t\t\tname: 'google_domain',\n\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\tdefault: 'google.com',\n\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t'Defines the domain to use for search. Head to <a href=\"https://serpapi.com/google-domains\">Google domains page</a> for a full list of supported domains.',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tdisplayName: 'Language',\n\t\t\t\t\t\tname: 'hl',\n\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\tdefault: 'en',\n\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t'Defines the language to use. It\\'s a two-letter language code. (e.g., `en` for English, `es` for Spanish, or `fr` for French). Head to <a href=\"https://serpapi.com/google-languages\">Google languages page</a> for a full list of supported languages.',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t};\n\n\tasync supplyData(this: ISupplyDataFunctions, itemIndex: number): Promise<SupplyData> {\n\t\tconst credentials = await this.getCredentials('serpApi');\n\n\t\tconst options = this.getNodeParameter('options', itemIndex) as object;\n\n\t\treturn {\n\t\t\tresponse: logWrapper(new SerpAPI(credentials.apiKey as string, options), this),\n\t\t};\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,qBAAwB;AACxB,0BAMO;AAEP,wBAA2B;AAC3B,0BAA6C;AAEtC,MAAM,YAAiC;AAAA,EAAvC;AACN,uBAAoC;AAAA,MACnC,aAAa;AAAA,MACb,MAAM;AAAA,MACN,MAAM;AAAA,MACN,OAAO,CAAC,WAAW;AAAA,MACnB,SAAS;AAAA,MACT,aAAa;AAAA,MACb,UAAU;AAAA,QACT,MAAM;AAAA,MACP;AAAA,MACA,OAAO;AAAA,QACN,YAAY,CAAC,IAAI;AAAA,QACjB,eAAe;AAAA,UACd,IAAI,CAAC,OAAO;AAAA,UACZ,OAAO,CAAC,aAAa;AAAA,QACtB;AAAA,QACA,WAAW;AAAA,UACV,sBAAsB;AAAA,YACrB;AAAA,cACC,KAAK;AAAA,YACN;AAAA,UACD;AAAA,QACD;AAAA,MACD;AAAA;AAAA,MAEA,QAAQ,CAAC;AAAA;AAAA,MAET,SAAS,CAAC,wCAAoB,MAAM;AAAA,MACpC,aAAa,CAAC,MAAM;AAAA,MACpB,aAAa;AAAA,QACZ;AAAA,UACC,MAAM;AAAA,UACN,UAAU;AAAA,QACX;AAAA,MACD;AAAA,MACA,YAAY;AAAA,YACX,kDAA6B,CAAC,wCAAoB,OAAO,CAAC;AAAA,QAC1D;AAAA,UACC,aAAa;AAAA,UACb,MAAM;AAAA,UACN,MAAM;AAAA,UACN,aAAa;AAAA,UACb,SAAS,CAAC;AAAA,UACV,SAAS;AAAA,YACR;AAAA,cACC,aAAa;AAAA,cACb,MAAM;AAAA,cACN,MAAM;AAAA,cACN,SAAS;AAAA,cACT,aACC;AAAA,YACF;AAAA,YACA;AAAA,cACC,aAAa;AAAA,cACb,MAAM;AAAA,cACN,MAAM;AAAA,cACN,SAAS;AAAA,gBACR;AAAA,kBACC,MAAM;AAAA,kBACN,OAAO;AAAA,gBACR;AAAA,gBACA;AAAA,kBACC,MAAM;AAAA,kBACN,OAAO;AAAA,gBACR;AAAA,gBACA;AAAA,kBACC,MAAM;AAAA,kBACN,OAAO;AAAA,gBACR;AAAA,cACD;AAAA,cACA,SAAS;AAAA,cACT,aAAa;AAAA,YACd;AAAA,YACA;AAAA,cACC,aAAa;AAAA,cACb,MAAM;AAAA,cACN,MAAM;AAAA,cACN,SAAS;AAAA,cACT,aACC;AAAA,YACF;AAAA,YACA;AAAA,cACC,aAAa;AAAA,cACb,MAAM;AAAA,cACN,MAAM;AAAA,cACN,SAAS;AAAA,cACT,aACC;AAAA,YACF;AAAA,YACA;AAAA,cACC,aAAa;AAAA,cACb,MAAM;AAAA,cACN,MAAM;AAAA,cACN,SAAS;AAAA,cACT,aACC;AAAA,YACF;AAAA,UACD;AAAA,QACD;AAAA,MACD;AAAA,IACD;AAAA;AAAA,EAEA,MAAM,WAAuC,WAAwC;AACpF,UAAM,cAAc,MAAM,KAAK,eAAe,SAAS;AAEvD,UAAM,UAAU,KAAK,iBAAiB,WAAW,SAAS;AAE1D,WAAO;AAAA,MACN,cAAU,8BAAW,IAAI,uBAAQ,YAAY,QAAkB,OAAO,GAAG,IAAI;AAAA,IAC9E;AAAA,EACD;AACD;","names":[]}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var ToolThink_node_exports = {};
|
|
20
|
+
__export(ToolThink_node_exports, {
|
|
21
|
+
ToolThink: () => ToolThink
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(ToolThink_node_exports);
|
|
24
|
+
var import_tools = require("langchain/tools");
|
|
25
|
+
var import_n8n_workflow = require("n8n-workflow");
|
|
26
|
+
var import_logWrapper = require("../../../utils/logWrapper");
|
|
27
|
+
var import_sharedFields = require("../../../utils/sharedFields");
|
|
28
|
+
const defaultToolDescription = "Use the tool to think about something. It will not obtain new information or change the database, but just append the thought to the log. Use it when complex reasoning or some cache memory is needed.";
|
|
29
|
+
class ToolThink {
|
|
30
|
+
constructor() {
|
|
31
|
+
this.description = {
|
|
32
|
+
displayName: "Think Tool",
|
|
33
|
+
name: "toolThink",
|
|
34
|
+
icon: "fa:brain",
|
|
35
|
+
iconColor: "black",
|
|
36
|
+
group: ["transform"],
|
|
37
|
+
version: 1,
|
|
38
|
+
description: "Invite the AI agent to do some thinking",
|
|
39
|
+
defaults: {
|
|
40
|
+
name: "Think"
|
|
41
|
+
},
|
|
42
|
+
codex: {
|
|
43
|
+
categories: ["AI"],
|
|
44
|
+
subcategories: {
|
|
45
|
+
AI: ["Tools"],
|
|
46
|
+
Tools: ["Other Tools"]
|
|
47
|
+
},
|
|
48
|
+
resources: {
|
|
49
|
+
primaryDocumentation: [
|
|
50
|
+
{
|
|
51
|
+
url: "https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.toolthink/"
|
|
52
|
+
}
|
|
53
|
+
]
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
inputs: [],
|
|
57
|
+
outputs: [import_n8n_workflow.NodeConnectionTypes.AiTool],
|
|
58
|
+
outputNames: ["Tool"],
|
|
59
|
+
properties: [
|
|
60
|
+
(0, import_sharedFields.getConnectionHintNoticeField)([import_n8n_workflow.NodeConnectionTypes.AiAgent]),
|
|
61
|
+
{
|
|
62
|
+
displayName: "Think Tool Description",
|
|
63
|
+
name: "description",
|
|
64
|
+
type: "string",
|
|
65
|
+
default: defaultToolDescription,
|
|
66
|
+
placeholder: "[Describe your thinking tool here, explaining how it will help the AI think]",
|
|
67
|
+
description: "The thinking tool's description",
|
|
68
|
+
typeOptions: {
|
|
69
|
+
rows: 3
|
|
70
|
+
},
|
|
71
|
+
required: true
|
|
72
|
+
}
|
|
73
|
+
]
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
async supplyData(itemIndex) {
|
|
77
|
+
const description = this.getNodeParameter("description", itemIndex);
|
|
78
|
+
const tool = new import_tools.DynamicTool({
|
|
79
|
+
name: "thinking_tool",
|
|
80
|
+
description,
|
|
81
|
+
func: async (subject) => {
|
|
82
|
+
return subject;
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
return {
|
|
86
|
+
response: (0, import_logWrapper.logWrapper)(tool, this)
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
91
|
+
0 && (module.exports = {
|
|
92
|
+
ToolThink
|
|
93
|
+
});
|
|
94
|
+
//# sourceMappingURL=ToolThink.node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../nodes/tools/ToolThink/ToolThink.node.ts"],"sourcesContent":["/* eslint-disable n8n-nodes-base/node-dirname-against-convention */\nimport { DynamicTool } from 'langchain/tools';\nimport {\n\tNodeConnectionTypes,\n\ttype INodeType,\n\ttype INodeTypeDescription,\n\ttype ISupplyDataFunctions,\n\ttype SupplyData,\n} from 'n8n-workflow';\n\nimport { logWrapper } from '@utils/logWrapper';\nimport { getConnectionHintNoticeField } from '@utils/sharedFields';\n\n// A thinking tool, see https://www.anthropic.com/engineering/claude-think-tool\n\nconst defaultToolDescription =\n\t'Use the tool to think about something. It will not obtain new information or change the database, but just append the thought to the log. Use it when complex reasoning or some cache memory is needed.';\n\nexport class ToolThink implements INodeType {\n\tdescription: INodeTypeDescription = {\n\t\tdisplayName: 'Think Tool',\n\t\tname: 'toolThink',\n\t\ticon: 'fa:brain',\n\t\ticonColor: 'black',\n\t\tgroup: ['transform'],\n\t\tversion: 1,\n\t\tdescription: 'Invite the AI agent to do some thinking',\n\t\tdefaults: {\n\t\t\tname: 'Think',\n\t\t},\n\t\tcodex: {\n\t\t\tcategories: ['AI'],\n\t\t\tsubcategories: {\n\t\t\t\tAI: ['Tools'],\n\t\t\t\tTools: ['Other Tools'],\n\t\t\t},\n\t\t\tresources: {\n\t\t\t\tprimaryDocumentation: [\n\t\t\t\t\t{\n\t\t\t\t\t\turl: 'https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.toolthink/',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\t\tinputs: [],\n\t\toutputs: [NodeConnectionTypes.AiTool],\n\t\toutputNames: ['Tool'],\n\t\tproperties: [\n\t\t\tgetConnectionHintNoticeField([NodeConnectionTypes.AiAgent]),\n\t\t\t{\n\t\t\t\tdisplayName: 'Think Tool Description',\n\t\t\t\tname: 'description',\n\t\t\t\ttype: 'string',\n\t\t\t\tdefault: defaultToolDescription,\n\t\t\t\tplaceholder: '[Describe your thinking tool here, explaining how it will help the AI think]',\n\t\t\t\tdescription: \"The thinking tool's description\",\n\t\t\t\ttypeOptions: {\n\t\t\t\t\trows: 3,\n\t\t\t\t},\n\t\t\t\trequired: true,\n\t\t\t},\n\t\t],\n\t};\n\n\tasync supplyData(this: ISupplyDataFunctions, itemIndex: number): Promise<SupplyData> {\n\t\tconst description = this.getNodeParameter('description', itemIndex) as string;\n\t\tconst tool = new DynamicTool({\n\t\t\tname: 'thinking_tool',\n\t\t\tdescription,\n\t\t\tfunc: async (subject: string) => {\n\t\t\t\treturn subject;\n\t\t\t},\n\t\t});\n\n\t\treturn {\n\t\t\tresponse: logWrapper(tool, this),\n\t\t};\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAA4B;AAC5B,0BAMO;AAEP,wBAA2B;AAC3B,0BAA6C;AAI7C,MAAM,yBACL;AAEM,MAAM,UAA+B;AAAA,EAArC;AACN,uBAAoC;AAAA,MACnC,aAAa;AAAA,MACb,MAAM;AAAA,MACN,MAAM;AAAA,MACN,WAAW;AAAA,MACX,OAAO,CAAC,WAAW;AAAA,MACnB,SAAS;AAAA,MACT,aAAa;AAAA,MACb,UAAU;AAAA,QACT,MAAM;AAAA,MACP;AAAA,MACA,OAAO;AAAA,QACN,YAAY,CAAC,IAAI;AAAA,QACjB,eAAe;AAAA,UACd,IAAI,CAAC,OAAO;AAAA,UACZ,OAAO,CAAC,aAAa;AAAA,QACtB;AAAA,QACA,WAAW;AAAA,UACV,sBAAsB;AAAA,YACrB;AAAA,cACC,KAAK;AAAA,YACN;AAAA,UACD;AAAA,QACD;AAAA,MACD;AAAA,MACA,QAAQ,CAAC;AAAA,MACT,SAAS,CAAC,wCAAoB,MAAM;AAAA,MACpC,aAAa,CAAC,MAAM;AAAA,MACpB,YAAY;AAAA,YACX,kDAA6B,CAAC,wCAAoB,OAAO,CAAC;AAAA,QAC1D;AAAA,UACC,aAAa;AAAA,UACb,MAAM;AAAA,UACN,MAAM;AAAA,UACN,SAAS;AAAA,UACT,aAAa;AAAA,UACb,aAAa;AAAA,UACb,aAAa;AAAA,YACZ,MAAM;AAAA,UACP;AAAA,UACA,UAAU;AAAA,QACX;AAAA,MACD;AAAA,IACD;AAAA;AAAA,EAEA,MAAM,WAAuC,WAAwC;AACpF,UAAM,cAAc,KAAK,iBAAiB,eAAe,SAAS;AAClE,UAAM,OAAO,IAAI,yBAAY;AAAA,MAC5B,MAAM;AAAA,MACN;AAAA,MACA,MAAM,OAAO,YAAoB;AAChC,eAAO;AAAA,MACR;AAAA,IACD,CAAC;AAED,WAAO;AAAA,MACN,cAAU,8BAAW,MAAM,IAAI;AAAA,IAChC;AAAA,EACD;AACD;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../nodes/tools/ToolVectorStore/ToolVectorStore.node.ts"],"sourcesContent":["import type { BaseLanguageModel } from '@langchain/core/language_models/base';\nimport type { VectorStore } from '@langchain/core/vectorstores';\nimport { VectorDBQAChain } from 'langchain/chains';\nimport { VectorStoreQATool } from 'langchain/tools';\nimport type {\n\tINodeType,\n\tINodeTypeDescription,\n\tISupplyDataFunctions,\n\tSupplyData,\n} from 'n8n-workflow';\nimport { NodeConnectionTypes } from 'n8n-workflow';\n\nimport { logWrapper } from '@utils/logWrapper';\nimport { getConnectionHintNoticeField } from '@utils/sharedFields';\n\nexport class ToolVectorStore implements INodeType {\n\tdescription: INodeTypeDescription = {\n\t\tdisplayName: 'Vector Store Question Answer Tool',\n\t\tname: 'toolVectorStore',\n\t\ticon: 'fa:database',\n\t\ticonColor: 'black',\n\t\tgroup: ['transform'],\n\t\tversion: [1],\n\t\tdescription: 'Answer questions with a vector store',\n\t\tdefaults: {\n\t\t\tname: 'Answer questions with a vector store',\n\t\t},\n\t\tcodex: {\n\t\t\tcategories: ['AI'],\n\t\t\tsubcategories: {\n\t\t\t\tAI: ['Tools'],\n\t\t\t\tTools: ['Other Tools'],\n\t\t\t},\n\t\t\tresources: {\n\t\t\t\tprimaryDocumentation: [\n\t\t\t\t\t{\n\t\t\t\t\t\turl: 'https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.toolvectorstore/',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\t\t// eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tdisplayName: 'Vector Store',\n\t\t\t\tmaxConnections: 1,\n\t\t\t\ttype: NodeConnectionTypes.AiVectorStore,\n\t\t\t\trequired: true,\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Model',\n\t\t\t\tmaxConnections: 1,\n\t\t\t\ttype: NodeConnectionTypes.AiLanguageModel,\n\t\t\t\trequired: true,\n\t\t\t},\n\t\t],\n\t\t// eslint-disable-next-line n8n-nodes-base/node-class-description-outputs-wrong\n\t\toutputs: [NodeConnectionTypes.AiTool],\n\t\toutputNames: ['Tool'],\n\t\tproperties: [\n\t\t\tgetConnectionHintNoticeField([NodeConnectionTypes.AiAgent]),\n\t\t\t{\n\t\t\t\tdisplayName: 'Data Name',\n\t\t\t\tname: 'name',\n\t\t\t\ttype: 'string',\n\t\t\t\tdefault: '',\n\t\t\t\tplaceholder: 'e.g. users_info',\n\t\t\t\tvalidateType: 'string-alphanumeric',\n\t\t\t\tdescription:\n\t\t\t\t\t'Name of the data in vector store. This will be used to fill this tool description: Useful for when you need to answer questions about [name]. Whenever you need information about [data description], you should ALWAYS use this. Input should be a fully formed question.',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Description of Data',\n\t\t\t\tname: 'description',\n\t\t\t\ttype: 'string',\n\t\t\t\tdefault: '',\n\t\t\t\tplaceholder: \"[Describe your data here, e.g. a user's name, email, etc.]\",\n\t\t\t\tdescription:\n\t\t\t\t\t'Describe the data in vector store. This will be used to fill this tool description: Useful for when you need to answer questions about [name]. Whenever you need information about [data description], you should ALWAYS use this. Input should be a fully formed question.',\n\t\t\t\ttypeOptions: {\n\t\t\t\t\trows: 3,\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Limit',\n\t\t\t\tname: 'topK',\n\t\t\t\ttype: 'number',\n\t\t\t\tdefault: 4,\n\t\t\t\tdescription: 'The maximum number of results to return',\n\t\t\t},\n\t\t],\n\t};\n\n\tasync supplyData(this: ISupplyDataFunctions, itemIndex: number): Promise<SupplyData> {\n\t\tconst name = this.getNodeParameter('name', itemIndex) as string;\n\t\tconst toolDescription = this.getNodeParameter('description', itemIndex) as string;\n\t\tconst topK = this.getNodeParameter('topK', itemIndex, 4) as number;\n\n\t\tconst vectorStore = (await this.getInputConnectionData(\n\t\t\tNodeConnectionTypes.AiVectorStore,\n\t\t\titemIndex,\n\t\t)) as VectorStore;\n\n\t\tconst llm = (await this.getInputConnectionData(\n\t\t\tNodeConnectionTypes.AiLanguageModel,\n\t\t\t0,\n\t\t)) as BaseLanguageModel;\n\n\t\tconst description = VectorStoreQATool.getDescription(name, toolDescription);\n\t\tconst vectorStoreTool = new VectorStoreQATool(name, description, {\n\t\t\tllm,\n\t\t\tvectorStore,\n\t\t});\n\n\t\tvectorStoreTool.chain = VectorDBQAChain.fromLLM(llm, vectorStore, {\n\t\t\tk: topK,\n\t\t});\n\n\t\treturn {\n\t\t\tresponse: logWrapper(vectorStoreTool, this),\n\t\t};\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,oBAAgC;AAChC,mBAAkC;AAOlC,0BAAoC;AAEpC,wBAA2B;AAC3B,0BAA6C;AAEtC,MAAM,gBAAqC;AAAA,EAA3C;AACN,uBAAoC;AAAA,MACnC,aAAa;AAAA,MACb,MAAM;AAAA,MACN,MAAM;AAAA,MACN,WAAW;AAAA,MACX,OAAO,CAAC,WAAW;AAAA,MACnB,SAAS,CAAC,CAAC;AAAA,MACX,aAAa;AAAA,MACb,UAAU;AAAA,QACT,MAAM;AAAA,MACP;AAAA,MACA,OAAO;AAAA,QACN,YAAY,CAAC,IAAI;AAAA,QACjB,eAAe;AAAA,UACd,IAAI,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,IACD;AAEA,UAAM,MAAO,MAAM,KAAK;AAAA,MACvB,wCAAoB;AAAA,MACpB;AAAA,IACD;AAEA,UAAM,cAAc,+BAAkB,eAAe,MAAM,eAAe;AAC1E,UAAM,kBAAkB,IAAI,+BAAkB,MAAM,aAAa;AAAA,MAChE;AAAA,MACA;AAAA,IACD,CAAC;AAED,oBAAgB,QAAQ,8BAAgB,QAAQ,KAAK,aAAa;AAAA,MACjE,GAAG;AAAA,IACJ,CAAC;AAED,WAAO;AAAA,MACN,cAAU,8BAAW,iBAAiB,IAAI;AAAA,IAC3C;AAAA,EACD;AACD;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../nodes/tools/ToolWikipedia/ToolWikipedia.node.ts"],"sourcesContent":["/* eslint-disable n8n-nodes-base/node-dirname-against-convention */\nimport { WikipediaQueryRun } from '@langchain/community/tools/wikipedia_query_run';\nimport {\n\tNodeConnectionTypes,\n\ttype INodeType,\n\ttype INodeTypeDescription,\n\ttype ISupplyDataFunctions,\n\ttype SupplyData,\n} from 'n8n-workflow';\n\nimport { logWrapper } from '@utils/logWrapper';\nimport { getConnectionHintNoticeField } from '@utils/sharedFields';\n\nexport class ToolWikipedia implements INodeType {\n\tdescription: INodeTypeDescription = {\n\t\tdisplayName: 'Wikipedia',\n\t\tname: 'toolWikipedia',\n\t\ticon: 'file:wikipedia.svg',\n\t\tgroup: ['transform'],\n\t\tversion: 1,\n\t\tdescription: 'Search in Wikipedia',\n\t\tdefaults: {\n\t\t\tname: 'Wikipedia',\n\t\t},\n\t\tcodex: {\n\t\t\tcategories: ['AI'],\n\t\t\tsubcategories: {\n\t\t\t\tAI: ['Tools'],\n\t\t\t\tTools: ['Other Tools'],\n\t\t\t},\n\t\t\tresources: {\n\t\t\t\tprimaryDocumentation: [\n\t\t\t\t\t{\n\t\t\t\t\t\turl: 'https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.toolwikipedia/',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\t\t// eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node\n\t\tinputs: [],\n\t\t// eslint-disable-next-line n8n-nodes-base/node-class-description-outputs-wrong\n\t\toutputs: [NodeConnectionTypes.AiTool],\n\t\toutputNames: ['Tool'],\n\t\tproperties: [getConnectionHintNoticeField([NodeConnectionTypes.AiAgent])],\n\t};\n\n\tasync supplyData(this: ISupplyDataFunctions): Promise<SupplyData> {\n\t\tconst WikiTool = new WikipediaQueryRun();\n\n\t\tWikiTool.description =\n\t\t\t'A tool for interacting with and fetching data from the Wikipedia API. The input should always be a string query.';\n\n\t\treturn {\n\t\t\tresponse: logWrapper(WikiTool, this),\n\t\t};\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,iCAAkC;AAClC,0BAMO;AAEP,wBAA2B;AAC3B,0BAA6C;AAEtC,MAAM,cAAmC;AAAA,EAAzC;AACN,uBAAoC;AAAA,MACnC,aAAa;AAAA,MACb,MAAM;AAAA,MACN,MAAM;AAAA,MACN,OAAO,CAAC,WAAW;AAAA,MACnB,SAAS;AAAA,MACT,aAAa;AAAA,MACb,UAAU;AAAA,QACT,MAAM;AAAA,MACP;AAAA,MACA,OAAO;AAAA,QACN,YAAY,CAAC,IAAI;AAAA,QACjB,eAAe;AAAA,UACd,IAAI,CAAC,OAAO;AAAA,UACZ,OAAO,CAAC,aAAa;AAAA,QACtB;AAAA,QACA,WAAW;AAAA,UACV,sBAAsB;AAAA,YACrB;AAAA,cACC,KAAK;AAAA,YACN;AAAA,UACD;AAAA,QACD;AAAA,MACD;AAAA;AAAA,MAEA,QAAQ,CAAC;AAAA;AAAA,MAET,SAAS,CAAC,wCAAoB,MAAM;AAAA,MACpC,aAAa,CAAC,MAAM;AAAA,MACpB,YAAY,KAAC,kDAA6B,CAAC,wCAAoB,OAAO,CAAC,CAAC;AAAA,IACzE;AAAA;AAAA,EAEA,MAAM,aAA4D;AACjE,UAAM,WAAW,IAAI,6CAAkB;AAEvC,aAAS,cACR;AAED,WAAO;AAAA,MACN,cAAU,8BAAW,UAAU,IAAI;AAAA,IACpC;AAAA,EACD;AACD;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../nodes/tools/ToolWolframAlpha/ToolWolframAlpha.node.ts"],"sourcesContent":["/* eslint-disable n8n-nodes-base/node-dirname-against-convention */\nimport { WolframAlphaTool } from '@langchain/community/tools/wolframalpha';\nimport {\n\tNodeConnectionTypes,\n\ttype INodeType,\n\ttype INodeTypeDescription,\n\ttype ISupplyDataFunctions,\n\ttype SupplyData,\n} from 'n8n-workflow';\n\nimport { logWrapper } from '@utils/logWrapper';\nimport { getConnectionHintNoticeField } from '@utils/sharedFields';\n\nexport class ToolWolframAlpha implements INodeType {\n\tdescription: INodeTypeDescription = {\n\t\tdisplayName: 'Wolfram|Alpha',\n\t\tname: 'toolWolframAlpha',\n\t\ticon: 'file:wolfram-alpha.svg',\n\t\tgroup: ['transform'],\n\t\tversion: 1,\n\t\tdescription: \"Connects to WolframAlpha's computational intelligence engine.\",\n\t\tdefaults: {\n\t\t\tname: 'Wolfram Alpha',\n\t\t},\n\t\tcredentials: [\n\t\t\t{\n\t\t\t\tname: 'wolframAlphaApi',\n\t\t\t\trequired: true,\n\t\t\t},\n\t\t],\n\t\tcodex: {\n\t\t\tcategories: ['AI'],\n\t\t\tsubcategories: {\n\t\t\t\tAI: ['Tools'],\n\t\t\t\tTools: ['Other Tools'],\n\t\t\t},\n\t\t\tresources: {\n\t\t\t\tprimaryDocumentation: [\n\t\t\t\t\t{\n\t\t\t\t\t\turl: 'https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.toolwolframalpha/',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\t\t// eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node\n\t\tinputs: [],\n\t\t// eslint-disable-next-line n8n-nodes-base/node-class-description-outputs-wrong\n\t\toutputs: [NodeConnectionTypes.AiTool],\n\t\toutputNames: ['Tool'],\n\t\tproperties: [getConnectionHintNoticeField([NodeConnectionTypes.AiAgent])],\n\t};\n\n\tasync supplyData(this: ISupplyDataFunctions): Promise<SupplyData> {\n\t\tconst credentials = await this.getCredentials('wolframAlphaApi');\n\n\t\treturn {\n\t\t\tresponse: logWrapper(new WolframAlphaTool({ appid: credentials.appId as string }), this),\n\t\t};\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,0BAAiC;AACjC,0BAMO;AAEP,wBAA2B;AAC3B,0BAA6C;AAEtC,MAAM,iBAAsC;AAAA,EAA5C;AACN,uBAAoC;AAAA,MACnC,aAAa;AAAA,MACb,MAAM;AAAA,MACN,MAAM;AAAA,MACN,OAAO,CAAC,WAAW;AAAA,MACnB,SAAS;AAAA,MACT,aAAa;AAAA,MACb,UAAU;AAAA,QACT,MAAM;AAAA,MACP;AAAA,MACA,aAAa;AAAA,QACZ;AAAA,UACC,MAAM;AAAA,UACN,UAAU;AAAA,QACX;AAAA,MACD;AAAA,MACA,OAAO;AAAA,QACN,YAAY,CAAC,IAAI;AAAA,QACjB,eAAe;AAAA,UACd,IAAI,CAAC,OAAO;AAAA,UACZ,OAAO,CAAC,aAAa;AAAA,QACtB;AAAA,QACA,WAAW;AAAA,UACV,sBAAsB;AAAA,YACrB;AAAA,cACC,KAAK;AAAA,YACN;AAAA,UACD;AAAA,QACD;AAAA,MACD;AAAA;AAAA,MAEA,QAAQ,CAAC;AAAA;AAAA,MAET,SAAS,CAAC,wCAAoB,MAAM;AAAA,MACpC,aAAa,CAAC,MAAM;AAAA,MACpB,YAAY,KAAC,kDAA6B,CAAC,wCAAoB,OAAO,CAAC,CAAC;AAAA,IACzE;AAAA;AAAA,EAEA,MAAM,aAA4D;AACjE,UAAM,cAAc,MAAM,KAAK,eAAe,iBAAiB;AAE/D,WAAO;AAAA,MACN,cAAU,8BAAW,IAAI,qCAAiB,EAAE,OAAO,YAAY,MAAgB,CAAC,GAAG,IAAI;AAAA,IACxF;AAAA,EACD;AACD;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../nodes/tools/ToolWorkflow/ToolWorkflow.node.ts"],"sourcesContent":["import type { IVersionedNodeType, INodeTypeBaseDescription } from 'n8n-workflow';\nimport { VersionedNodeType } from 'n8n-workflow';\n\nimport { ToolWorkflowV1 } from './v1/ToolWorkflowV1.node';\nimport { ToolWorkflowV2 } from './v2/ToolWorkflowV2.node';\n\nexport class ToolWorkflow extends VersionedNodeType {\n\tconstructor() {\n\t\tconst baseDescription: INodeTypeBaseDescription = {\n\t\t\tdisplayName: 'Call n8n Sub-Workflow Tool',\n\t\t\tname: 'toolWorkflow',\n\t\t\ticon: 'fa:network-wired',\n\t\t\ticonColor: 'black',\n\t\t\tgroup: ['transform'],\n\t\t\tdescription:\n\t\t\t\t'Uses another n8n workflow as a tool. Allows packaging any n8n node(s) as a tool.',\n\t\t\tcodex: {\n\t\t\t\tcategories: ['AI'],\n\t\t\t\tsubcategories: {\n\t\t\t\t\tAI: ['Tools'],\n\t\t\t\t\tTools: ['Recommended Tools'],\n\t\t\t\t},\n\t\t\t\tresources: {\n\t\t\t\t\tprimaryDocumentation: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\turl: 'https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.toolworkflow/',\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t},\n\t\t\tdefaultVersion: 2.1,\n\t\t};\n\n\t\tconst nodeVersions: IVersionedNodeType['nodeVersions'] = {\n\t\t\t1: new ToolWorkflowV1(baseDescription),\n\t\t\t1.1: new ToolWorkflowV1(baseDescription),\n\t\t\t1.2: new ToolWorkflowV1(baseDescription),\n\t\t\t1.3: new ToolWorkflowV1(baseDescription),\n\t\t\t2: new ToolWorkflowV2(baseDescription),\n\t\t\t2.1: new ToolWorkflowV2(baseDescription),\n\t\t};\n\t\tsuper(nodeVersions, baseDescription);\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,0BAAkC;AAElC,4BAA+B;AAC/B,4BAA+B;AAExB,MAAM,qBAAqB,sCAAkB;AAAA,EACnD,cAAc;AACb,UAAM,kBAA4C;AAAA,MACjD,aAAa;AAAA,MACb,MAAM;AAAA,MACN,MAAM;AAAA,MACN,WAAW;AAAA,MACX,OAAO,CAAC,WAAW;AAAA,MACnB,aACC;AAAA,MACD,OAAO;AAAA,QACN,YAAY,CAAC,IAAI;AAAA,QACjB,eAAe;AAAA,UACd,IAAI,CAAC,OAAO;AAAA,UACZ,OAAO,CAAC,mBAAmB;AAAA,QAC5B;AAAA,QACA,WAAW;AAAA,UACV,sBAAsB;AAAA,YACrB;AAAA,cACC,KAAK;AAAA,YACN;AAAA,UACD;AAAA,QACD;AAAA,MACD;AAAA,MACA,gBAAgB;AAAA,IACjB;AAEA,UAAM,eAAmD;AAAA,MACxD,GAAG,IAAI,qCAAe,eAAe;AAAA,MACrC,KAAK,IAAI,qCAAe,eAAe;AAAA,MACvC,KAAK,IAAI,qCAAe,eAAe;AAAA,MACvC,KAAK,IAAI,qCAAe,eAAe;AAAA,MACvC,GAAG,IAAI,qCAAe,eAAe;AAAA,MACrC,KAAK,IAAI,qCAAe,eAAe;AAAA,IACxC;AACA,UAAM,cAAc,eAAe;AAAA,EACpC;AACD;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../nodes/tools/ToolWorkflow/v1/ToolWorkflowV1.node.ts"],"sourcesContent":["import type { CallbackManagerForToolRun } from '@langchain/core/callbacks/manager';\nimport { DynamicStructuredTool, DynamicTool } from '@langchain/core/tools';\nimport type { JSONSchema7 } from 'json-schema';\nimport get from 'lodash/get';\nimport isObject from 'lodash/isObject';\nimport type { SetField, SetNodeOptions } from 'n8n-nodes-base/dist/nodes/Set/v2/helpers/interfaces';\nimport * as manual from 'n8n-nodes-base/dist/nodes/Set/v2/manual.mode';\nimport type {\n\tIExecuteWorkflowInfo,\n\tINodeExecutionData,\n\tINodeType,\n\tINodeTypeDescription,\n\tIWorkflowBase,\n\tISupplyDataFunctions,\n\tSupplyData,\n\tExecutionError,\n\tExecuteWorkflowData,\n\tIDataObject,\n\tINodeParameterResourceLocator,\n\tITaskMetadata,\n\tINodeTypeBaseDescription,\n} from 'n8n-workflow';\nimport { NodeConnectionTypes, NodeOperationError, jsonParse } from 'n8n-workflow';\n\nimport { versionDescription } from './versionDescription';\nimport type { DynamicZodObject } from '../../../../types/zod.types';\nimport { convertJsonSchemaToZod, generateSchema } from '../../../../utils/schemaParsing';\n\nexport class ToolWorkflowV1 implements INodeType {\n\tdescription: INodeTypeDescription;\n\n\tconstructor(baseDescription: INodeTypeBaseDescription) {\n\t\tthis.description = {\n\t\t\t...baseDescription,\n\t\t\t...versionDescription,\n\t\t};\n\t}\n\n\tasync supplyData(this: ISupplyDataFunctions, itemIndex: number): Promise<SupplyData> {\n\t\tconst workflowProxy = this.getWorkflowDataProxy(0);\n\n\t\tconst name = this.getNodeParameter('name', itemIndex) as string;\n\t\tconst description = this.getNodeParameter('description', itemIndex) as string;\n\n\t\tlet subExecutionId: string | undefined;\n\t\tlet subWorkflowId: string | undefined;\n\n\t\tconst useSchema = this.getNodeParameter('specifyInputSchema', itemIndex) as boolean;\n\t\tlet tool: DynamicTool | DynamicStructuredTool | undefined = undefined;\n\n\t\tconst runFunction = async (\n\t\t\tquery: string | IDataObject,\n\t\t\trunManager?: CallbackManagerForToolRun,\n\t\t): Promise<string> => {\n\t\t\tconst source = this.getNodeParameter('source', itemIndex) as string;\n\t\t\tconst workflowInfo: IExecuteWorkflowInfo = {};\n\t\t\tif (source === 'database') {\n\t\t\t\t// Read workflow from database\n\t\t\t\tconst nodeVersion = this.getNode().typeVersion;\n\t\t\t\tif (nodeVersion <= 1.1) {\n\t\t\t\t\tworkflowInfo.id = this.getNodeParameter('workflowId', itemIndex) as string;\n\t\t\t\t} else {\n\t\t\t\t\tconst { value } = this.getNodeParameter(\n\t\t\t\t\t\t'workflowId',\n\t\t\t\t\t\titemIndex,\n\t\t\t\t\t\t{},\n\t\t\t\t\t) as INodeParameterResourceLocator;\n\t\t\t\t\tworkflowInfo.id = value as string;\n\t\t\t\t}\n\n\t\t\t\tsubWorkflowId = workflowInfo.id;\n\t\t\t} else if (source === 'parameter') {\n\t\t\t\t// Read workflow from parameter\n\t\t\t\tconst workflowJson = this.getNodeParameter('workflowJson', itemIndex) as string;\n\t\t\t\ttry {\n\t\t\t\t\tworkflowInfo.code = JSON.parse(workflowJson) as IWorkflowBase;\n\n\t\t\t\t\t// subworkflow is same as parent workflow\n\t\t\t\t\tsubWorkflowId = workflowProxy.$workflow.id;\n\t\t\t\t} catch (error) {\n\t\t\t\t\tthrow new NodeOperationError(\n\t\t\t\t\t\tthis.getNode(),\n\t\t\t\t\t\t`The provided workflow is not valid JSON: \"${(error as Error).message}\"`,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\titemIndex,\n\t\t\t\t\t\t},\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst rawData: IDataObject = { query };\n\n\t\t\tconst workflowFieldsJson = this.getNodeParameter('fields.values', itemIndex, [], {\n\t\t\t\trawExpressions: true,\n\t\t\t}) as SetField[];\n\n\t\t\t// Copied from Set Node v2\n\t\t\tfor (const entry of workflowFieldsJson) {\n\t\t\t\tif (entry.type === 'objectValue' && (entry.objectValue as string).startsWith('=')) {\n\t\t\t\t\trawData[entry.name] = (entry.objectValue as string).replace(/^=+/, '');\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst options: SetNodeOptions = {\n\t\t\t\tinclude: 'all',\n\t\t\t};\n\n\t\t\tconst newItem = await manual.execute.call(\n\t\t\t\tthis,\n\t\t\t\t{ json: { query } },\n\t\t\t\titemIndex,\n\t\t\t\toptions,\n\t\t\t\trawData,\n\t\t\t\tthis.getNode(),\n\t\t\t);\n\n\t\t\tconst items = [newItem] as INodeExecutionData[];\n\n\t\t\tlet receivedData: ExecuteWorkflowData;\n\t\t\ttry {\n\t\t\t\treceivedData = await this.executeWorkflow(workflowInfo, items, runManager?.getChild(), {\n\t\t\t\t\tparentExecution: {\n\t\t\t\t\t\texecutionId: workflowProxy.$execution.id,\n\t\t\t\t\t\tworkflowId: workflowProxy.$workflow.id,\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t\tsubExecutionId = receivedData.executionId;\n\t\t\t} catch (error) {\n\t\t\t\t// Make sure a valid error gets returned that can by json-serialized else it will\n\t\t\t\t// not show up in the frontend\n\t\t\t\tthrow new NodeOperationError(this.getNode(), error as Error);\n\t\t\t}\n\n\t\t\tconst response: string | undefined = get(receivedData, 'data[0][0].json') as\n\t\t\t\t| string\n\t\t\t\t| undefined;\n\t\t\tif (response === undefined) {\n\t\t\t\tthrow new NodeOperationError(\n\t\t\t\t\tthis.getNode(),\n\t\t\t\t\t'There was an error: \"The workflow did not return a response\"',\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn response;\n\t\t};\n\n\t\tconst toolHandler = async (\n\t\t\tquery: string | IDataObject,\n\t\t\trunManager?: CallbackManagerForToolRun,\n\t\t): Promise<string> => {\n\t\t\tconst { index } = this.addInputData(NodeConnectionTypes.AiTool, [[{ json: { query } }]]);\n\n\t\t\tlet response: string = '';\n\t\t\tlet executionError: ExecutionError | undefined;\n\t\t\ttry {\n\t\t\t\tresponse = await runFunction(query, runManager);\n\t\t\t} catch (error) {\n\t\t\t\t// TODO: Do some more testing. Issues here should actually fail the workflow\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n\t\t\t\texecutionError = error;\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n\t\t\t\tresponse = `There was an error: \"${error.message}\"`;\n\t\t\t}\n\n\t\t\tif (typeof response === 'number') {\n\t\t\t\tresponse = (response as number).toString();\n\t\t\t}\n\n\t\t\tif (isObject(response)) {\n\t\t\t\tresponse = JSON.stringify(response, null, 2);\n\t\t\t}\n\n\t\t\tif (typeof response !== 'string') {\n\t\t\t\t// TODO: Do some more testing. Issues here should actually fail the workflow\n\t\t\t\texecutionError = new NodeOperationError(this.getNode(), 'Wrong output type returned', {\n\t\t\t\t\tdescription: `The response property should be a string, but it is an ${typeof response}`,\n\t\t\t\t});\n\t\t\t\tresponse = `There was an error: \"${executionError.message}\"`;\n\t\t\t}\n\n\t\t\tlet metadata: ITaskMetadata | undefined;\n\t\t\tif (subExecutionId && subWorkflowId) {\n\t\t\t\tmetadata = {\n\t\t\t\t\tsubExecution: {\n\t\t\t\t\t\texecutionId: subExecutionId,\n\t\t\t\t\t\tworkflowId: subWorkflowId,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tif (executionError) {\n\t\t\t\tvoid this.addOutputData(NodeConnectionTypes.AiTool, index, executionError, metadata);\n\t\t\t} else {\n\t\t\t\t// Output always needs to be an object\n\t\t\t\t// so we try to parse the response as JSON and if it fails we just return the string wrapped in an object\n\t\t\t\tconst json = jsonParse<IDataObject>(response, { fallbackValue: { response } });\n\t\t\t\tvoid this.addOutputData(NodeConnectionTypes.AiTool, index, [[{ json }]], metadata);\n\t\t\t}\n\t\t\treturn response;\n\t\t};\n\n\t\tconst functionBase = {\n\t\t\tname,\n\t\t\tdescription,\n\t\t\tfunc: toolHandler,\n\t\t};\n\n\t\tif (useSchema) {\n\t\t\ttry {\n\t\t\t\t// We initialize these even though one of them will always be empty\n\t\t\t\t// it makes it easier to navigate the ternary operator\n\t\t\t\tconst jsonExample = this.getNodeParameter('jsonSchemaExample', itemIndex, '') as string;\n\t\t\t\tconst inputSchema = this.getNodeParameter('inputSchema', itemIndex, '') as string;\n\n\t\t\t\tconst schemaType = this.getNodeParameter('schemaType', itemIndex) as 'fromJson' | 'manual';\n\t\t\t\tconst jsonSchema =\n\t\t\t\t\tschemaType === 'fromJson'\n\t\t\t\t\t\t? generateSchema(jsonExample)\n\t\t\t\t\t\t: jsonParse<JSONSchema7>(inputSchema);\n\n\t\t\t\tconst zodSchema = convertJsonSchemaToZod<DynamicZodObject>(jsonSchema);\n\n\t\t\t\ttool = new DynamicStructuredTool({\n\t\t\t\t\tschema: zodSchema,\n\t\t\t\t\t...functionBase,\n\t\t\t\t});\n\t\t\t} catch (error) {\n\t\t\t\tthrow new NodeOperationError(\n\t\t\t\t\tthis.getNode(),\n\t\t\t\t\t'Error during parsing of JSON Schema. \\n ' + error,\n\t\t\t\t);\n\t\t\t}\n\t\t} else {\n\t\t\ttool = new DynamicTool(functionBase);\n\t\t}\n\n\t\treturn {\n\t\t\tresponse: tool,\n\t\t};\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAmD;AAEnD,iBAAgB;AAChB,sBAAqB;AAErB,aAAwB;AAgBxB,0BAAmE;AAEnE,gCAAmC;AAEnC,2BAAuD;AAEhD,MAAM,eAAoC;AAAA,EAGhD,YAAY,iBAA2C;AACtD,SAAK,cAAc;AAAA,MAClB,GAAG;AAAA,MACH,GAAG;AAAA,IACJ;AAAA,EACD;AAAA,EAEA,MAAM,WAAuC,WAAwC;AACpF,UAAM,gBAAgB,KAAK,qBAAqB,CAAC;AAEjD,UAAM,OAAO,KAAK,iBAAiB,QAAQ,SAAS;AACpD,UAAM,cAAc,KAAK,iBAAiB,eAAe,SAAS;AAElE,QAAI;AACJ,QAAI;AAEJ,UAAM,YAAY,KAAK,iBAAiB,sBAAsB,SAAS;AACvE,QAAI,OAAwD;AAE5D,UAAM,cAAc,OACnB,OACA,eACqB;AACrB,YAAM,SAAS,KAAK,iBAAiB,UAAU,SAAS;AACxD,YAAM,eAAqC,CAAC;AAC5C,UAAI,WAAW,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K,cAAc,wCAAoB,QAAQ,OAAO,gBAAgB,QAAQ;AAAA,MACpF,OAAO;AAGN,cAAM,WAAO,+BAAuB,UAAU,EAAE,eAAe,EAAE,SAAS,EAAE,CAAC;AAC7E,aAAK,KAAK,cAAc,wCAAoB,QAAQ,OAAO,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,GAAG,QAAQ;AAAA,MAClF;AACA,aAAO;AAAA,IACR;AAEA,UAAM,eAAe;AAAA,MACpB;AAAA,MACA;AAAA,MACA,MAAM;AAAA,IACP;AAEA,QAAI,WAAW;AACd,UAAI;AAGH,cAAM,cAAc,KAAK,iBAAiB,qBAAqB,WAAW,EAAE;AAC5E,cAAM,cAAc,KAAK,iBAAiB,eAAe,WAAW,EAAE;AAEtE,cAAM,aAAa,KAAK,iBAAiB,cAAc,SAAS;AAChE,cAAM,aACL,eAAe,iBACZ,qCAAe,WAAW,QAC1B,+BAAuB,WAAW;AAEtC,cAAM,gBAAY,6CAAyC,UAAU;AAErE,eAAO,IAAI,mCAAsB;AAAA,UAChC,QAAQ;AAAA,UACR,GAAG;AAAA,QACJ,CAAC;AAAA,MACF,SAAS,OAAO;AACf,cAAM,IAAI;AAAA,UACT,KAAK,QAAQ;AAAA,UACb,6CAA6C;AAAA,QAC9C;AAAA,MACD;AAAA,IACD,OAAO;AACN,aAAO,IAAI,yBAAY,YAAY;AAAA,IACpC;AAEA,WAAO;AAAA,MACN,UAAU;AAAA,IACX;AAAA,EACD;AACD;","names":["get","isObject"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../nodes/tools/ToolWorkflow/v1/versionDescription.ts"],"sourcesContent":["/* eslint-disable n8n-nodes-base/node-filename-against-convention */\n/* eslint-disable n8n-nodes-base/node-dirname-against-convention */\nimport type { INodeTypeDescription } from 'n8n-workflow';\nimport { NodeConnectionTypes } from 'n8n-workflow';\n\nimport {\n\tinputSchemaField,\n\tjsonSchemaExampleField,\n\tschemaTypeField,\n} from '../../../../utils/descriptions';\nimport { getConnectionHintNoticeField } from '../../../../utils/sharedFields';\n\nexport const versionDescription: INodeTypeDescription = {\n\tdisplayName: 'Call n8n Workflow Tool',\n\tname: 'toolWorkflow',\n\tgroup: ['transform'],\n\tversion: [1, 1.1, 1.2, 1.3],\n\tdescription: 'Uses another n8n workflow as a tool. Allows packaging any n8n node(s) as a tool.',\n\tdefaults: {\n\t\tname: 'Call n8n Workflow Tool',\n\t},\n\tcodex: {\n\t\tcategories: ['AI'],\n\t\tsubcategories: {\n\t\t\tAI: ['Tools'],\n\t\t\tTools: ['Recommended Tools'],\n\t\t},\n\t\tresources: {\n\t\t\tprimaryDocumentation: [\n\t\t\t\t{\n\t\t\t\t\turl: 'https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.toolworkflow/',\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t},\n\t// eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node\n\tinputs: [],\n\t// eslint-disable-next-line n8n-nodes-base/node-class-description-outputs-wrong\n\toutputs: [NodeConnectionTypes.AiTool],\n\toutputNames: ['Tool'],\n\tproperties: [\n\t\tgetConnectionHintNoticeField([NodeConnectionTypes.AiAgent]),\n\t\t{\n\t\t\tdisplayName:\n\t\t\t\t'See an example of a workflow to suggest meeting slots using AI <a href=\"/templates/1953\" target=\"_blank\">here</a>.',\n\t\t\tname: 'noticeTemplateExample',\n\t\t\ttype: 'notice',\n\t\t\tdefault: '',\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Name',\n\t\t\tname: 'name',\n\t\t\ttype: 'string',\n\t\t\tdefault: '',\n\t\t\tplaceholder: 'My_Color_Tool',\n\t\t\tdisplayOptions: {\n\t\t\t\tshow: {\n\t\t\t\t\t'@version': [1],\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Name',\n\t\t\tname: 'name',\n\t\t\ttype: 'string',\n\t\t\tdefault: '',\n\t\t\tplaceholder: 'e.g. My_Color_Tool',\n\t\t\tvalidateType: 'string-alphanumeric',\n\t\t\tdescription:\n\t\t\t\t'The name of the function to be called, could contain letters, numbers, and underscores only',\n\t\t\tdisplayOptions: {\n\t\t\t\tshow: {\n\t\t\t\t\t'@version': [{ _cnd: { gte: 1.1 } }],\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Description',\n\t\t\tname: 'description',\n\t\t\ttype: 'string',\n\t\t\tdefault: '',\n\t\t\tplaceholder:\n\t\t\t\t'Call this tool to get a random color. The input should be a string with comma separted names of colors to exclude.',\n\t\t\ttypeOptions: {\n\t\t\t\trows: 3,\n\t\t\t},\n\t\t},\n\n\t\t{\n\t\t\tdisplayName:\n\t\t\t\t'This tool will call the workflow you define below, and look in the last node for the response. The workflow needs to start with an Execute Workflow trigger',\n\t\t\tname: 'executeNotice',\n\t\t\ttype: 'notice',\n\t\t\tdefault: '',\n\t\t},\n\n\t\t{\n\t\t\tdisplayName: 'Source',\n\t\t\tname: 'source',\n\t\t\ttype: 'options',\n\t\t\toptions: [\n\t\t\t\t{\n\t\t\t\t\tname: 'Database',\n\t\t\t\t\tvalue: 'database',\n\t\t\t\t\tdescription: 'Load the workflow from the database by ID',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: 'Define Below',\n\t\t\t\t\tvalue: 'parameter',\n\t\t\t\t\tdescription: 'Pass the JSON code of a workflow',\n\t\t\t\t},\n\t\t\t],\n\t\t\tdefault: 'database',\n\t\t\tdescription: 'Where to get the workflow to execute from',\n\t\t},\n\n\t\t// ----------------------------------\n\t\t// source:database\n\t\t// ----------------------------------\n\t\t{\n\t\t\tdisplayName: 'Workflow ID',\n\t\t\tname: 'workflowId',\n\t\t\ttype: 'string',\n\t\t\tdisplayOptions: {\n\t\t\t\tshow: {\n\t\t\t\t\tsource: ['database'],\n\t\t\t\t\t'@version': [{ _cnd: { lte: 1.1 } }],\n\t\t\t\t},\n\t\t\t},\n\t\t\tdefault: '',\n\t\t\trequired: true,\n\t\t\tdescription: 'The workflow to execute',\n\t\t\thint: 'Can be found in the URL of the workflow',\n\t\t},\n\n\t\t{\n\t\t\tdisplayName: 'Workflow',\n\t\t\tname: 'workflowId',\n\t\t\ttype: 'workflowSelector',\n\t\t\tdisplayOptions: {\n\t\t\t\tshow: {\n\t\t\t\t\tsource: ['database'],\n\t\t\t\t\t'@version': [{ _cnd: { gte: 1.2 } }],\n\t\t\t\t},\n\t\t\t},\n\t\t\tdefault: '',\n\t\t\trequired: true,\n\t\t},\n\n\t\t// ----------------------------------\n\t\t// source:parameter\n\t\t// ----------------------------------\n\t\t{\n\t\t\tdisplayName: 'Workflow JSON',\n\t\t\tname: 'workflowJson',\n\t\t\ttype: 'json',\n\t\t\ttypeOptions: {\n\t\t\t\trows: 10,\n\t\t\t},\n\t\t\tdisplayOptions: {\n\t\t\t\tshow: {\n\t\t\t\t\tsource: ['parameter'],\n\t\t\t\t},\n\t\t\t},\n\t\t\tdefault: '\\n\\n\\n\\n\\n\\n\\n\\n\\n',\n\t\t\trequired: true,\n\t\t\tdescription: 'The workflow JSON code to execute',\n\t\t},\n\t\t// ----------------------------------\n\t\t// For all\n\t\t// ----------------------------------\n\t\t{\n\t\t\tdisplayName: 'Field to Return',\n\t\t\tname: 'responsePropertyName',\n\t\t\ttype: 'string',\n\t\t\tdefault: 'response',\n\t\t\trequired: true,\n\t\t\thint: 'The field in the last-executed node of the workflow that contains the response',\n\t\t\tdescription:\n\t\t\t\t'Where to find the data that this tool should return. n8n will look in the output of the last-executed node of the workflow for a field with this name, and return its value.',\n\t\t\tdisplayOptions: {\n\t\t\t\tshow: {\n\t\t\t\t\t'@version': [{ _cnd: { lt: 1.3 } }],\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Extra Workflow Inputs',\n\t\t\tname: 'fields',\n\t\t\tplaceholder: 'Add Value',\n\t\t\ttype: 'fixedCollection',\n\t\t\tdescription:\n\t\t\t\t\"These will be output by the 'execute workflow' trigger of the workflow being called\",\n\t\t\ttypeOptions: {\n\t\t\t\tmultipleValues: true,\n\t\t\t\tsortable: true,\n\t\t\t},\n\t\t\tdefault: {},\n\t\t\toptions: [\n\t\t\t\t{\n\t\t\t\t\tname: 'values',\n\t\t\t\t\tdisplayName: 'Values',\n\t\t\t\t\tvalues: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tdisplayName: 'Name',\n\t\t\t\t\t\t\tname: 'name',\n\t\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\t\tdefault: '',\n\t\t\t\t\t\t\tplaceholder: 'e.g. fieldName',\n\t\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\t'Name of the field to set the value of. Supports dot-notation. Example: data.person[0].name.',\n\t\t\t\t\t\t\trequiresDataPath: 'single',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tdisplayName: 'Type',\n\t\t\t\t\t\t\tname: 'type',\n\t\t\t\t\t\t\ttype: 'options',\n\t\t\t\t\t\t\tdescription: 'The field value type',\n\t\t\t\t\t\t\t// eslint-disable-next-line n8n-nodes-base/node-param-options-type-unsorted-items\n\t\t\t\t\t\t\toptions: [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tname: 'String',\n\t\t\t\t\t\t\t\t\tvalue: 'stringValue',\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tname: 'Number',\n\t\t\t\t\t\t\t\t\tvalue: 'numberValue',\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tname: 'Boolean',\n\t\t\t\t\t\t\t\t\tvalue: 'booleanValue',\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tname: 'Array',\n\t\t\t\t\t\t\t\t\tvalue: 'arrayValue',\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tname: 'Object',\n\t\t\t\t\t\t\t\t\tvalue: 'objectValue',\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\tdefault: 'stringValue',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tdisplayName: 'Value',\n\t\t\t\t\t\t\tname: 'stringValue',\n\t\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\t\tdefault: '',\n\t\t\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\t\t\tshow: {\n\t\t\t\t\t\t\t\t\ttype: ['stringValue'],\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tvalidateType: 'string',\n\t\t\t\t\t\t\tignoreValidationDuringExecution: true,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tdisplayName: 'Value',\n\t\t\t\t\t\t\tname: 'numberValue',\n\t\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\t\tdefault: '',\n\t\t\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\t\t\tshow: {\n\t\t\t\t\t\t\t\t\ttype: ['numberValue'],\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tvalidateType: 'number',\n\t\t\t\t\t\t\tignoreValidationDuringExecution: true,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tdisplayName: 'Value',\n\t\t\t\t\t\t\tname: 'booleanValue',\n\t\t\t\t\t\t\ttype: 'options',\n\t\t\t\t\t\t\tdefault: 'true',\n\t\t\t\t\t\t\toptions: [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tname: 'True',\n\t\t\t\t\t\t\t\t\tvalue: 'true',\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tname: 'False',\n\t\t\t\t\t\t\t\t\tvalue: 'false',\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\t\t\tshow: {\n\t\t\t\t\t\t\t\t\ttype: ['booleanValue'],\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tvalidateType: 'boolean',\n\t\t\t\t\t\t\tignoreValidationDuringExecution: true,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tdisplayName: 'Value',\n\t\t\t\t\t\t\tname: 'arrayValue',\n\t\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\t\tdefault: '',\n\t\t\t\t\t\t\tplaceholder: 'e.g. [ arrayItem1, arrayItem2, arrayItem3 ]',\n\t\t\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\t\t\tshow: {\n\t\t\t\t\t\t\t\t\ttype: ['arrayValue'],\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tvalidateType: 'array',\n\t\t\t\t\t\t\tignoreValidationDuringExecution: true,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tdisplayName: 'Value',\n\t\t\t\t\t\t\tname: 'objectValue',\n\t\t\t\t\t\t\ttype: 'json',\n\t\t\t\t\t\t\tdefault: '={}',\n\t\t\t\t\t\t\ttypeOptions: {\n\t\t\t\t\t\t\t\trows: 2,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\t\t\tshow: {\n\t\t\t\t\t\t\t\t\ttype: ['objectValue'],\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tvalidateType: 'object',\n\t\t\t\t\t\t\tignoreValidationDuringExecution: true,\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\t// ----------------------------------\n\t\t// Output Parsing\n\t\t// ----------------------------------\n\t\t{\n\t\t\tdisplayName: 'Specify Input Schema',\n\t\t\tname: 'specifyInputSchema',\n\t\t\ttype: 'boolean',\n\t\t\tdescription:\n\t\t\t\t'Whether to specify the schema for the function. This would require the LLM to provide the input in the correct format and would validate it against the schema.',\n\t\t\tnoDataExpression: true,\n\t\t\tdefault: false,\n\t\t},\n\t\t{ ...schemaTypeField, displayOptions: { show: { specifyInputSchema: [true] } } },\n\t\tjsonSchemaExampleField,\n\t\tinputSchemaField,\n\t],\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,0BAAoC;AAEpC,0BAIO;AACP,0BAA6C;AAEtC,MAAM,qBAA2C;AAAA,EACvD,aAAa;AAAA,EACb,MAAM;AAAA,EACN,OAAO,CAAC,WAAW;AAAA,EACnB,SAAS,CAAC,GAAG,KAAK,KAAK,GAAG;AAAA,EAC1B,aAAa;AAAA,EACb,UAAU;AAAA,IACT,MAAM;AAAA,EACP;AAAA,EACA,OAAO;AAAA,IACN,YAAY,CAAC,IAAI;AAAA,IACjB,eAAe;AAAA,MACd,IAAI,CAAC,OAAO;AAAA,MACZ,OAAO,CAAC,mBAAmB;AAAA,IAC5B;AAAA,IACA,WAAW;AAAA,MACV,sBAAsB;AAAA,QACrB;AAAA,UACC,KAAK;AAAA,QACN;AAAA,MACD;AAAA,IACD;AAAA,EACD;AAAA;AAAA,EAEA,QAAQ,CAAC;AAAA;AAAA,EAET,SAAS,CAAC,wCAAoB,MAAM;AAAA,EACpC,aAAa,CAAC,MAAM;AAAA,EACpB,YAAY;AAAA,QACX,kDAA6B,CAAC,wCAAoB,OAAO,CAAC;AAAA,IAC1D;AAAA,MACC,aACC;AAAA,MACD,MAAM;AAAA,MACN,MAAM;AAAA,MACN,SAAS;AAAA,IACV;AAAA,IACA;AAAA,MACC,aAAa;AAAA,MACb,MAAM;AAAA,MACN,MAAM;AAAA,MACN,SAAS;AAAA,MACT,aAAa;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b,MAAM;AAAA,cACN,MAAM;AAAA,cACN,SAAS;AAAA,cACT,aAAa;AAAA,cACb,gBAAgB;AAAA,gBACf,MAAM;AAAA,kBACL,MAAM,CAAC,YAAY;AAAA,gBACpB;AAAA,cACD;AAAA,cACA,cAAc;AAAA,cACd,iCAAiC;AAAA,YAClC;AAAA,YACA;AAAA,cACC,aAAa;AAAA,cACb,MAAM;AAAA,cACN,MAAM;AAAA,cACN,SAAS;AAAA,cACT,aAAa;AAAA,gBACZ,MAAM;AAAA,cACP;AAAA,cACA,gBAAgB;AAAA,gBACf,MAAM;AAAA,kBACL,MAAM,CAAC,aAAa;AAAA,gBACrB;AAAA,cACD;AAAA,cACA,cAAc;AAAA,cACd,iCAAiC;AAAA,YAClC;AAAA,UACD;AAAA,QACD;AAAA,MACD;AAAA,IACD;AAAA;AAAA;AAAA;AAAA,IAIA;AAAA,MACC,aAAa;AAAA,MACb,MAAM;AAAA,MACN,MAAM;AAAA,MACN,aACC;AAAA,MACD,kBAAkB;AAAA,MAClB,SAAS;AAAA,IACV;AAAA,IACA,EAAE,GAAG,qCAAiB,gBAAgB,EAAE,MAAM,EAAE,oBAAoB,CAAC,IAAI,EAAE,EAAE,EAAE;AAAA,IAC/E;AAAA,IACA;AAAA,EACD;AACD;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../nodes/tools/ToolWorkflow/v2/ToolWorkflowV2.node.ts"],"sourcesContent":["import type {\n\tINodeTypeBaseDescription,\n\tISupplyDataFunctions,\n\tSupplyData,\n\tINodeType,\n\tINodeTypeDescription,\n} from 'n8n-workflow';\n\nimport { localResourceMapping } from './methods';\nimport { WorkflowToolService } from './utils/WorkflowToolService';\nimport { versionDescription } from './versionDescription';\n\nexport class ToolWorkflowV2 implements INodeType {\n\tdescription: INodeTypeDescription;\n\n\tconstructor(baseDescription: INodeTypeBaseDescription) {\n\t\tthis.description = {\n\t\t\t...baseDescription,\n\t\t\t...versionDescription,\n\t\t};\n\t}\n\n\tmethods = {\n\t\tlocalResourceMapping,\n\t};\n\n\tasync supplyData(this: ISupplyDataFunctions, itemIndex: number): Promise<SupplyData> {\n\t\tconst returnAllItems = this.getNode().typeVersion > 2;\n\n\t\tconst workflowToolService = new WorkflowToolService(this, { returnAllItems });\n\t\tconst name = this.getNodeParameter('name', itemIndex) as string;\n\t\tconst description = this.getNodeParameter('description', itemIndex) as string;\n\n\t\tconst tool = await workflowToolService.createTool({\n\t\t\tname,\n\t\t\tdescription,\n\t\t\titemIndex,\n\t\t});\n\n\t\treturn { response: tool };\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAQA,qBAAqC;AACrC,iCAAoC;AACpC,gCAAmC;AAE5B,MAAM,eAAoC;AAAA,EAGhD,YAAY,iBAA2C;AAOvD,mBAAU;AAAA,MACT;AAAA,IACD;AARC,SAAK,cAAc;AAAA,MAClB,GAAG;AAAA,MACH,GAAG;AAAA,IACJ;AAAA,EACD;AAAA,EAMA,MAAM,WAAuC,WAAwC;AACpF,UAAM,iBAAiB,KAAK,QAAQ,EAAE,cAAc;AAEpD,UAAM,sBAAsB,IAAI,+CAAoB,MAAM,EAAE,eAAe,CAAC;AAC5E,UAAM,OAAO,KAAK,iBAAiB,QAAQ,SAAS;AACpD,UAAM,cAAc,KAAK,iBAAiB,eAAe,SAAS;AAElE,UAAM,OAAO,MAAM,oBAAoB,WAAW;AAAA,MACjD;AAAA,MACA;AAAA,MACA;AAAA,IACD,CAAC;AAED,WAAO,EAAE,UAAU,KAAK;AAAA,EACzB;AACD;","names":[]}
|