@alpic80/rivet-core 1.19.1-aidon.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/LICENSE +7 -0
- package/README.md +176 -0
- package/dist/cjs/bundle.cjs +18915 -0
- package/dist/cjs/bundle.cjs.map +7 -0
- package/dist/esm/api/createProcessor.js +131 -0
- package/dist/esm/api/streaming.js +116 -0
- package/dist/esm/exports.js +32 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/integrations/AudioProvider.js +1 -0
- package/dist/esm/integrations/DatasetProvider.js +92 -0
- package/dist/esm/integrations/EmbeddingGenerator.js +1 -0
- package/dist/esm/integrations/GptTokenizerTokenizer.js +65 -0
- package/dist/esm/integrations/LLMProvider.js +1 -0
- package/dist/esm/integrations/Tokenizer.js +1 -0
- package/dist/esm/integrations/VectorDatabase.js +1 -0
- package/dist/esm/integrations/enableIntegrations.js +3 -0
- package/dist/esm/integrations/integrations.js +19 -0
- package/dist/esm/integrations/openai/OpenAIEmbeddingGenerator.js +23 -0
- package/dist/esm/model/DataValue.js +176 -0
- package/dist/esm/model/Dataset.js +1 -0
- package/dist/esm/model/EditorDefinition.js +1 -0
- package/dist/esm/model/GraphProcessor.js +1198 -0
- package/dist/esm/model/NodeBase.js +1 -0
- package/dist/esm/model/NodeBodySpec.js +1 -0
- package/dist/esm/model/NodeDefinition.js +12 -0
- package/dist/esm/model/NodeGraph.js +14 -0
- package/dist/esm/model/NodeImpl.js +49 -0
- package/dist/esm/model/NodeRegistration.js +144 -0
- package/dist/esm/model/Nodes.js +227 -0
- package/dist/esm/model/PluginLoadSpec.js +1 -0
- package/dist/esm/model/ProcessContext.js +1 -0
- package/dist/esm/model/Project.js +2 -0
- package/dist/esm/model/RivetPlugin.js +1 -0
- package/dist/esm/model/RivetUIContext.js +1 -0
- package/dist/esm/model/Settings.js +1 -0
- package/dist/esm/model/nodes/AbortGraphNode.js +100 -0
- package/dist/esm/model/nodes/AppendToDatasetNode.js +115 -0
- package/dist/esm/model/nodes/ArrayNode.js +144 -0
- package/dist/esm/model/nodes/AssembleMessageNode.js +199 -0
- package/dist/esm/model/nodes/AssemblePromptNode.js +129 -0
- package/dist/esm/model/nodes/AudioNode.js +101 -0
- package/dist/esm/model/nodes/BooleanNode.js +74 -0
- package/dist/esm/model/nodes/CallGraphNode.js +136 -0
- package/dist/esm/model/nodes/ChatNode.js +964 -0
- package/dist/esm/model/nodes/ChunkNode.js +166 -0
- package/dist/esm/model/nodes/CoalesceNode.js +104 -0
- package/dist/esm/model/nodes/CodeNode.js +136 -0
- package/dist/esm/model/nodes/CommentNode.js +69 -0
- package/dist/esm/model/nodes/CompareNode.js +138 -0
- package/dist/esm/model/nodes/ContextNode.js +99 -0
- package/dist/esm/model/nodes/CreateDatasetNode.js +71 -0
- package/dist/esm/model/nodes/DatasetNearestNeigborsNode.js +97 -0
- package/dist/esm/model/nodes/DelayNode.js +105 -0
- package/dist/esm/model/nodes/DelegateFunctionCallNode.js +136 -0
- package/dist/esm/model/nodes/DestructureNode.js +86 -0
- package/dist/esm/model/nodes/EvaluateNode.js +141 -0
- package/dist/esm/model/nodes/ExternalCallNode.js +162 -0
- package/dist/esm/model/nodes/ExtractJsonNode.js +122 -0
- package/dist/esm/model/nodes/ExtractMarkdownCodeBlocksNode.js +100 -0
- package/dist/esm/model/nodes/ExtractObjectPathNode.js +128 -0
- package/dist/esm/model/nodes/ExtractRegexNode.js +201 -0
- package/dist/esm/model/nodes/ExtractYamlNode.js +214 -0
- package/dist/esm/model/nodes/FilterNode.js +73 -0
- package/dist/esm/model/nodes/GetAllDatasetsNode.js +53 -0
- package/dist/esm/model/nodes/GetDatasetRowNode.js +99 -0
- package/dist/esm/model/nodes/GetEmbeddingNode.js +130 -0
- package/dist/esm/model/nodes/GetGlobalNode.js +139 -0
- package/dist/esm/model/nodes/GptFunctionNode.js +169 -0
- package/dist/esm/model/nodes/GraphInputNode.js +130 -0
- package/dist/esm/model/nodes/GraphOutputNode.js +104 -0
- package/dist/esm/model/nodes/GraphReferenceNode.js +128 -0
- package/dist/esm/model/nodes/HashNode.js +97 -0
- package/dist/esm/model/nodes/HttpCallNode.js +257 -0
- package/dist/esm/model/nodes/IfElseNode.js +138 -0
- package/dist/esm/model/nodes/IfNode.js +124 -0
- package/dist/esm/model/nodes/ImageNode.js +107 -0
- package/dist/esm/model/nodes/JoinNode.js +135 -0
- package/dist/esm/model/nodes/ListGraphsNode.js +61 -0
- package/dist/esm/model/nodes/LoadDatasetNode.js +83 -0
- package/dist/esm/model/nodes/LoopControllerNode.js +206 -0
- package/dist/esm/model/nodes/MatchNode.js +137 -0
- package/dist/esm/model/nodes/NumberNode.js +86 -0
- package/dist/esm/model/nodes/ObjectNode.js +121 -0
- package/dist/esm/model/nodes/PassthroughNode.js +78 -0
- package/dist/esm/model/nodes/PlayAudioNode.js +61 -0
- package/dist/esm/model/nodes/PopNode.js +89 -0
- package/dist/esm/model/nodes/PromptNode.js +227 -0
- package/dist/esm/model/nodes/RaceInputsNode.js +86 -0
- package/dist/esm/model/nodes/RaiseEventNode.js +84 -0
- package/dist/esm/model/nodes/RandomNumberNode.js +106 -0
- package/dist/esm/model/nodes/ReadDirectoryNode.js +165 -0
- package/dist/esm/model/nodes/ReadFileNode.js +114 -0
- package/dist/esm/model/nodes/ReplaceDatasetNode.js +118 -0
- package/dist/esm/model/nodes/SetGlobalNode.js +124 -0
- package/dist/esm/model/nodes/ShuffleNode.js +64 -0
- package/dist/esm/model/nodes/SliceNode.js +100 -0
- package/dist/esm/model/nodes/SplitNode.js +101 -0
- package/dist/esm/model/nodes/SubGraphNode.js +181 -0
- package/dist/esm/model/nodes/TextNode.js +97 -0
- package/dist/esm/model/nodes/ToJsonNode.js +78 -0
- package/dist/esm/model/nodes/ToYamlNode.js +68 -0
- package/dist/esm/model/nodes/TrimChatMessagesNode.js +120 -0
- package/dist/esm/model/nodes/URLReferenceNode.js +79 -0
- package/dist/esm/model/nodes/UserInputNode.js +111 -0
- package/dist/esm/model/nodes/VectorNearestNeighborsNode.js +127 -0
- package/dist/esm/model/nodes/VectorStoreNode.js +124 -0
- package/dist/esm/model/nodes/WaitForEventNode.js +88 -0
- package/dist/esm/native/BaseDir.js +32 -0
- package/dist/esm/native/BrowserNativeApi.js +19 -0
- package/dist/esm/native/NativeApi.js +1 -0
- package/dist/esm/plugins/aidon/index.js +2 -0
- package/dist/esm/plugins/aidon/nodes/ChatAidonNode.js +215 -0
- package/dist/esm/plugins/aidon/plugin.js +9 -0
- package/dist/esm/plugins/anthropic/anthropic.js +187 -0
- package/dist/esm/plugins/anthropic/fetchEventSource.js +106 -0
- package/dist/esm/plugins/anthropic/index.js +2 -0
- package/dist/esm/plugins/anthropic/nodes/ChatAnthropicNode.js +652 -0
- package/dist/esm/plugins/anthropic/plugin.js +18 -0
- package/dist/esm/plugins/assemblyAi/LemurActionItemsNode.js +75 -0
- package/dist/esm/plugins/assemblyAi/LemurQaNode.js +155 -0
- package/dist/esm/plugins/assemblyAi/LemurSummaryNode.js +79 -0
- package/dist/esm/plugins/assemblyAi/LemurTaskNode.js +82 -0
- package/dist/esm/plugins/assemblyAi/TranscribeAudioNode.js +125 -0
- package/dist/esm/plugins/assemblyAi/index.js +2 -0
- package/dist/esm/plugins/assemblyAi/lemurHelpers.js +114 -0
- package/dist/esm/plugins/assemblyAi/plugin.js +32 -0
- package/dist/esm/plugins/autoevals/AutoEvalsNode.js +223 -0
- package/dist/esm/plugins/autoevals/index.js +2 -0
- package/dist/esm/plugins/autoevals/plugin.js +8 -0
- package/dist/esm/plugins/gentrace/index.js +2 -0
- package/dist/esm/plugins/gentrace/plugin.js +192 -0
- package/dist/esm/plugins/google/google.js +60 -0
- package/dist/esm/plugins/google/index.js +2 -0
- package/dist/esm/plugins/google/nodes/ChatGoogleNode.js +364 -0
- package/dist/esm/plugins/google/plugin.js +32 -0
- package/dist/esm/plugins/huggingface/index.js +2 -0
- package/dist/esm/plugins/huggingface/nodes/ChatHuggingFace.js +243 -0
- package/dist/esm/plugins/huggingface/nodes/TextToImageHuggingFace.js +189 -0
- package/dist/esm/plugins/huggingface/plugin.js +26 -0
- package/dist/esm/plugins/openai/handleOpenaiError.js +17 -0
- package/dist/esm/plugins/openai/index.js +2 -0
- package/dist/esm/plugins/openai/nodes/AttachAssistantFileNode.js +123 -0
- package/dist/esm/plugins/openai/nodes/CreateAssistantNode.js +289 -0
- package/dist/esm/plugins/openai/nodes/CreateThreadMessageNode.js +176 -0
- package/dist/esm/plugins/openai/nodes/CreateThreadNode.js +157 -0
- package/dist/esm/plugins/openai/nodes/DeleteAssistantNode.js +104 -0
- package/dist/esm/plugins/openai/nodes/DeleteThreadNode.js +97 -0
- package/dist/esm/plugins/openai/nodes/GetAssistantNode.js +118 -0
- package/dist/esm/plugins/openai/nodes/GetOpenAIFileNode.js +100 -0
- package/dist/esm/plugins/openai/nodes/GetThreadNode.js +108 -0
- package/dist/esm/plugins/openai/nodes/ListAssistantsNode.js +202 -0
- package/dist/esm/plugins/openai/nodes/ListOpenAIFilesNode.js +94 -0
- package/dist/esm/plugins/openai/nodes/ListThreadMessagesNode.js +224 -0
- package/dist/esm/plugins/openai/nodes/RunThreadNode.js +630 -0
- package/dist/esm/plugins/openai/nodes/ThreadMessageNode.js +145 -0
- package/dist/esm/plugins/openai/nodes/UploadFileNode.js +121 -0
- package/dist/esm/plugins/openai/plugin.js +44 -0
- package/dist/esm/plugins/pinecone/PineconeVectorDatabase.js +88 -0
- package/dist/esm/plugins/pinecone/index.js +2 -0
- package/dist/esm/plugins/pinecone/plugin.js +19 -0
- package/dist/esm/plugins.js +21 -0
- package/dist/esm/recording/ExecutionRecorder.js +177 -0
- package/dist/esm/recording/RecordedEvents.js +1 -0
- package/dist/esm/utils/assertNever.js +3 -0
- package/dist/esm/utils/base64.js +25 -0
- package/dist/esm/utils/chatMessageToOpenAIChatCompletionMessage.js +60 -0
- package/dist/esm/utils/coerceType.js +322 -0
- package/dist/esm/utils/compatibility.js +27 -0
- package/dist/esm/utils/copyToClipboard.js +10 -0
- package/dist/esm/utils/defaults.js +2 -0
- package/dist/esm/utils/errors.js +7 -0
- package/dist/esm/utils/expectType.js +34 -0
- package/dist/esm/utils/fetchEventSource.js +120 -0
- package/dist/esm/utils/genericUtilFunctions.js +25 -0
- package/dist/esm/utils/getPluginConfig.js +23 -0
- package/dist/esm/utils/handleEscapeCharacters.js +11 -0
- package/dist/esm/utils/index.js +14 -0
- package/dist/esm/utils/inputs.js +16 -0
- package/dist/esm/utils/interpolation.js +6 -0
- package/dist/esm/utils/misc.js +1 -0
- package/dist/esm/utils/newId.js +4 -0
- package/dist/esm/utils/openai.js +219 -0
- package/dist/esm/utils/outputs.js +14 -0
- package/dist/esm/utils/serialization/serialization.js +86 -0
- package/dist/esm/utils/serialization/serializationUtils.js +13 -0
- package/dist/esm/utils/serialization/serialization_v1.js +19 -0
- package/dist/esm/utils/serialization/serialization_v2.js +24 -0
- package/dist/esm/utils/serialization/serialization_v3.js +145 -0
- package/dist/esm/utils/serialization/serialization_v4.js +200 -0
- package/dist/esm/utils/symbols.js +2 -0
- package/dist/esm/utils/time.js +14 -0
- package/dist/esm/utils/typeSafety.js +42 -0
- package/dist/types/api/createProcessor.d.ts +37 -0
- package/dist/types/api/streaming.d.ts +56 -0
- package/dist/types/exports.d.ts +33 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/integrations/AudioProvider.d.ts +4 -0
- package/dist/types/integrations/DatasetProvider.d.ts +33 -0
- package/dist/types/integrations/EmbeddingGenerator.d.ts +3 -0
- package/dist/types/integrations/GptTokenizerTokenizer.d.ts +20 -0
- package/dist/types/integrations/LLMProvider.d.ts +7 -0
- package/dist/types/integrations/Tokenizer.d.ts +11 -0
- package/dist/types/integrations/VectorDatabase.d.ts +7 -0
- package/dist/types/integrations/enableIntegrations.d.ts +1 -0
- package/dist/types/integrations/integrations.d.ts +12 -0
- package/dist/types/integrations/openai/OpenAIEmbeddingGenerator.d.ts +10 -0
- package/dist/types/model/DataValue.d.ts +138 -0
- package/dist/types/model/Dataset.d.ts +19 -0
- package/dist/types/model/EditorDefinition.d.ts +142 -0
- package/dist/types/model/GraphProcessor.d.ts +192 -0
- package/dist/types/model/NodeBase.d.ts +110 -0
- package/dist/types/model/NodeBodySpec.d.ts +19 -0
- package/dist/types/model/NodeDefinition.d.ts +13 -0
- package/dist/types/model/NodeGraph.d.ts +15 -0
- package/dist/types/model/NodeImpl.d.ts +55 -0
- package/dist/types/model/NodeRegistration.d.ts +24 -0
- package/dist/types/model/Nodes.d.ts +84 -0
- package/dist/types/model/PluginLoadSpec.d.ts +17 -0
- package/dist/types/model/ProcessContext.d.ts +69 -0
- package/dist/types/model/Project.d.ts +17 -0
- package/dist/types/model/RivetPlugin.d.ts +45 -0
- package/dist/types/model/RivetUIContext.d.ts +18 -0
- package/dist/types/model/Settings.d.ts +15 -0
- package/dist/types/model/nodes/AbortGraphNode.d.ts +22 -0
- package/dist/types/model/nodes/AppendToDatasetNode.d.ts +21 -0
- package/dist/types/model/nodes/ArrayNode.d.ts +20 -0
- package/dist/types/model/nodes/AssembleMessageNode.d.ts +23 -0
- package/dist/types/model/nodes/AssemblePromptNode.d.ts +20 -0
- package/dist/types/model/nodes/AudioNode.d.ts +20 -0
- package/dist/types/model/nodes/BooleanNode.d.ts +19 -0
- package/dist/types/model/nodes/CallGraphNode.d.ts +16 -0
- package/dist/types/model/nodes/ChatNode.d.ts +77 -0
- package/dist/types/model/nodes/ChunkNode.d.ts +22 -0
- package/dist/types/model/nodes/CoalesceNode.d.ts +14 -0
- package/dist/types/model/nodes/CodeNode.d.ts +21 -0
- package/dist/types/model/nodes/CommentNode.d.ts +20 -0
- package/dist/types/model/nodes/CompareNode.d.ts +19 -0
- package/dist/types/model/nodes/ContextNode.d.ts +24 -0
- package/dist/types/model/nodes/CreateDatasetNode.d.ts +13 -0
- package/dist/types/model/nodes/DatasetNearestNeigborsNode.d.ts +19 -0
- package/dist/types/model/nodes/DelayNode.d.ts +20 -0
- package/dist/types/model/nodes/DelegateFunctionCallNode.d.ts +25 -0
- package/dist/types/model/nodes/DestructureNode.d.ts +18 -0
- package/dist/types/model/nodes/EvaluateNode.d.ts +19 -0
- package/dist/types/model/nodes/ExternalCallNode.d.ts +22 -0
- package/dist/types/model/nodes/ExtractJsonNode.d.ts +13 -0
- package/dist/types/model/nodes/ExtractMarkdownCodeBlocksNode.d.ts +12 -0
- package/dist/types/model/nodes/ExtractObjectPathNode.d.ts +19 -0
- package/dist/types/model/nodes/ExtractRegexNode.d.ts +22 -0
- package/dist/types/model/nodes/ExtractYamlNode.d.ts +21 -0
- package/dist/types/model/nodes/FilterNode.d.ts +13 -0
- package/dist/types/model/nodes/GetAllDatasetsNode.d.ts +14 -0
- package/dist/types/model/nodes/GetDatasetRowNode.d.ts +19 -0
- package/dist/types/model/nodes/GetEmbeddingNode.d.ts +24 -0
- package/dist/types/model/nodes/GetGlobalNode.d.ts +29 -0
- package/dist/types/model/nodes/GptFunctionNode.d.ts +25 -0
- package/dist/types/model/nodes/GraphInputNode.d.ts +24 -0
- package/dist/types/model/nodes/GraphOutputNode.d.ts +22 -0
- package/dist/types/model/nodes/GraphReferenceNode.d.ts +22 -0
- package/dist/types/model/nodes/HashNode.d.ts +17 -0
- package/dist/types/model/nodes/HttpCallNode.d.ts +27 -0
- package/dist/types/model/nodes/IfElseNode.d.ts +18 -0
- package/dist/types/model/nodes/IfNode.d.ts +17 -0
- package/dist/types/model/nodes/ImageNode.d.ts +20 -0
- package/dist/types/model/nodes/JoinNode.d.ts +21 -0
- package/dist/types/model/nodes/ListGraphsNode.d.ts +14 -0
- package/dist/types/model/nodes/LoadDatasetNode.d.ts +17 -0
- package/dist/types/model/nodes/LoopControllerNode.d.ts +20 -0
- package/dist/types/model/nodes/MatchNode.d.ts +19 -0
- package/dist/types/model/nodes/NumberNode.d.ts +21 -0
- package/dist/types/model/nodes/ObjectNode.d.ts +18 -0
- package/dist/types/model/nodes/PassthroughNode.d.ts +14 -0
- package/dist/types/model/nodes/PlayAudioNode.d.ts +15 -0
- package/dist/types/model/nodes/PopNode.d.ts +19 -0
- package/dist/types/model/nodes/PromptNode.d.ts +23 -0
- package/dist/types/model/nodes/RaceInputsNode.d.ts +17 -0
- package/dist/types/model/nodes/RaiseEventNode.d.ts +22 -0
- package/dist/types/model/nodes/RandomNumberNode.d.ts +23 -0
- package/dist/types/model/nodes/ReadDirectoryNode.d.ts +30 -0
- package/dist/types/model/nodes/ReadFileNode.d.ts +23 -0
- package/dist/types/model/nodes/ReplaceDatasetNode.d.ts +21 -0
- package/dist/types/model/nodes/SetGlobalNode.d.ts +23 -0
- package/dist/types/model/nodes/ShuffleNode.d.ts +12 -0
- package/dist/types/model/nodes/SliceNode.d.ts +22 -0
- package/dist/types/model/nodes/SplitNode.d.ts +19 -0
- package/dist/types/model/nodes/SubGraphNode.d.ts +29 -0
- package/dist/types/model/nodes/TextNode.d.ts +18 -0
- package/dist/types/model/nodes/ToJsonNode.d.ts +18 -0
- package/dist/types/model/nodes/ToYamlNode.d.ts +13 -0
- package/dist/types/model/nodes/TrimChatMessagesNode.d.ts +20 -0
- package/dist/types/model/nodes/URLReferenceNode.d.ts +19 -0
- package/dist/types/model/nodes/UserInputNode.d.ts +21 -0
- package/dist/types/model/nodes/VectorNearestNeighborsNode.d.ts +24 -0
- package/dist/types/model/nodes/VectorStoreNode.d.ts +22 -0
- package/dist/types/model/nodes/WaitForEventNode.d.ts +21 -0
- package/dist/types/native/BaseDir.d.ts +29 -0
- package/dist/types/native/BrowserNativeApi.d.ts +11 -0
- package/dist/types/native/NativeApi.d.ts +17 -0
- package/dist/types/plugins/aidon/index.d.ts +2 -0
- package/dist/types/plugins/aidon/nodes/ChatAidonNode.d.ts +3 -0
- package/dist/types/plugins/aidon/plugin.d.ts +2 -0
- package/dist/types/plugins/anthropic/anthropic.d.ts +216 -0
- package/dist/types/plugins/anthropic/fetchEventSource.d.ts +11 -0
- package/dist/types/plugins/anthropic/index.d.ts +2 -0
- package/dist/types/plugins/anthropic/nodes/ChatAnthropicNode.d.ts +30 -0
- package/dist/types/plugins/anthropic/plugin.d.ts +2 -0
- package/dist/types/plugins/assemblyAi/LemurActionItemsNode.d.ts +6 -0
- package/dist/types/plugins/assemblyAi/LemurQaNode.d.ts +22 -0
- package/dist/types/plugins/assemblyAi/LemurSummaryNode.d.ts +8 -0
- package/dist/types/plugins/assemblyAi/LemurTaskNode.d.ts +8 -0
- package/dist/types/plugins/assemblyAi/TranscribeAudioNode.d.ts +7 -0
- package/dist/types/plugins/assemblyAi/index.d.ts +2 -0
- package/dist/types/plugins/assemblyAi/lemurHelpers.d.ts +67 -0
- package/dist/types/plugins/assemblyAi/plugin.d.ts +2 -0
- package/dist/types/plugins/autoevals/AutoEvalsNode.d.ts +8 -0
- package/dist/types/plugins/autoevals/index.d.ts +2 -0
- package/dist/types/plugins/autoevals/plugin.d.ts +2 -0
- package/dist/types/plugins/gentrace/index.d.ts +2 -0
- package/dist/types/plugins/gentrace/plugin.d.ts +5 -0
- package/dist/types/plugins/google/google.d.ts +60 -0
- package/dist/types/plugins/google/index.d.ts +2 -0
- package/dist/types/plugins/google/nodes/ChatGoogleNode.d.ts +27 -0
- package/dist/types/plugins/google/plugin.d.ts +2 -0
- package/dist/types/plugins/huggingface/index.d.ts +2 -0
- package/dist/types/plugins/huggingface/nodes/ChatHuggingFace.d.ts +24 -0
- package/dist/types/plugins/huggingface/nodes/TextToImageHuggingFace.d.ts +20 -0
- package/dist/types/plugins/huggingface/plugin.d.ts +2 -0
- package/dist/types/plugins/openai/handleOpenaiError.d.ts +1 -0
- package/dist/types/plugins/openai/index.d.ts +2 -0
- package/dist/types/plugins/openai/nodes/AttachAssistantFileNode.d.ts +10 -0
- package/dist/types/plugins/openai/nodes/CreateAssistantNode.d.ts +26 -0
- package/dist/types/plugins/openai/nodes/CreateThreadMessageNode.d.ts +15 -0
- package/dist/types/plugins/openai/nodes/CreateThreadNode.d.ts +13 -0
- package/dist/types/plugins/openai/nodes/DeleteAssistantNode.d.ts +8 -0
- package/dist/types/plugins/openai/nodes/DeleteThreadNode.d.ts +8 -0
- package/dist/types/plugins/openai/nodes/GetAssistantNode.d.ts +8 -0
- package/dist/types/plugins/openai/nodes/GetOpenAIFileNode.d.ts +8 -0
- package/dist/types/plugins/openai/nodes/GetThreadNode.d.ts +8 -0
- package/dist/types/plugins/openai/nodes/ListAssistantsNode.d.ts +14 -0
- package/dist/types/plugins/openai/nodes/ListOpenAIFilesNode.d.ts +8 -0
- package/dist/types/plugins/openai/nodes/ListThreadMessagesNode.d.ts +16 -0
- package/dist/types/plugins/openai/nodes/RunThreadNode.d.ts +28 -0
- package/dist/types/plugins/openai/nodes/ThreadMessageNode.d.ts +14 -0
- package/dist/types/plugins/openai/nodes/UploadFileNode.d.ts +7 -0
- package/dist/types/plugins/openai/plugin.d.ts +2 -0
- package/dist/types/plugins/pinecone/PineconeVectorDatabase.d.ts +9 -0
- package/dist/types/plugins/pinecone/index.d.ts +2 -0
- package/dist/types/plugins/pinecone/plugin.d.ts +2 -0
- package/dist/types/plugins.d.ts +20 -0
- package/dist/types/recording/ExecutionRecorder.d.ts +25 -0
- package/dist/types/recording/RecordedEvents.d.ts +100 -0
- package/dist/types/utils/assertNever.d.ts +1 -0
- package/dist/types/utils/base64.d.ts +2 -0
- package/dist/types/utils/chatMessageToOpenAIChatCompletionMessage.d.ts +3 -0
- package/dist/types/utils/coerceType.d.ts +6 -0
- package/dist/types/utils/compatibility.d.ts +3 -0
- package/dist/types/utils/copyToClipboard.d.ts +1 -0
- package/dist/types/utils/defaults.d.ts +2 -0
- package/dist/types/utils/errors.d.ts +2 -0
- package/dist/types/utils/expectType.d.ts +3 -0
- package/dist/types/utils/fetchEventSource.d.ts +12 -0
- package/dist/types/utils/genericUtilFunctions.d.ts +21 -0
- package/dist/types/utils/getPluginConfig.d.ts +2 -0
- package/dist/types/utils/handleEscapeCharacters.d.ts +2 -0
- package/dist/types/utils/index.d.ts +14 -0
- package/dist/types/utils/inputs.d.ts +3 -0
- package/dist/types/utils/interpolation.d.ts +1 -0
- package/dist/types/utils/misc.d.ts +1 -0
- package/dist/types/utils/newId.d.ts +1 -0
- package/dist/types/utils/openai.d.ts +739 -0
- package/dist/types/utils/outputs.d.ts +3 -0
- package/dist/types/utils/serialization/serialization.d.ts +12 -0
- package/dist/types/utils/serialization/serializationUtils.d.ts +6 -0
- package/dist/types/utils/serialization/serialization_v1.d.ts +3 -0
- package/dist/types/utils/serialization/serialization_v2.d.ts +3 -0
- package/dist/types/utils/serialization/serialization_v3.d.ts +19 -0
- package/dist/types/utils/serialization/serialization_v4.d.ts +9 -0
- package/dist/types/utils/symbols.d.ts +3 -0
- package/dist/types/utils/time.d.ts +22 -0
- package/dist/types/utils/typeSafety.d.ts +37 -0
- package/package.json +97 -0
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import {} from '../NodeBase.js';
|
|
2
|
+
import { NodeImpl } from '../NodeImpl.js';
|
|
3
|
+
import { nodeDefinition } from '../NodeDefinition.js';
|
|
4
|
+
import {} from '../GraphProcessor.js';
|
|
5
|
+
import {} from '../NodeGraph.js';
|
|
6
|
+
import { nanoid } from 'nanoid/non-secure';
|
|
7
|
+
import {} from '../ProcessContext.js';
|
|
8
|
+
import {} from '../../index.js';
|
|
9
|
+
import { dedent } from 'ts-dedent';
|
|
10
|
+
import { coerceType } from '../../utils/index.js';
|
|
11
|
+
export class GraphReferenceNodeImpl extends NodeImpl {
|
|
12
|
+
static create() {
|
|
13
|
+
const chartNode = {
|
|
14
|
+
type: 'graphReference',
|
|
15
|
+
title: 'Graph Reference',
|
|
16
|
+
id: nanoid(),
|
|
17
|
+
visualData: {
|
|
18
|
+
x: 0,
|
|
19
|
+
y: 0,
|
|
20
|
+
width: 275,
|
|
21
|
+
},
|
|
22
|
+
data: {
|
|
23
|
+
graphId: '',
|
|
24
|
+
useGraphIdOrNameInput: false,
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
return chartNode;
|
|
28
|
+
}
|
|
29
|
+
getInputDefinitions() {
|
|
30
|
+
const inputs = [];
|
|
31
|
+
if (this.data.useGraphIdOrNameInput) {
|
|
32
|
+
inputs.push({
|
|
33
|
+
id: 'graph-name-or-id',
|
|
34
|
+
dataType: 'string',
|
|
35
|
+
title: 'Graph Name Or ID',
|
|
36
|
+
description: 'The name or ID of the graph to get a reference to.',
|
|
37
|
+
required: true,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
return inputs;
|
|
41
|
+
}
|
|
42
|
+
getOutputDefinitions() {
|
|
43
|
+
return [
|
|
44
|
+
{
|
|
45
|
+
id: 'graph',
|
|
46
|
+
dataType: 'graph-reference',
|
|
47
|
+
title: 'Graph',
|
|
48
|
+
description: 'A reference to the graph.',
|
|
49
|
+
},
|
|
50
|
+
];
|
|
51
|
+
}
|
|
52
|
+
getEditors() {
|
|
53
|
+
const definitions = [
|
|
54
|
+
{
|
|
55
|
+
type: 'graphSelector',
|
|
56
|
+
label: 'Graph',
|
|
57
|
+
dataKey: 'graphId',
|
|
58
|
+
useInputToggleDataKey: 'useGraphIdOrNameInput',
|
|
59
|
+
},
|
|
60
|
+
];
|
|
61
|
+
return definitions;
|
|
62
|
+
}
|
|
63
|
+
static getUIData() {
|
|
64
|
+
return {
|
|
65
|
+
infoBoxBody: dedent `
|
|
66
|
+
Gets a reference to another graph, that can be used to pass around graphs to call using a Call Graph node.
|
|
67
|
+
`,
|
|
68
|
+
infoBoxTitle: 'Graph Reference Node',
|
|
69
|
+
contextMenuTitle: 'Graph Reference',
|
|
70
|
+
group: ['Advanced'],
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
getBody(context) {
|
|
74
|
+
if (this.data.useGraphIdOrNameInput) {
|
|
75
|
+
return '(Graph from input)';
|
|
76
|
+
}
|
|
77
|
+
const graph = context.project.graphs[this.data.graphId];
|
|
78
|
+
if (!graph) {
|
|
79
|
+
return '(Graph not found)';
|
|
80
|
+
}
|
|
81
|
+
return graph.metadata.name ?? '(Unnamed Graph)';
|
|
82
|
+
}
|
|
83
|
+
async process(inputs, context) {
|
|
84
|
+
if (this.data.useGraphIdOrNameInput) {
|
|
85
|
+
const graphIdOrName = coerceType(inputs['graph-name-or-id'], 'string');
|
|
86
|
+
let graph = context.project.graphs[graphIdOrName];
|
|
87
|
+
if (!graph) {
|
|
88
|
+
graph = Object.values(context.project.graphs).find((graph) => graph.metadata.name === graphIdOrName);
|
|
89
|
+
}
|
|
90
|
+
if (!graph) {
|
|
91
|
+
return {
|
|
92
|
+
['graph']: {
|
|
93
|
+
type: 'control-flow-excluded',
|
|
94
|
+
value: undefined,
|
|
95
|
+
},
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
return {
|
|
99
|
+
['graph']: {
|
|
100
|
+
type: 'graph-reference',
|
|
101
|
+
value: {
|
|
102
|
+
graphId: graph.metadata.id ?? '',
|
|
103
|
+
graphName: graph.metadata.name ?? '',
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
const graph = context.project.graphs[this.data.graphId];
|
|
109
|
+
if (!graph) {
|
|
110
|
+
return {
|
|
111
|
+
['graph']: {
|
|
112
|
+
type: 'control-flow-excluded',
|
|
113
|
+
value: undefined,
|
|
114
|
+
},
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
return {
|
|
118
|
+
['graph']: {
|
|
119
|
+
type: 'graph-reference',
|
|
120
|
+
value: {
|
|
121
|
+
graphId: graph.metadata.id ?? '',
|
|
122
|
+
graphName: graph.metadata.name ?? '',
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
export const graphReferenceNode = nodeDefinition(GraphReferenceNodeImpl, 'Graph Reference');
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import {} from '../NodeBase.js';
|
|
2
|
+
import { nanoid } from 'nanoid/non-secure';
|
|
3
|
+
import { NodeImpl } from '../NodeImpl.js';
|
|
4
|
+
import { nodeDefinition } from '../NodeDefinition.js';
|
|
5
|
+
import {} from '../../index.js';
|
|
6
|
+
import * as crypto from 'crypto-js';
|
|
7
|
+
import { match } from 'ts-pattern';
|
|
8
|
+
import { dedent } from 'ts-dedent';
|
|
9
|
+
import { coerceType } from '../../utils/coerceType.js';
|
|
10
|
+
const { SHA256, SHA512, MD5, SHA1 } = crypto;
|
|
11
|
+
export class HashNodeImpl extends NodeImpl {
|
|
12
|
+
static create() {
|
|
13
|
+
const chartNode = {
|
|
14
|
+
type: 'hash',
|
|
15
|
+
title: 'Hash',
|
|
16
|
+
id: nanoid(),
|
|
17
|
+
visualData: {
|
|
18
|
+
x: 0,
|
|
19
|
+
y: 0,
|
|
20
|
+
width: 250,
|
|
21
|
+
},
|
|
22
|
+
data: {
|
|
23
|
+
algorithm: 'sha256',
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
return chartNode;
|
|
27
|
+
}
|
|
28
|
+
getInputDefinitions() {
|
|
29
|
+
return [
|
|
30
|
+
{
|
|
31
|
+
id: 'input',
|
|
32
|
+
title: 'Input',
|
|
33
|
+
dataType: 'string',
|
|
34
|
+
required: true,
|
|
35
|
+
},
|
|
36
|
+
];
|
|
37
|
+
}
|
|
38
|
+
getOutputDefinitions() {
|
|
39
|
+
return [
|
|
40
|
+
{
|
|
41
|
+
id: 'hash',
|
|
42
|
+
title: 'Hash',
|
|
43
|
+
dataType: 'string',
|
|
44
|
+
},
|
|
45
|
+
];
|
|
46
|
+
}
|
|
47
|
+
getEditors() {
|
|
48
|
+
return [
|
|
49
|
+
{
|
|
50
|
+
type: 'dropdown',
|
|
51
|
+
label: 'Algorithm',
|
|
52
|
+
dataKey: 'algorithm',
|
|
53
|
+
options: [
|
|
54
|
+
{ value: 'md5', label: 'MD5' },
|
|
55
|
+
{ value: 'sha1', label: 'SHA1' },
|
|
56
|
+
{ value: 'sha256', label: 'SHA256' },
|
|
57
|
+
{ value: 'sha512', label: 'SHA512' },
|
|
58
|
+
],
|
|
59
|
+
},
|
|
60
|
+
];
|
|
61
|
+
}
|
|
62
|
+
getBody() {
|
|
63
|
+
return algorithmDisplayName[this.data.algorithm];
|
|
64
|
+
}
|
|
65
|
+
static getUIData() {
|
|
66
|
+
return {
|
|
67
|
+
infoBoxBody: dedent `
|
|
68
|
+
Computes a hash of the input value using the configured hash function.
|
|
69
|
+
`,
|
|
70
|
+
infoBoxTitle: 'Hash Node',
|
|
71
|
+
contextMenuTitle: 'Hash',
|
|
72
|
+
group: ['Data'],
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
async process(inputs) {
|
|
76
|
+
const inputText = coerceType(inputs['input'], 'string');
|
|
77
|
+
const hash = match(this.data.algorithm)
|
|
78
|
+
.with('md5', () => MD5(inputText).toString())
|
|
79
|
+
.with('sha1', () => SHA1(inputText).toString())
|
|
80
|
+
.with('sha256', () => SHA256(inputText).toString())
|
|
81
|
+
.with('sha512', () => SHA512(inputText).toString())
|
|
82
|
+
.exhaustive();
|
|
83
|
+
return {
|
|
84
|
+
['hash']: {
|
|
85
|
+
type: 'string',
|
|
86
|
+
value: hash,
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
const algorithmDisplayName = {
|
|
92
|
+
md5: 'MD5',
|
|
93
|
+
sha1: 'SHA-1',
|
|
94
|
+
sha256: 'SHA-256',
|
|
95
|
+
sha512: 'SHA-512',
|
|
96
|
+
};
|
|
97
|
+
export const hashNode = nodeDefinition(HashNodeImpl, 'Hash');
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
import {} from '../NodeBase.js';
|
|
2
|
+
import { nanoid } from 'nanoid/non-secure';
|
|
3
|
+
import { NodeImpl } from '../NodeImpl.js';
|
|
4
|
+
import { nodeDefinition } from '../NodeDefinition.js';
|
|
5
|
+
import {} from '../GraphProcessor.js';
|
|
6
|
+
import {} from '../../index.js';
|
|
7
|
+
import { coerceType, dedent, getInputOrData } from '../../utils/index.js';
|
|
8
|
+
import { getError } from '../../utils/errors.js';
|
|
9
|
+
export class HttpCallNodeImpl extends NodeImpl {
|
|
10
|
+
static create() {
|
|
11
|
+
const chartNode = {
|
|
12
|
+
type: 'httpCall',
|
|
13
|
+
title: 'Http Call',
|
|
14
|
+
id: nanoid(),
|
|
15
|
+
visualData: {
|
|
16
|
+
x: 0,
|
|
17
|
+
y: 0,
|
|
18
|
+
width: 250,
|
|
19
|
+
},
|
|
20
|
+
data: {
|
|
21
|
+
method: 'GET',
|
|
22
|
+
url: '',
|
|
23
|
+
headers: '',
|
|
24
|
+
body: '',
|
|
25
|
+
errorOnNon200: true,
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
return chartNode;
|
|
29
|
+
}
|
|
30
|
+
getInputDefinitions() {
|
|
31
|
+
const inputs = [];
|
|
32
|
+
if (this.data.useMethodInput) {
|
|
33
|
+
inputs.push({
|
|
34
|
+
dataType: 'string',
|
|
35
|
+
id: 'method',
|
|
36
|
+
title: 'Method',
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
if (this.data.useUrlInput) {
|
|
40
|
+
inputs.push({
|
|
41
|
+
dataType: 'string',
|
|
42
|
+
id: 'url',
|
|
43
|
+
title: 'URL',
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
if (this.data.useHeadersInput) {
|
|
47
|
+
inputs.push({
|
|
48
|
+
dataType: 'object',
|
|
49
|
+
id: 'headers',
|
|
50
|
+
title: 'Headers',
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
if (this.data.useBodyInput) {
|
|
54
|
+
inputs.push({
|
|
55
|
+
dataType: 'string',
|
|
56
|
+
id: 'req_body',
|
|
57
|
+
title: 'Body',
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
return inputs;
|
|
61
|
+
}
|
|
62
|
+
getOutputDefinitions() {
|
|
63
|
+
const outputDefinitions = [];
|
|
64
|
+
if (this.data.isBinaryOutput) {
|
|
65
|
+
outputDefinitions.push({
|
|
66
|
+
dataType: 'binary',
|
|
67
|
+
id: 'binary',
|
|
68
|
+
title: 'Binary',
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
outputDefinitions.push({
|
|
73
|
+
dataType: 'string',
|
|
74
|
+
id: 'res_body',
|
|
75
|
+
title: 'Body',
|
|
76
|
+
}, {
|
|
77
|
+
dataType: 'object',
|
|
78
|
+
id: 'json',
|
|
79
|
+
title: 'JSON',
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
outputDefinitions.push({
|
|
83
|
+
dataType: 'number',
|
|
84
|
+
id: 'statusCode',
|
|
85
|
+
title: 'Status Code',
|
|
86
|
+
}, {
|
|
87
|
+
dataType: 'object',
|
|
88
|
+
id: 'res_headers',
|
|
89
|
+
title: 'Headers',
|
|
90
|
+
});
|
|
91
|
+
return outputDefinitions;
|
|
92
|
+
}
|
|
93
|
+
getEditors() {
|
|
94
|
+
return [
|
|
95
|
+
{
|
|
96
|
+
type: 'dropdown',
|
|
97
|
+
label: 'Method',
|
|
98
|
+
dataKey: 'method',
|
|
99
|
+
useInputToggleDataKey: 'useMethodInput',
|
|
100
|
+
options: [
|
|
101
|
+
{ label: 'GET', value: 'GET' },
|
|
102
|
+
{ label: 'POST', value: 'POST' },
|
|
103
|
+
{ label: 'PUT', value: 'PUT' },
|
|
104
|
+
{ label: 'DELETE', value: 'DELETE' },
|
|
105
|
+
],
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
type: 'string',
|
|
109
|
+
label: 'URL',
|
|
110
|
+
dataKey: 'url',
|
|
111
|
+
useInputToggleDataKey: 'useUrlInput',
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
type: 'code',
|
|
115
|
+
label: 'Headers',
|
|
116
|
+
dataKey: 'headers',
|
|
117
|
+
useInputToggleDataKey: 'useHeadersInput',
|
|
118
|
+
language: 'json',
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
type: 'code',
|
|
122
|
+
label: 'Body',
|
|
123
|
+
dataKey: 'body',
|
|
124
|
+
useInputToggleDataKey: 'useBodyInput',
|
|
125
|
+
language: 'json',
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
type: 'toggle',
|
|
129
|
+
label: 'Whether response body is expected to be a binary',
|
|
130
|
+
dataKey: 'isBinaryOutput',
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
type: 'toggle',
|
|
134
|
+
label: 'Error on non-200 status code',
|
|
135
|
+
dataKey: 'errorOnNon200',
|
|
136
|
+
},
|
|
137
|
+
];
|
|
138
|
+
}
|
|
139
|
+
getBody() {
|
|
140
|
+
return dedent `
|
|
141
|
+
${this.data.useMethodInput ? '(Method Using Input)' : this.data.method} ${this.data.useUrlInput ? '(URL Using Input)' : this.data.url} ${this.data.useHeadersInput
|
|
142
|
+
? '\nHeaders: (Using Input)'
|
|
143
|
+
: this.data.headers.trim()
|
|
144
|
+
? `\nHeaders: ${this.data.headers}`
|
|
145
|
+
: ''}${this.data.useBodyInput ? '\nBody: (Using Input)' : this.data.body.trim() ? `\nBody: ${this.data.body}` : ''}${this.data.errorOnNon200 ? '\nError on non-200' : ''}
|
|
146
|
+
`;
|
|
147
|
+
}
|
|
148
|
+
static getUIData() {
|
|
149
|
+
return {
|
|
150
|
+
infoBoxBody: dedent `
|
|
151
|
+
Makes an HTTP call to the specified URL with the given method, headers, and body.
|
|
152
|
+
`,
|
|
153
|
+
infoBoxTitle: 'HTTP Call Node',
|
|
154
|
+
contextMenuTitle: 'HTTP Call',
|
|
155
|
+
group: ['Advanced'],
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
async process(inputs, context) {
|
|
159
|
+
const method = getInputOrData(this.data, inputs, 'method', 'string');
|
|
160
|
+
const url = getInputOrData(this.data, inputs, 'url', 'string');
|
|
161
|
+
try {
|
|
162
|
+
new URL(url);
|
|
163
|
+
}
|
|
164
|
+
catch (err) {
|
|
165
|
+
throw new Error(`Invalid URL: ${url}`);
|
|
166
|
+
}
|
|
167
|
+
let headers;
|
|
168
|
+
if (this.data.useHeadersInput) {
|
|
169
|
+
const headersInput = inputs['headers'];
|
|
170
|
+
if (headersInput?.type === 'string') {
|
|
171
|
+
headers = JSON.parse(headersInput.value);
|
|
172
|
+
}
|
|
173
|
+
else if (headersInput?.type === 'object') {
|
|
174
|
+
headers = headersInput.value;
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
headers = coerceType(headersInput, 'object');
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
else if (this.data.headers.trim()) {
|
|
181
|
+
headers = JSON.parse(this.data.headers);
|
|
182
|
+
}
|
|
183
|
+
let body;
|
|
184
|
+
if (this.data.useBodyInput) {
|
|
185
|
+
const bodyInput = inputs['req_body'];
|
|
186
|
+
if (bodyInput?.type === 'string') {
|
|
187
|
+
body = bodyInput.value;
|
|
188
|
+
}
|
|
189
|
+
else if (bodyInput?.type === 'object') {
|
|
190
|
+
body = JSON.stringify(bodyInput.value);
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
body = coerceType(bodyInput, 'string');
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
else {
|
|
197
|
+
body = this.data.body || undefined;
|
|
198
|
+
}
|
|
199
|
+
try {
|
|
200
|
+
const response = await fetch(url, {
|
|
201
|
+
method,
|
|
202
|
+
headers,
|
|
203
|
+
body,
|
|
204
|
+
signal: context.signal,
|
|
205
|
+
mode: 'cors',
|
|
206
|
+
});
|
|
207
|
+
const output = {
|
|
208
|
+
['statusCode']: {
|
|
209
|
+
type: 'number',
|
|
210
|
+
value: response.status,
|
|
211
|
+
},
|
|
212
|
+
['res_headers']: {
|
|
213
|
+
type: 'object',
|
|
214
|
+
value: Object.fromEntries(response.headers.entries()),
|
|
215
|
+
},
|
|
216
|
+
};
|
|
217
|
+
if (this.data.isBinaryOutput) {
|
|
218
|
+
const responseBlob = await response.blob();
|
|
219
|
+
output['binary'] = {
|
|
220
|
+
type: 'binary',
|
|
221
|
+
value: new Uint8Array(await responseBlob.arrayBuffer()),
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
else {
|
|
225
|
+
const responseText = await response.text();
|
|
226
|
+
output['res_body'] = {
|
|
227
|
+
type: 'string',
|
|
228
|
+
value: responseText,
|
|
229
|
+
};
|
|
230
|
+
if (response.headers.get('content-type')?.includes('application/json')) {
|
|
231
|
+
const jsonData = JSON.parse(responseText);
|
|
232
|
+
output['json'] = {
|
|
233
|
+
type: 'object',
|
|
234
|
+
value: jsonData,
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
else {
|
|
238
|
+
output['json'] = {
|
|
239
|
+
type: 'control-flow-excluded',
|
|
240
|
+
value: undefined,
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
return output;
|
|
245
|
+
}
|
|
246
|
+
catch (err) {
|
|
247
|
+
const { message } = getError(err);
|
|
248
|
+
if (message.includes('Load failed') || message.includes('Failed to fetch')) {
|
|
249
|
+
if (context.executor === 'browser') {
|
|
250
|
+
throw new Error('Failed to make HTTP call. You may be running into CORS problems. Try using the Node executor in the top-right menu.');
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
throw err;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
export const httpCallNode = nodeDefinition(HttpCallNodeImpl, 'Http Call');
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { NodeImpl } from '../NodeImpl.js';
|
|
2
|
+
import { nodeDefinition } from '../NodeDefinition.js';
|
|
3
|
+
import {} from '../NodeBase.js';
|
|
4
|
+
import {} from '../DataValue.js';
|
|
5
|
+
import { nanoid } from 'nanoid/non-secure';
|
|
6
|
+
import { dedent } from 'ts-dedent';
|
|
7
|
+
import { coerceType } from '../../utils/coerceType.js';
|
|
8
|
+
export class IfElseNodeImpl extends NodeImpl {
|
|
9
|
+
static create = () => {
|
|
10
|
+
const chartNode = {
|
|
11
|
+
type: 'ifElse',
|
|
12
|
+
title: 'If/Else',
|
|
13
|
+
id: nanoid(),
|
|
14
|
+
data: {
|
|
15
|
+
// Legacy behavior is false
|
|
16
|
+
unconnectedControlFlowExcluded: true,
|
|
17
|
+
},
|
|
18
|
+
visualData: {
|
|
19
|
+
x: 0,
|
|
20
|
+
y: 0,
|
|
21
|
+
width: 175,
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
return chartNode;
|
|
25
|
+
};
|
|
26
|
+
getInputDefinitions() {
|
|
27
|
+
return [
|
|
28
|
+
{
|
|
29
|
+
id: 'if',
|
|
30
|
+
title: 'If',
|
|
31
|
+
dataType: 'any',
|
|
32
|
+
description: 'If this is truthy, the `true` value will be passed through the output port. Otherwise, the `false` value will be passed through the output port. An unconnected port is considered false. A `Not Ran` value is considered false.',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
id: 'true',
|
|
36
|
+
title: 'True',
|
|
37
|
+
dataType: 'any',
|
|
38
|
+
description: 'The value to pass through the output port if the condition is truthy. ',
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
id: 'false',
|
|
42
|
+
title: 'False',
|
|
43
|
+
dataType: 'any',
|
|
44
|
+
description: 'The value to pass through the output port if the condition is not truthy.',
|
|
45
|
+
},
|
|
46
|
+
];
|
|
47
|
+
}
|
|
48
|
+
getOutputDefinitions() {
|
|
49
|
+
return [
|
|
50
|
+
{
|
|
51
|
+
id: 'output',
|
|
52
|
+
title: 'Output',
|
|
53
|
+
dataType: 'any',
|
|
54
|
+
description: 'The `true` or `false` value, depending on the `if` condition.',
|
|
55
|
+
},
|
|
56
|
+
];
|
|
57
|
+
}
|
|
58
|
+
static getUIData() {
|
|
59
|
+
return {
|
|
60
|
+
infoBoxBody: dedent `
|
|
61
|
+
Takes in three inputs: a condition, a true value, and a false value. If the condition is truthy, the true value is passed through the output port. If the condition is not truthy, the false value is passed through the output port.
|
|
62
|
+
|
|
63
|
+
This node can "consume" a \`Not Ran\` to continue a graph from that point.
|
|
64
|
+
`,
|
|
65
|
+
infoBoxTitle: 'If/Else Node',
|
|
66
|
+
contextMenuTitle: 'If/Else',
|
|
67
|
+
group: ['Logic'],
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
getEditors() {
|
|
71
|
+
return [
|
|
72
|
+
{
|
|
73
|
+
type: 'toggle',
|
|
74
|
+
label: "Don't run unconnected ports",
|
|
75
|
+
dataKey: 'unconnectedControlFlowExcluded',
|
|
76
|
+
},
|
|
77
|
+
];
|
|
78
|
+
}
|
|
79
|
+
async process(inputData) {
|
|
80
|
+
const unconnectedValue = this.data.unconnectedControlFlowExcluded
|
|
81
|
+
? { type: 'control-flow-excluded', value: undefined }
|
|
82
|
+
: {
|
|
83
|
+
type: 'any',
|
|
84
|
+
value: undefined,
|
|
85
|
+
};
|
|
86
|
+
const ifValue = inputData['if'];
|
|
87
|
+
const trueValue = inputData['true'] ?? unconnectedValue;
|
|
88
|
+
const falseValue = inputData['false'] ?? unconnectedValue;
|
|
89
|
+
if (!(trueValue || falseValue)) {
|
|
90
|
+
return {
|
|
91
|
+
['output']: {
|
|
92
|
+
type: 'control-flow-excluded',
|
|
93
|
+
value: undefined,
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
if (ifValue?.type === 'control-flow-excluded') {
|
|
98
|
+
return {
|
|
99
|
+
['output']: falseValue,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
if (ifValue?.value == null) {
|
|
103
|
+
return {
|
|
104
|
+
['output']: falseValue,
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
if (ifValue?.type && ifValue.type === 'boolean') {
|
|
108
|
+
return {
|
|
109
|
+
['output']: ifValue.value ? trueValue : falseValue,
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
if (ifValue?.type === 'string') {
|
|
113
|
+
return {
|
|
114
|
+
['output']: ifValue.value.length > 0 ? trueValue : falseValue,
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
if (ifValue?.type === 'chat-message') {
|
|
118
|
+
const asString = coerceType(ifValue, 'string');
|
|
119
|
+
return {
|
|
120
|
+
['output']: asString ? trueValue : falseValue,
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
if (ifValue?.type.endsWith('[]')) {
|
|
124
|
+
return {
|
|
125
|
+
['output']: ifValue.value.length > 0 ? trueValue : falseValue,
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
if (ifValue?.type === 'any' || ifValue?.type === 'object') {
|
|
129
|
+
return {
|
|
130
|
+
['output']: !!ifValue.value ? trueValue : falseValue,
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
return {
|
|
134
|
+
['output']: falseValue,
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
export const ifElseNode = nodeDefinition(IfElseNodeImpl, 'If/Else');
|