@valerypopoff/rivet2-core 2.0.0
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 +15 -0
- package/dist/cjs/bundle.cjs +28772 -0
- package/dist/cjs/bundle.cjs.map +7 -0
- package/dist/esm/api/createProcessor.js +116 -0
- package/dist/esm/api/looseDataValue.js +16 -0
- package/dist/esm/api/processSettings.js +16 -0
- package/dist/esm/api/streaming.js +116 -0
- package/dist/esm/exports.js +48 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/integrations/AudioProvider.js +1 -0
- package/dist/esm/integrations/CodeRunner.js +44 -0
- package/dist/esm/integrations/DatasetProvider.js +92 -0
- package/dist/esm/integrations/EmbeddingGenerator.js +1 -0
- package/dist/esm/integrations/GptTokenizerTokenizer.js +67 -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/mcp/MCPBase.js +87 -0
- package/dist/esm/integrations/mcp/MCPProvider.js +23 -0
- package/dist/esm/integrations/mcp/MCPUtils.js +33 -0
- package/dist/esm/integrations/openai/OpenAIEmbeddingGenerator.js +23 -0
- package/dist/esm/model/CycleDetector.js +43 -0
- package/dist/esm/model/DataValue.js +188 -0
- package/dist/esm/model/Dataset.js +1 -0
- package/dist/esm/model/EditorDefinition.js +1 -0
- package/dist/esm/model/ExecutorProtocol.js +1 -0
- package/dist/esm/model/GraphPreprocessor.js +97 -0
- package/dist/esm/model/GraphProcessor.js +1136 -0
- package/dist/esm/model/NodeBase.js +11 -0
- package/dist/esm/model/NodeBodySpec.js +1 -0
- package/dist/esm/model/NodeDefinition.js +12 -0
- package/dist/esm/model/NodeExecutionPlanner.js +82 -0
- package/dist/esm/model/NodeGraph.js +14 -0
- package/dist/esm/model/NodeImpl.js +57 -0
- package/dist/esm/model/NodeRegistration.js +146 -0
- package/dist/esm/model/Nodes.js +279 -0
- package/dist/esm/model/PluginLoadSpec.js +1 -0
- package/dist/esm/model/ProcessContext.js +1 -0
- package/dist/esm/model/ProcessContextBuilder.js +33 -0
- package/dist/esm/model/Project.js +2 -0
- package/dist/esm/model/ProjectReferenceLoader.js +1 -0
- package/dist/esm/model/RecordingPlayer.js +262 -0
- package/dist/esm/model/RegistryAssembly.js +53 -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/SplitRunProcessor.js +98 -0
- package/dist/esm/model/SubprocessorBridge.js +82 -0
- package/dist/esm/model/chat/aiSdkMessages.js +105 -0
- package/dist/esm/model/chat/aiSdkStreaming.js +38 -0
- package/dist/esm/model/chat/aiSdkTools.js +10 -0
- package/dist/esm/model/chat/chatCost.js +33 -0
- package/dist/esm/model/chat/chatMessages.js +47 -0
- package/dist/esm/model/chat/openAIChatRequest.js +110 -0
- package/dist/esm/model/chat/openAIChatRuntime.js +220 -0
- package/dist/esm/model/chat/streamChatResponse.js +97 -0
- package/dist/esm/model/chat/tokenBudget.js +16 -0
- package/dist/esm/model/chat-v2/aiSdkBridge.js +88 -0
- package/dist/esm/model/chat-v2/chatV2EditorCache.js +107 -0
- package/dist/esm/model/chat-v2/chatV2Errors.js +255 -0
- package/dist/esm/model/chat-v2/chatV2FeatureCompatibility.js +16 -0
- package/dist/esm/model/chat-v2/chatV2Pipeline.js +387 -0
- package/dist/esm/model/chat-v2/chatV2ResponseFormat.js +57 -0
- package/dist/esm/model/chat-v2/chatV2Retry.js +41 -0
- package/dist/esm/model/chat-v2/chatV2RuntimeOptions.js +242 -0
- package/dist/esm/model/chat-v2/chatV2Shared.js +285 -0
- package/dist/esm/model/chat-v2/chatV2Types.js +1 -0
- package/dist/esm/model/chat-v2/index.js +10 -0
- package/dist/esm/model/chat-v2/llmChatV2NodeData.js +56 -0
- package/dist/esm/model/chat-v2/llmChatV2NodeEditors.js +475 -0
- package/dist/esm/model/chat-v2/llmChatV2NodeRuntime.js +90 -0
- package/dist/esm/model/chat-v2/messageConverter.js +173 -0
- package/dist/esm/model/chat-v2/modelRegistry.js +23 -0
- package/dist/esm/model/chat-v2/providerOptions.js +202 -0
- package/dist/esm/model/chat-v2/toolContinuation.js +108 -0
- package/dist/esm/model/chat-v2/toolConverter.js +4 -0
- package/dist/esm/model/interpolationInputDefinition.js +36 -0
- package/dist/esm/model/loopControllerBreak.js +4 -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 +209 -0
- package/dist/esm/model/nodes/AssemblePromptNode.js +151 -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 +135 -0
- package/dist/esm/model/nodes/ChatLoopNode.js +150 -0
- package/dist/esm/model/nodes/ChatNode.js +56 -0
- package/dist/esm/model/nodes/ChatNodeBase.js +912 -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 +197 -0
- package/dist/esm/model/nodes/CommentNode.js +71 -0
- package/dist/esm/model/nodes/CompareNode.js +144 -0
- package/dist/esm/model/nodes/ContextNode.js +99 -0
- package/dist/esm/model/nodes/CreateDatasetNode.js +71 -0
- package/dist/esm/model/nodes/CronNode.js +248 -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 +175 -0
- package/dist/esm/model/nodes/DestructureNode.js +110 -0
- package/dist/esm/model/nodes/DocumentNode.js +183 -0
- package/dist/esm/model/nodes/EvaluateNode.js +141 -0
- package/dist/esm/model/nodes/ExpressionNode.js +143 -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 +159 -0
- package/dist/esm/model/nodes/ExtractRegexNode.js +200 -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/GraphInputNode.js +132 -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 +592 -0
- package/dist/esm/model/nodes/IfElseNode.js +138 -0
- package/dist/esm/model/nodes/IfNode.js +129 -0
- package/dist/esm/model/nodes/ImageNode.js +107 -0
- package/dist/esm/model/nodes/JSFilterNode.js +69 -0
- package/dist/esm/model/nodes/JSMapNode.js +69 -0
- package/dist/esm/model/nodes/JoinNode.js +135 -0
- package/dist/esm/model/nodes/LLMChatV2Node.js +234 -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/LoopUntilNode.js +214 -0
- package/dist/esm/model/nodes/MCPDiscoveryNode.js +214 -0
- package/dist/esm/model/nodes/MCPGetPromptNode.js +234 -0
- package/dist/esm/model/nodes/MCPToolCallNode.js +262 -0
- package/dist/esm/model/nodes/MatchNode.js +160 -0
- package/dist/esm/model/nodes/NumberNode.js +86 -0
- package/dist/esm/model/nodes/ObjectNode.js +152 -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 +248 -0
- package/dist/esm/model/nodes/RaceInputsNode.js +85 -0
- package/dist/esm/model/nodes/RaiseEventNode.js +84 -0
- package/dist/esm/model/nodes/RandomNumberNode.js +117 -0
- package/dist/esm/model/nodes/ReadAllFilesNode.js +210 -0
- package/dist/esm/model/nodes/ReadDirectoryNode.js +171 -0
- package/dist/esm/model/nodes/ReadFileNode.js +114 -0
- package/dist/esm/model/nodes/ReferencedGraphAliasNode.js +199 -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 +99 -0
- package/dist/esm/model/nodes/SplitNode.js +101 -0
- package/dist/esm/model/nodes/SubGraphNode.js +180 -0
- package/dist/esm/model/nodes/TextNode.js +125 -0
- package/dist/esm/model/nodes/ToJsonNode.js +78 -0
- package/dist/esm/model/nodes/ToMarkdownTableNode.js +119 -0
- package/dist/esm/model/nodes/ToTreeNode.js +133 -0
- package/dist/esm/model/nodes/ToYamlNode.js +68 -0
- package/dist/esm/model/nodes/ToolNode.js +172 -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 +109 -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/model/nodes/codeNodeErrorDiagnostics.js +104 -0
- package/dist/esm/model/nodes/jsListCallbackHelpers.js +196 -0
- package/dist/esm/model/nodes/jsValueInterpolation.js +163 -0
- package/dist/esm/model/nodes/toolCallDelegation.js +159 -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/anthropic/anthropic.js +208 -0
- package/dist/esm/plugins/anthropic/fetchEventSource.js +107 -0
- package/dist/esm/plugins/anthropic/index.js +2 -0
- package/dist/esm/plugins/anthropic/nodes/ChatAnthropicNode.js +767 -0
- package/dist/esm/plugins/anthropic/plugin.js +26 -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 +126 -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 +3 -0
- package/dist/esm/plugins/gentrace/plugin.js +195 -0
- package/dist/esm/plugins/google/google.js +165 -0
- package/dist/esm/plugins/google/index.js +2 -0
- package/dist/esm/plugins/google/nodes/ChatGoogleNode.js +584 -0
- package/dist/esm/plugins/google/plugin.js +39 -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 +143 -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 +29 -0
- package/dist/esm/recording/ExecutionRecorder.js +273 -0
- package/dist/esm/recording/RecordedEvents.js +1 -0
- package/dist/esm/utils/assertNever.js +3 -0
- package/dist/esm/utils/base64.js +38 -0
- package/dist/esm/utils/chatMessageToOpenAIChatCompletionMessage.js +73 -0
- package/dist/esm/utils/coerceType.js +326 -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/emitDetached.js +12 -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 +17 -0
- package/dist/esm/utils/inputs.js +16 -0
- package/dist/esm/utils/interpolation.js +286 -0
- package/dist/esm/utils/misc.js +1 -0
- package/dist/esm/utils/newId.js +4 -0
- package/dist/esm/utils/openai.js +206 -0
- package/dist/esm/utils/orderedStringPortIds.js +27 -0
- package/dist/esm/utils/outputs.js +14 -0
- package/dist/esm/utils/pQueueCompat.js +12 -0
- package/dist/esm/utils/paths.js +80 -0
- package/dist/esm/utils/providerStreamParsing.js +14 -0
- package/dist/esm/utils/runtimeLogging.js +121 -0
- package/dist/esm/utils/serialization/serialization.js +77 -0
- package/dist/esm/utils/serialization/serializationHelpers.js +63 -0
- package/dist/esm/utils/serialization/serializationUtils.js +112 -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 +100 -0
- package/dist/esm/utils/serialization/serialization_v4.js +156 -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/esm/vendor/fnv1a.js +80 -0
- package/dist/types/api/createProcessor.d.ts +56 -0
- package/dist/types/api/looseDataValue.d.ts +4 -0
- package/dist/types/api/processSettings.d.ts +4 -0
- package/dist/types/api/streaming.d.ts +56 -0
- package/dist/types/exports.d.ts +49 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/integrations/AudioProvider.d.ts +4 -0
- package/dist/types/integrations/CodeRunner.d.ts +19 -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/mcp/MCPBase.d.ts +18 -0
- package/dist/types/integrations/mcp/MCPProvider.d.ts +153 -0
- package/dist/types/integrations/mcp/MCPUtils.d.ts +9 -0
- package/dist/types/integrations/openai/OpenAIEmbeddingGenerator.d.ts +10 -0
- package/dist/types/model/CycleDetector.d.ts +2 -0
- package/dist/types/model/DataValue.d.ts +160 -0
- package/dist/types/model/Dataset.d.ts +19 -0
- package/dist/types/model/EditorDefinition.d.ts +176 -0
- package/dist/types/model/ExecutorProtocol.d.ts +216 -0
- package/dist/types/model/GraphPreprocessor.d.ts +24 -0
- package/dist/types/model/GraphProcessor.d.ts +210 -0
- package/dist/types/model/NodeBase.d.ts +116 -0
- package/dist/types/model/NodeBodySpec.d.ts +19 -0
- package/dist/types/model/NodeDefinition.d.ts +13 -0
- package/dist/types/model/NodeExecutionPlanner.d.ts +28 -0
- package/dist/types/model/NodeGraph.d.ts +15 -0
- package/dist/types/model/NodeImpl.d.ts +56 -0
- package/dist/types/model/NodeRegistration.d.ts +29 -0
- package/dist/types/model/Nodes.d.ts +112 -0
- package/dist/types/model/PluginLoadSpec.d.ts +17 -0
- package/dist/types/model/ProcessContext.d.ts +110 -0
- package/dist/types/model/ProcessContextBuilder.d.ts +41 -0
- package/dist/types/model/Project.d.ts +31 -0
- package/dist/types/model/ProjectReferenceLoader.d.ts +5 -0
- package/dist/types/model/RecordingPlayer.d.ts +27 -0
- package/dist/types/model/RegistryAssembly.d.ts +42 -0
- package/dist/types/model/RivetPlugin.d.ts +51 -0
- package/dist/types/model/RivetUIContext.d.ts +27 -0
- package/dist/types/model/Settings.d.ts +20 -0
- package/dist/types/model/SplitRunProcessor.d.ts +31 -0
- package/dist/types/model/SubprocessorBridge.d.ts +13 -0
- package/dist/types/model/chat/aiSdkMessages.d.ts +3 -0
- package/dist/types/model/chat/aiSdkStreaming.d.ts +9 -0
- package/dist/types/model/chat/aiSdkTools.d.ts +3 -0
- package/dist/types/model/chat/chatCost.d.ts +30 -0
- package/dist/types/model/chat/chatMessages.d.ts +5 -0
- package/dist/types/model/chat/openAIChatRequest.d.ts +39 -0
- package/dist/types/model/chat/openAIChatRuntime.d.ts +61 -0
- package/dist/types/model/chat/streamChatResponse.d.ts +27 -0
- package/dist/types/model/chat/tokenBudget.d.ts +3 -0
- package/dist/types/model/chat-v2/aiSdkBridge.d.ts +2 -0
- package/dist/types/model/chat-v2/chatV2EditorCache.d.ts +25 -0
- package/dist/types/model/chat-v2/chatV2Errors.d.ts +23 -0
- package/dist/types/model/chat-v2/chatV2FeatureCompatibility.d.ts +12 -0
- package/dist/types/model/chat-v2/chatV2Pipeline.d.ts +2 -0
- package/dist/types/model/chat-v2/chatV2ResponseFormat.d.ts +24 -0
- package/dist/types/model/chat-v2/chatV2Retry.d.ts +5 -0
- package/dist/types/model/chat-v2/chatV2RuntimeOptions.d.ts +12 -0
- package/dist/types/model/chat-v2/chatV2Shared.d.ts +56 -0
- package/dist/types/model/chat-v2/chatV2Types.d.ts +110 -0
- package/dist/types/model/chat-v2/index.d.ts +10 -0
- package/dist/types/model/chat-v2/llmChatV2NodeData.d.ts +73 -0
- package/dist/types/model/chat-v2/llmChatV2NodeEditors.d.ts +4 -0
- package/dist/types/model/chat-v2/llmChatV2NodeRuntime.d.ts +23 -0
- package/dist/types/model/chat-v2/messageConverter.d.ts +8 -0
- package/dist/types/model/chat-v2/modelRegistry.d.ts +296 -0
- package/dist/types/model/chat-v2/providerOptions.d.ts +59 -0
- package/dist/types/model/chat-v2/toolContinuation.d.ts +15 -0
- package/dist/types/model/chat-v2/toolConverter.d.ts +3 -0
- package/dist/types/model/interpolationInputDefinition.d.ts +16 -0
- package/dist/types/model/loopControllerBreak.d.ts +3 -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 +23 -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/ChatLoopNode.d.ts +21 -0
- package/dist/types/model/nodes/ChatNode.d.ts +17 -0
- package/dist/types/model/nodes/ChatNodeBase.d.ts +85 -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 +27 -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/CronNode.d.ts +34 -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 +28 -0
- package/dist/types/model/nodes/DestructureNode.d.ts +19 -0
- package/dist/types/model/nodes/DocumentNode.d.ts +28 -0
- package/dist/types/model/nodes/EvaluateNode.d.ts +19 -0
- package/dist/types/model/nodes/ExpressionNode.d.ts +21 -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 +22 -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/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 +32 -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/JSFilterNode.d.ts +19 -0
- package/dist/types/model/nodes/JSMapNode.d.ts +19 -0
- package/dist/types/model/nodes/JoinNode.d.ts +21 -0
- package/dist/types/model/nodes/LLMChatV2Node.d.ts +20 -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/LoopUntilNode.d.ts +32 -0
- package/dist/types/model/nodes/MCPDiscoveryNode.d.ts +9 -0
- package/dist/types/model/nodes/MCPGetPromptNode.d.ts +23 -0
- package/dist/types/model/nodes/MCPToolCallNode.d.ts +26 -0
- package/dist/types/model/nodes/MatchNode.d.ts +20 -0
- package/dist/types/model/nodes/NumberNode.d.ts +21 -0
- package/dist/types/model/nodes/ObjectNode.d.ts +19 -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 +25 -0
- package/dist/types/model/nodes/RaceInputsNode.d.ts +16 -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/ReadAllFilesNode.d.ts +30 -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/ReferencedGraphAliasNode.d.ts +31 -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 +19 -0
- package/dist/types/model/nodes/ToJsonNode.d.ts +18 -0
- package/dist/types/model/nodes/ToMarkdownTableNode.d.ts +19 -0
- package/dist/types/model/nodes/ToTreeNode.d.ts +21 -0
- package/dist/types/model/nodes/ToYamlNode.d.ts +13 -0
- package/dist/types/model/nodes/ToolNode.d.ts +25 -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 +20 -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/model/nodes/codeNodeErrorDiagnostics.d.ts +9 -0
- package/dist/types/model/nodes/jsListCallbackHelpers.d.ts +23 -0
- package/dist/types/model/nodes/jsValueInterpolation.d.ts +11 -0
- package/dist/types/model/nodes/toolCallDelegation.d.ts +29 -0
- package/dist/types/native/BaseDir.d.ts +29 -0
- package/dist/types/native/BrowserNativeApi.d.ts +9 -0
- package/dist/types/native/NativeApi.d.ts +17 -0
- package/dist/types/plugins/anthropic/anthropic.d.ts +315 -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 +40 -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 +10 -0
- package/dist/types/plugins/google/google.d.ts +129 -0
- package/dist/types/plugins/google/index.d.ts +2 -0
- package/dist/types/plugins/google/nodes/ChatGoogleNode.d.ts +35 -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 +22 -0
- package/dist/types/recording/ExecutionRecorder.d.ts +27 -0
- package/dist/types/recording/RecordedEvents.d.ts +114 -0
- package/dist/types/utils/assertNever.d.ts +1 -0
- package/dist/types/utils/base64.d.ts +3 -0
- package/dist/types/utils/chatMessageToOpenAIChatCompletionMessage.d.ts +5 -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/emitDetached.d.ts +11 -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 +17 -0
- package/dist/types/utils/inputs.d.ts +3 -0
- package/dist/types/utils/interpolation.d.ts +26 -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 +784 -0
- package/dist/types/utils/orderedStringPortIds.d.ts +10 -0
- package/dist/types/utils/outputs.d.ts +3 -0
- package/dist/types/utils/pQueueCompat.d.ts +10 -0
- package/dist/types/utils/paths.d.ts +8 -0
- package/dist/types/utils/providerStreamParsing.d.ts +1 -0
- package/dist/types/utils/runtimeLogging.d.ts +10 -0
- package/dist/types/utils/serialization/serialization.d.ts +12 -0
- package/dist/types/utils/serialization/serializationHelpers.d.ts +27 -0
- package/dist/types/utils/serialization/serializationUtils.d.ts +16 -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/dist/types/vendor/fnv1a.d.ts +9 -0
- package/package.json +77 -0
|
@@ -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');
|
|
@@ -0,0 +1,129 @@
|
|
|
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 IfNodeImpl extends NodeImpl {
|
|
9
|
+
static create = () => {
|
|
10
|
+
const chartNode = {
|
|
11
|
+
type: 'if',
|
|
12
|
+
title: 'If',
|
|
13
|
+
id: nanoid(),
|
|
14
|
+
data: {
|
|
15
|
+
// Legacy behavior is false
|
|
16
|
+
unconnectedControlFlowExcluded: true,
|
|
17
|
+
},
|
|
18
|
+
visualData: {
|
|
19
|
+
x: 0,
|
|
20
|
+
y: 0,
|
|
21
|
+
width: 125,
|
|
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 value will be passed through the True port. Otherwise, it will be passed through the False port. An unconnected port is considered false.',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
id: 'value',
|
|
36
|
+
title: 'Value',
|
|
37
|
+
dataType: 'any',
|
|
38
|
+
description: 'The value to pass through the True or False port. If unconnected, it will be undefined.',
|
|
39
|
+
},
|
|
40
|
+
];
|
|
41
|
+
}
|
|
42
|
+
getOutputDefinitions() {
|
|
43
|
+
return [
|
|
44
|
+
{
|
|
45
|
+
id: 'output',
|
|
46
|
+
title: 'True',
|
|
47
|
+
dataType: 'any',
|
|
48
|
+
description: 'The `value` passed through if the condition is truthy.',
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
id: 'falseOutput',
|
|
52
|
+
title: 'False',
|
|
53
|
+
dataType: 'any',
|
|
54
|
+
description: 'The `value` passed through if the condition is falsy.',
|
|
55
|
+
},
|
|
56
|
+
];
|
|
57
|
+
}
|
|
58
|
+
static getUIData() {
|
|
59
|
+
return {
|
|
60
|
+
infoBoxBody: dedent `
|
|
61
|
+
Takes in a condition and a value. If the condition is truthy, the value is passed through the True port, and the False port is not ran.
|
|
62
|
+
If the condition is falsy, the value is passed through the False port, and the True port is not ran.
|
|
63
|
+
`,
|
|
64
|
+
infoBoxTitle: 'If Node',
|
|
65
|
+
contextMenuTitle: 'If',
|
|
66
|
+
group: ['Logic'],
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
getEditors() {
|
|
70
|
+
return [
|
|
71
|
+
{
|
|
72
|
+
type: 'toggle',
|
|
73
|
+
label: "Don't run unconnected value",
|
|
74
|
+
dataKey: 'unconnectedControlFlowExcluded',
|
|
75
|
+
},
|
|
76
|
+
];
|
|
77
|
+
}
|
|
78
|
+
async process(inputData) {
|
|
79
|
+
const unconnectedValue = this.data.unconnectedControlFlowExcluded
|
|
80
|
+
? { type: 'control-flow-excluded', value: undefined }
|
|
81
|
+
: { type: 'any', value: undefined };
|
|
82
|
+
const ifValue = inputData['if'];
|
|
83
|
+
const value = inputData['value'] ?? unconnectedValue;
|
|
84
|
+
const isFalse = {
|
|
85
|
+
output: {
|
|
86
|
+
type: 'control-flow-excluded',
|
|
87
|
+
value: undefined,
|
|
88
|
+
},
|
|
89
|
+
falseOutput: value,
|
|
90
|
+
};
|
|
91
|
+
if (!ifValue) {
|
|
92
|
+
return isFalse;
|
|
93
|
+
}
|
|
94
|
+
if (ifValue.type === 'control-flow-excluded') {
|
|
95
|
+
return isFalse;
|
|
96
|
+
}
|
|
97
|
+
if (ifValue.type === 'string' && !ifValue.value) {
|
|
98
|
+
return isFalse;
|
|
99
|
+
}
|
|
100
|
+
if (ifValue.type === 'boolean' && !ifValue.value) {
|
|
101
|
+
return isFalse;
|
|
102
|
+
}
|
|
103
|
+
if (ifValue.type === 'chat-message') {
|
|
104
|
+
const asString = coerceType(ifValue, 'string');
|
|
105
|
+
if (!asString) {
|
|
106
|
+
return isFalse;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
if (ifValue.type === 'object' || ifValue.type === 'any') {
|
|
110
|
+
if (!ifValue.value) {
|
|
111
|
+
return isFalse;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
if (ifValue.type.endsWith('[]')) {
|
|
115
|
+
const value = ifValue;
|
|
116
|
+
if (!value.value || value.value.length === 0) {
|
|
117
|
+
return isFalse;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return {
|
|
121
|
+
['output']: value,
|
|
122
|
+
['falseOutput']: {
|
|
123
|
+
type: 'control-flow-excluded',
|
|
124
|
+
value: undefined,
|
|
125
|
+
},
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
export const ifNode = nodeDefinition(IfNodeImpl, 'If');
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import {} from '../NodeBase.js';
|
|
2
|
+
import { NodeImpl } from '../NodeImpl.js';
|
|
3
|
+
import { nodeDefinition } from '../NodeDefinition.js';
|
|
4
|
+
import { nanoid } from 'nanoid/non-secure';
|
|
5
|
+
import {} from '../../index.js';
|
|
6
|
+
import { base64ToUint8Array } from '../../utils/base64.js';
|
|
7
|
+
import { expectType } from '../../utils/expectType.js';
|
|
8
|
+
export class ImageNodeImpl extends NodeImpl {
|
|
9
|
+
static create() {
|
|
10
|
+
return {
|
|
11
|
+
id: nanoid(),
|
|
12
|
+
type: 'image',
|
|
13
|
+
title: 'Image',
|
|
14
|
+
visualData: { x: 0, y: 0, width: 250 },
|
|
15
|
+
data: {
|
|
16
|
+
useDataInput: false,
|
|
17
|
+
mediaType: 'image/png',
|
|
18
|
+
useMediaTypeInput: false,
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
getInputDefinitions() {
|
|
23
|
+
const inputDefinitions = [];
|
|
24
|
+
if (this.chartNode.data.useDataInput) {
|
|
25
|
+
inputDefinitions.push({
|
|
26
|
+
id: 'data',
|
|
27
|
+
title: 'Data',
|
|
28
|
+
dataType: 'binary',
|
|
29
|
+
coerced: false,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
if (this.chartNode.data.useMediaTypeInput) {
|
|
33
|
+
inputDefinitions.push({
|
|
34
|
+
id: 'mediaType',
|
|
35
|
+
title: 'Media Type',
|
|
36
|
+
dataType: 'string',
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
return inputDefinitions;
|
|
40
|
+
}
|
|
41
|
+
getOutputDefinitions() {
|
|
42
|
+
return [
|
|
43
|
+
{
|
|
44
|
+
id: 'image',
|
|
45
|
+
title: 'Image',
|
|
46
|
+
dataType: 'image',
|
|
47
|
+
},
|
|
48
|
+
];
|
|
49
|
+
}
|
|
50
|
+
getEditors() {
|
|
51
|
+
return [
|
|
52
|
+
{
|
|
53
|
+
type: 'dropdown',
|
|
54
|
+
label: 'Media Type',
|
|
55
|
+
dataKey: 'mediaType',
|
|
56
|
+
options: [
|
|
57
|
+
{ value: 'image/png', label: 'PNG' },
|
|
58
|
+
{ value: 'image/jpeg', label: 'JPEG' },
|
|
59
|
+
{ value: 'image/gif', label: 'GIF' },
|
|
60
|
+
],
|
|
61
|
+
useInputToggleDataKey: 'useMediaTypeInput',
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
type: 'imageBrowser',
|
|
65
|
+
label: 'Image',
|
|
66
|
+
dataKey: 'data',
|
|
67
|
+
useInputToggleDataKey: 'useDataInput',
|
|
68
|
+
mediaTypeDataKey: 'mediaType',
|
|
69
|
+
},
|
|
70
|
+
];
|
|
71
|
+
}
|
|
72
|
+
static getUIData() {
|
|
73
|
+
return {
|
|
74
|
+
contextMenuTitle: 'Image',
|
|
75
|
+
group: 'Data',
|
|
76
|
+
infoBoxTitle: 'Image Node',
|
|
77
|
+
infoBoxBody: 'Defines a static image for use with other nodes. Can convert a binary type into an image type.',
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
async process(inputData, context) {
|
|
81
|
+
let data;
|
|
82
|
+
if (this.chartNode.data.useDataInput) {
|
|
83
|
+
data = expectType(inputData['data'], 'binary');
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
const dataRef = this.data.data?.refId;
|
|
87
|
+
if (!dataRef) {
|
|
88
|
+
throw new Error('No data ref');
|
|
89
|
+
}
|
|
90
|
+
const encodedData = context.project.data?.[dataRef];
|
|
91
|
+
if (!encodedData) {
|
|
92
|
+
throw new Error(`No data at ref ${dataRef}`);
|
|
93
|
+
}
|
|
94
|
+
data = base64ToUint8Array(encodedData);
|
|
95
|
+
}
|
|
96
|
+
const mediaType = this.chartNode.data.useMediaTypeInput
|
|
97
|
+
? expectType(inputData['mediaType'], 'string')
|
|
98
|
+
: this.chartNode.data.mediaType;
|
|
99
|
+
return {
|
|
100
|
+
['image']: {
|
|
101
|
+
type: 'image',
|
|
102
|
+
value: { mediaType: mediaType, data },
|
|
103
|
+
},
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
export const imageNode = nodeDefinition(ImageNodeImpl, 'Image');
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import {} from '../NodeBase.js';
|
|
2
|
+
import { nanoid } from 'nanoid/non-secure';
|
|
3
|
+
import { NodeImpl } from '../NodeImpl.js';
|
|
4
|
+
import {} from '../../index.js';
|
|
5
|
+
import { dedent } from 'ts-dedent';
|
|
6
|
+
import { nodeDefinition } from '../NodeDefinition.js';
|
|
7
|
+
import { buildJSFilterWrapper, getJSListEditors, getJSListInputDefinitions, getJSListNodeBody, runJSListNodeCode, } from './jsListCallbackHelpers.js';
|
|
8
|
+
const DEFAULT_CALLBACK_BODY = 'return item != null;';
|
|
9
|
+
export class JSFilterNodeImpl extends NodeImpl {
|
|
10
|
+
static create() {
|
|
11
|
+
const chartNode = {
|
|
12
|
+
type: 'jsFilter',
|
|
13
|
+
title: 'JS Filter',
|
|
14
|
+
id: nanoid(),
|
|
15
|
+
visualData: {
|
|
16
|
+
x: 0,
|
|
17
|
+
y: 0,
|
|
18
|
+
width: 220,
|
|
19
|
+
},
|
|
20
|
+
data: {
|
|
21
|
+
callbackBody: DEFAULT_CALLBACK_BODY,
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
return chartNode;
|
|
25
|
+
}
|
|
26
|
+
getInputDefinitions() {
|
|
27
|
+
return getJSListInputDefinitions(this.data.callbackBody);
|
|
28
|
+
}
|
|
29
|
+
getOutputDefinitions() {
|
|
30
|
+
return [
|
|
31
|
+
{
|
|
32
|
+
id: 'filtered',
|
|
33
|
+
title: 'Filtered',
|
|
34
|
+
dataType: 'any[]',
|
|
35
|
+
},
|
|
36
|
+
];
|
|
37
|
+
}
|
|
38
|
+
getEditors() {
|
|
39
|
+
return getJSListEditors();
|
|
40
|
+
}
|
|
41
|
+
getBody() {
|
|
42
|
+
return getJSListNodeBody(this.data.callbackBody);
|
|
43
|
+
}
|
|
44
|
+
static getUIData() {
|
|
45
|
+
return {
|
|
46
|
+
infoBoxBody: dedent `
|
|
47
|
+
Filters an input array using the body of a JavaScript callback.
|
|
48
|
+
|
|
49
|
+
Available callback parameters are <code>item</code>, <code>index</code>, and <code>array</code>.
|
|
50
|
+
Write only the callback body and still use <code>return</code> to decide whether each item is included.
|
|
51
|
+
Use <code>{{var}}</code> to add input ports that evaluate as connected values.
|
|
52
|
+
`,
|
|
53
|
+
infoBoxTitle: 'JS Filter Node',
|
|
54
|
+
contextMenuTitle: 'JS Filter',
|
|
55
|
+
group: ['Lists'],
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
async process(inputs, context) {
|
|
59
|
+
return runJSListNodeCode({
|
|
60
|
+
buildWrapper: buildJSFilterWrapper,
|
|
61
|
+
callbackBody: this.data.callbackBody,
|
|
62
|
+
context,
|
|
63
|
+
inputs,
|
|
64
|
+
nodeName: 'JS Filter',
|
|
65
|
+
outputId: 'filtered',
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
export const jsFilterNode = nodeDefinition(JSFilterNodeImpl, 'JS Filter');
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import {} from '../NodeBase.js';
|
|
2
|
+
import { nanoid } from 'nanoid/non-secure';
|
|
3
|
+
import { NodeImpl } from '../NodeImpl.js';
|
|
4
|
+
import {} from '../../index.js';
|
|
5
|
+
import { dedent } from 'ts-dedent';
|
|
6
|
+
import { nodeDefinition } from '../NodeDefinition.js';
|
|
7
|
+
import { buildJSMapWrapper, getJSListEditors, getJSListInputDefinitions, getJSListNodeBody, runJSListNodeCode, } from './jsListCallbackHelpers.js';
|
|
8
|
+
const DEFAULT_CALLBACK_BODY = 'return item;';
|
|
9
|
+
export class JSMapNodeImpl extends NodeImpl {
|
|
10
|
+
static create() {
|
|
11
|
+
const chartNode = {
|
|
12
|
+
type: 'jsMap',
|
|
13
|
+
title: 'JS Map',
|
|
14
|
+
id: nanoid(),
|
|
15
|
+
visualData: {
|
|
16
|
+
x: 0,
|
|
17
|
+
y: 0,
|
|
18
|
+
width: 220,
|
|
19
|
+
},
|
|
20
|
+
data: {
|
|
21
|
+
callbackBody: DEFAULT_CALLBACK_BODY,
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
return chartNode;
|
|
25
|
+
}
|
|
26
|
+
getInputDefinitions() {
|
|
27
|
+
return getJSListInputDefinitions(this.data.callbackBody);
|
|
28
|
+
}
|
|
29
|
+
getOutputDefinitions() {
|
|
30
|
+
return [
|
|
31
|
+
{
|
|
32
|
+
id: 'mapped',
|
|
33
|
+
title: 'Mapped',
|
|
34
|
+
dataType: 'any[]',
|
|
35
|
+
},
|
|
36
|
+
];
|
|
37
|
+
}
|
|
38
|
+
getEditors() {
|
|
39
|
+
return getJSListEditors();
|
|
40
|
+
}
|
|
41
|
+
getBody() {
|
|
42
|
+
return getJSListNodeBody(this.data.callbackBody);
|
|
43
|
+
}
|
|
44
|
+
static getUIData() {
|
|
45
|
+
return {
|
|
46
|
+
infoBoxBody: dedent `
|
|
47
|
+
Maps an input array using the body of a JavaScript callback.
|
|
48
|
+
|
|
49
|
+
Available callback parameters are <code>item</code>, <code>index</code>, and <code>array</code>.
|
|
50
|
+
Write only the callback body and still use <code>return</code> to produce each mapped item.
|
|
51
|
+
Use <code>{{var}}</code> to add input ports that evaluate as connected values.
|
|
52
|
+
`,
|
|
53
|
+
infoBoxTitle: 'JS Map Node',
|
|
54
|
+
contextMenuTitle: 'JS Map',
|
|
55
|
+
group: ['Lists'],
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
async process(inputs, context) {
|
|
59
|
+
return runJSListNodeCode({
|
|
60
|
+
buildWrapper: buildJSMapWrapper,
|
|
61
|
+
callbackBody: this.data.callbackBody,
|
|
62
|
+
context,
|
|
63
|
+
inputs,
|
|
64
|
+
nodeName: 'JS Map',
|
|
65
|
+
outputId: 'mapped',
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
export const jsMapNode = nodeDefinition(JSMapNodeImpl, 'JS Map');
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { NodeImpl } from '../NodeImpl.js';
|
|
2
|
+
import { nodeDefinition } from '../NodeDefinition.js';
|
|
3
|
+
import {} from '../NodeBase.js';
|
|
4
|
+
import { isArrayDataValue } from '../DataValue.js';
|
|
5
|
+
import { nanoid } from 'nanoid/non-secure';
|
|
6
|
+
import { coerceType, coerceTypeOptional, inferType } from '../../utils/coerceType.js';
|
|
7
|
+
import {} from '../GraphProcessor.js';
|
|
8
|
+
import { dedent } from 'ts-dedent';
|
|
9
|
+
import {} from '../EditorDefinition.js';
|
|
10
|
+
import { handleEscapeCharacters } from '../../utils/index.js';
|
|
11
|
+
export class JoinNodeImpl extends NodeImpl {
|
|
12
|
+
static create = () => {
|
|
13
|
+
const chartNode = {
|
|
14
|
+
type: 'join',
|
|
15
|
+
title: 'Join',
|
|
16
|
+
id: nanoid(),
|
|
17
|
+
data: {
|
|
18
|
+
flatten: true,
|
|
19
|
+
joinString: '\n',
|
|
20
|
+
},
|
|
21
|
+
visualData: {
|
|
22
|
+
x: 0,
|
|
23
|
+
y: 0,
|
|
24
|
+
width: 150,
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
return chartNode;
|
|
28
|
+
};
|
|
29
|
+
getInputDefinitions(connections) {
|
|
30
|
+
const inputs = [];
|
|
31
|
+
const inputCount = this.#getInputPortCount(connections);
|
|
32
|
+
if (this.data.useJoinStringInput) {
|
|
33
|
+
inputs.push({
|
|
34
|
+
dataType: 'string',
|
|
35
|
+
id: 'joinString',
|
|
36
|
+
title: 'Join String',
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
for (let i = 1; i <= inputCount; i++) {
|
|
40
|
+
inputs.push({
|
|
41
|
+
dataType: 'string',
|
|
42
|
+
id: `input${i}`,
|
|
43
|
+
title: `Input ${i}`,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
return inputs;
|
|
47
|
+
}
|
|
48
|
+
getOutputDefinitions() {
|
|
49
|
+
return [
|
|
50
|
+
{
|
|
51
|
+
dataType: 'string',
|
|
52
|
+
id: 'output',
|
|
53
|
+
title: 'Joined',
|
|
54
|
+
},
|
|
55
|
+
];
|
|
56
|
+
}
|
|
57
|
+
#getInputPortCount(connections) {
|
|
58
|
+
const inputNodeId = this.chartNode.id;
|
|
59
|
+
const inputConnections = connections.filter((connection) => connection.inputNodeId === inputNodeId && connection.inputId.startsWith('input'));
|
|
60
|
+
let maxInputNumber = 0;
|
|
61
|
+
for (const connection of inputConnections) {
|
|
62
|
+
const messageNumber = parseInt(connection.inputId.replace('input', ''), 10);
|
|
63
|
+
if (messageNumber > maxInputNumber) {
|
|
64
|
+
maxInputNumber = messageNumber;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return maxInputNumber + 1;
|
|
68
|
+
}
|
|
69
|
+
getEditors() {
|
|
70
|
+
return [
|
|
71
|
+
{
|
|
72
|
+
type: 'toggle',
|
|
73
|
+
label: 'Flatten',
|
|
74
|
+
dataKey: 'flatten',
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
type: 'code',
|
|
78
|
+
label: 'Join String',
|
|
79
|
+
dataKey: 'joinString',
|
|
80
|
+
useInputToggleDataKey: 'useJoinStringInput',
|
|
81
|
+
language: 'plaintext',
|
|
82
|
+
},
|
|
83
|
+
];
|
|
84
|
+
}
|
|
85
|
+
getBody() {
|
|
86
|
+
return this.data.useJoinStringInput
|
|
87
|
+
? '(Join value is input)'
|
|
88
|
+
: this.data.joinString === '\n'
|
|
89
|
+
? '(New line)'
|
|
90
|
+
: this.data.joinString === '\t'
|
|
91
|
+
? '(Tab)'
|
|
92
|
+
: this.data.joinString === ' '
|
|
93
|
+
? '(Space)'
|
|
94
|
+
: this.data.joinString;
|
|
95
|
+
}
|
|
96
|
+
static getUIData() {
|
|
97
|
+
return {
|
|
98
|
+
infoBoxBody: dedent `
|
|
99
|
+
Takes an array of strings, and joins them using the configured delimiter.
|
|
100
|
+
|
|
101
|
+
Defaults to a newline.
|
|
102
|
+
`,
|
|
103
|
+
infoBoxTitle: 'Join Node',
|
|
104
|
+
contextMenuTitle: 'Join',
|
|
105
|
+
group: ['Text'],
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
async process(inputs) {
|
|
109
|
+
const joinString = this.data.useJoinStringInput
|
|
110
|
+
? coerceTypeOptional(inputs['joinString'], 'string') ?? this.data.joinString
|
|
111
|
+
: this.data.joinString;
|
|
112
|
+
const normalizedJoinString = handleEscapeCharacters(joinString);
|
|
113
|
+
const inputKeys = Object.keys(inputs).filter((key) => key.startsWith('input'));
|
|
114
|
+
const inputValueStrings = [];
|
|
115
|
+
for (let i = 1; i <= inputKeys.length; i++) {
|
|
116
|
+
const inputValue = inputs[`input${i}`];
|
|
117
|
+
if (isArrayDataValue(inputValue) && this.data.flatten) {
|
|
118
|
+
for (const value of inputValue.value) {
|
|
119
|
+
inputValueStrings.push(coerceType(inferType(value), 'string'));
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
else if (inputValue) {
|
|
123
|
+
inputValueStrings.push(coerceType(inputValue, 'string'));
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
const outputValue = inputValueStrings.join(normalizedJoinString);
|
|
127
|
+
return {
|
|
128
|
+
['output']: {
|
|
129
|
+
type: 'string',
|
|
130
|
+
value: outputValue,
|
|
131
|
+
},
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
export const joinNode = nodeDefinition(JoinNodeImpl, 'Coalesce');
|