@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,199 @@
|
|
|
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 '../Project.js';
|
|
8
|
+
import {} from './GraphInputNode.js';
|
|
9
|
+
import {} from './GraphOutputNode.js';
|
|
10
|
+
import {} from '../DataValue.js';
|
|
11
|
+
import {} from '../ProcessContext.js';
|
|
12
|
+
import { dedent } from 'ts-dedent';
|
|
13
|
+
import { getError } from '../../utils/errors.js';
|
|
14
|
+
export class ReferencedGraphAliasNodeImpl extends NodeImpl {
|
|
15
|
+
static create() {
|
|
16
|
+
const chartNode = {
|
|
17
|
+
type: 'referencedGraphAlias',
|
|
18
|
+
title: '', // Always set initially by the editor
|
|
19
|
+
id: nanoid(),
|
|
20
|
+
visualData: {
|
|
21
|
+
x: 0,
|
|
22
|
+
y: 0,
|
|
23
|
+
width: 300,
|
|
24
|
+
},
|
|
25
|
+
data: {
|
|
26
|
+
projectId: undefined, // Always set initially by the editor
|
|
27
|
+
graphId: undefined, // Always set initially by the editor
|
|
28
|
+
useErrorOutput: false,
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
return chartNode;
|
|
32
|
+
}
|
|
33
|
+
getInputDefinitions(_connections, _nodes, _project, referencedProjects) {
|
|
34
|
+
const referencedProject = referencedProjects[this.data.projectId];
|
|
35
|
+
if (!referencedProject) {
|
|
36
|
+
return [];
|
|
37
|
+
}
|
|
38
|
+
const graph = referencedProject.graphs[this.data.graphId];
|
|
39
|
+
if (!graph) {
|
|
40
|
+
return [];
|
|
41
|
+
}
|
|
42
|
+
const inputNodes = graph.nodes.filter((node) => node.type === 'graphInput');
|
|
43
|
+
const inputIds = [...new Set(inputNodes.map((node) => node.data.id))].sort();
|
|
44
|
+
return inputIds.map((id) => ({
|
|
45
|
+
id: id,
|
|
46
|
+
title: id,
|
|
47
|
+
dataType: inputNodes.find((node) => node.data.id === id).data.dataType,
|
|
48
|
+
}));
|
|
49
|
+
}
|
|
50
|
+
getGraphOutputs(referencedProject) {
|
|
51
|
+
const graph = referencedProject.graphs[this.data.graphId];
|
|
52
|
+
if (!graph) {
|
|
53
|
+
return [];
|
|
54
|
+
}
|
|
55
|
+
const outputNodes = graph.nodes.filter((node) => node.type === 'graphOutput');
|
|
56
|
+
const outputIds = [...new Set(outputNodes.map((node) => node.data.id))].sort();
|
|
57
|
+
const outputs = outputIds.map((id) => ({
|
|
58
|
+
id: id,
|
|
59
|
+
title: id,
|
|
60
|
+
dataType: outputNodes.find((node) => node.data.id === id).data.dataType,
|
|
61
|
+
}));
|
|
62
|
+
return outputs;
|
|
63
|
+
}
|
|
64
|
+
getOutputDefinitions(_connections, _nodes, _project, referencedProjects) {
|
|
65
|
+
const outputs = [];
|
|
66
|
+
const referencedProject = referencedProjects[this.data.projectId];
|
|
67
|
+
if (!referencedProject) {
|
|
68
|
+
return outputs;
|
|
69
|
+
}
|
|
70
|
+
outputs.push(...this.getGraphOutputs(referencedProject));
|
|
71
|
+
if (this.data.useErrorOutput) {
|
|
72
|
+
outputs.push({
|
|
73
|
+
id: 'error',
|
|
74
|
+
title: 'Error',
|
|
75
|
+
dataType: 'string',
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
return outputs;
|
|
79
|
+
}
|
|
80
|
+
getEditors(context) {
|
|
81
|
+
const definitions = [
|
|
82
|
+
{
|
|
83
|
+
type: 'toggle',
|
|
84
|
+
label: 'Use Error Output',
|
|
85
|
+
dataKey: 'useErrorOutput',
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
type: 'toggle',
|
|
89
|
+
label: 'Output Cost & Duration',
|
|
90
|
+
dataKey: 'outputCostDuration',
|
|
91
|
+
},
|
|
92
|
+
];
|
|
93
|
+
const referencedProject = context.referencedProjects[this.data.projectId];
|
|
94
|
+
if (referencedProject) {
|
|
95
|
+
const graph = referencedProject.graphs[this.data.graphId];
|
|
96
|
+
if (graph) {
|
|
97
|
+
const inputNodes = graph.nodes.filter((node) => node.type === 'graphInput');
|
|
98
|
+
const inputIds = [...new Set(inputNodes.map((node) => node.data.id))].sort();
|
|
99
|
+
for (const inputId of inputIds) {
|
|
100
|
+
const inputNode = inputNodes.find((node) => node.data.id === inputId);
|
|
101
|
+
definitions.push({
|
|
102
|
+
type: 'dynamic',
|
|
103
|
+
dataKey: 'inputData',
|
|
104
|
+
dynamicDataKey: inputNode.data.id,
|
|
105
|
+
dataType: inputNode.data.dataType,
|
|
106
|
+
label: inputNode.data.id,
|
|
107
|
+
editor: inputNode.data.editor ?? 'auto',
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return definitions;
|
|
113
|
+
}
|
|
114
|
+
getBody(context) {
|
|
115
|
+
return context.referencedProjects[this.data.projectId]?.graphs[this.data.graphId]?.metadata?.description ?? '';
|
|
116
|
+
}
|
|
117
|
+
static getUIData() {
|
|
118
|
+
return {
|
|
119
|
+
infoBoxBody: dedent `
|
|
120
|
+
References a graph from another project. Inputs and outputs are defined by Graph Input and Graph Output nodes within the referenced graph.
|
|
121
|
+
`,
|
|
122
|
+
infoBoxTitle: 'Referenced Graph Alias Node',
|
|
123
|
+
contextMenuTitle: 'Referenced Graph Alias',
|
|
124
|
+
group: ['Advanced'],
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
async process(inputs, context) {
|
|
128
|
+
const referencedProject = context.referencedProjects[this.data.projectId];
|
|
129
|
+
if (!referencedProject) {
|
|
130
|
+
throw new Error(`ReferencedGraphAliasNode requires a project with id ${this.data.projectId} to be available in the context.referencedProjects.`);
|
|
131
|
+
}
|
|
132
|
+
const graph = referencedProject.graphs[this.data.graphId];
|
|
133
|
+
if (!graph) {
|
|
134
|
+
throw new Error(`ReferencedGraphAliasNode requires a graph with id ${this.data.graphId} to be present in the referenced project.`);
|
|
135
|
+
}
|
|
136
|
+
const inputNodes = graph.nodes.filter((node) => node.type === 'graphInput');
|
|
137
|
+
const inputIds = [...new Set(inputNodes.map((node) => node.data.id))].sort();
|
|
138
|
+
const inputData = inputIds.reduce((obj, id) => {
|
|
139
|
+
if (inputs[id] != null) {
|
|
140
|
+
return {
|
|
141
|
+
...obj,
|
|
142
|
+
[id]: inputs[id],
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
if (this.data.inputData?.[id] != null) {
|
|
146
|
+
return {
|
|
147
|
+
...obj,
|
|
148
|
+
[id]: this.data.inputData[id],
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
return obj;
|
|
152
|
+
}, {});
|
|
153
|
+
// Create a subprocessor using the referenced project's graph
|
|
154
|
+
const subGraphProcessor = context.createSubProcessor(this.data.graphId, {
|
|
155
|
+
signal: context.signal,
|
|
156
|
+
project: referencedProject,
|
|
157
|
+
});
|
|
158
|
+
try {
|
|
159
|
+
const startTime = Date.now();
|
|
160
|
+
const outputs = await subGraphProcessor.processGraph(context, inputData, context.contextValues);
|
|
161
|
+
const duration = Date.now() - startTime;
|
|
162
|
+
if (this.data.useErrorOutput) {
|
|
163
|
+
outputs['error'] = {
|
|
164
|
+
type: 'control-flow-excluded',
|
|
165
|
+
value: undefined,
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
if (outputs['duration'] == null) {
|
|
169
|
+
outputs['duration'] = {
|
|
170
|
+
type: 'number',
|
|
171
|
+
value: duration,
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
if (!this.data.outputCostDuration) {
|
|
175
|
+
delete outputs['cost'];
|
|
176
|
+
delete outputs['duration'];
|
|
177
|
+
}
|
|
178
|
+
return outputs;
|
|
179
|
+
}
|
|
180
|
+
catch (err) {
|
|
181
|
+
if (!this.data.useErrorOutput) {
|
|
182
|
+
throw err;
|
|
183
|
+
}
|
|
184
|
+
const outputs = this.getGraphOutputs(referencedProject).reduce((obj, output) => ({
|
|
185
|
+
...obj,
|
|
186
|
+
[output.id]: {
|
|
187
|
+
type: 'control-flow-excluded',
|
|
188
|
+
value: undefined,
|
|
189
|
+
},
|
|
190
|
+
}), {});
|
|
191
|
+
outputs['error'] = {
|
|
192
|
+
type: 'string',
|
|
193
|
+
value: getError(err).message,
|
|
194
|
+
};
|
|
195
|
+
return outputs;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
export const referencedGraphAliasNode = nodeDefinition(ReferencedGraphAliasNodeImpl, 'Referenced Graph Alias');
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { NodeImpl } from '../NodeImpl.js';
|
|
2
|
+
import { nanoid } from 'nanoid/non-secure';
|
|
3
|
+
import { dedent } from 'ts-dedent';
|
|
4
|
+
import { nodeDefinition } from '../NodeDefinition.js';
|
|
5
|
+
import { getInputOrData, coerceType, newId, inferType } from '../../utils/index.js';
|
|
6
|
+
import { unwrapDataValue } from '../DataValue.js';
|
|
7
|
+
export class ReplaceDatasetNodeImpl extends NodeImpl {
|
|
8
|
+
static create() {
|
|
9
|
+
return {
|
|
10
|
+
id: nanoid(),
|
|
11
|
+
type: 'replaceDataset',
|
|
12
|
+
title: 'Replace Dataset',
|
|
13
|
+
visualData: { x: 0, y: 0, width: 250 },
|
|
14
|
+
data: {
|
|
15
|
+
datasetId: '',
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
getInputDefinitions() {
|
|
20
|
+
const inputDefinitions = [];
|
|
21
|
+
inputDefinitions.push({
|
|
22
|
+
id: 'data',
|
|
23
|
+
dataType: 'object[]',
|
|
24
|
+
title: 'Data',
|
|
25
|
+
description: 'The new data of the dataset. If empty, the dataset will be cleared. May be an array of array of strings, or an array of DatasetRow objects with { id, data } properties. If a string[][], IDs will be generated.',
|
|
26
|
+
});
|
|
27
|
+
if (this.data.useDatasetIdInput) {
|
|
28
|
+
inputDefinitions.push({
|
|
29
|
+
id: 'datasetId',
|
|
30
|
+
title: 'Dataset ID',
|
|
31
|
+
dataType: 'string',
|
|
32
|
+
description: 'The ID of the dataset to replace.',
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
return inputDefinitions;
|
|
36
|
+
}
|
|
37
|
+
getOutputDefinitions() {
|
|
38
|
+
return [
|
|
39
|
+
{
|
|
40
|
+
id: 'dataset',
|
|
41
|
+
title: 'Dataset',
|
|
42
|
+
dataType: 'object[]',
|
|
43
|
+
description: 'The new data of the dataset. An array of DatasetRow objects with { id, data } properties.',
|
|
44
|
+
},
|
|
45
|
+
];
|
|
46
|
+
}
|
|
47
|
+
static getUIData() {
|
|
48
|
+
return {
|
|
49
|
+
infoBoxBody: dedent `
|
|
50
|
+
Replaces the data in a dataset with the given data. If no data is given, the dataset will be cleared instead.
|
|
51
|
+
`,
|
|
52
|
+
infoBoxTitle: 'Replace Dataset Node',
|
|
53
|
+
contextMenuTitle: 'Replace Dataset',
|
|
54
|
+
group: ['Input/Output'],
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
getEditors() {
|
|
58
|
+
return [
|
|
59
|
+
{
|
|
60
|
+
type: 'datasetSelector',
|
|
61
|
+
label: 'Dataset',
|
|
62
|
+
dataKey: 'datasetId',
|
|
63
|
+
useInputToggleDataKey: 'useDatasetIdInput',
|
|
64
|
+
},
|
|
65
|
+
];
|
|
66
|
+
}
|
|
67
|
+
async process(inputs, context) {
|
|
68
|
+
const { datasetProvider } = context;
|
|
69
|
+
if (datasetProvider == null) {
|
|
70
|
+
throw new Error('datasetProvider is required');
|
|
71
|
+
}
|
|
72
|
+
const datasetId = getInputOrData(this.data, inputs, 'datasetId', 'string');
|
|
73
|
+
const dataInput = inputs['data'];
|
|
74
|
+
if (!dataInput) {
|
|
75
|
+
await datasetProvider.putDatasetData(datasetId, { id: datasetId, rows: [] });
|
|
76
|
+
return {
|
|
77
|
+
['dataset']: {
|
|
78
|
+
type: 'object[]',
|
|
79
|
+
value: [],
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
let dataArrays = unwrapDataValue(dataInput).value;
|
|
84
|
+
if (!Array.isArray(dataArrays)) {
|
|
85
|
+
throw new Error('Data input must be either an array of rows, or an array of columns for a single row.');
|
|
86
|
+
}
|
|
87
|
+
const isDatasetRow = (row) => {
|
|
88
|
+
return typeof row === 'object' && row != null && 'id' in row && 'data' in row;
|
|
89
|
+
};
|
|
90
|
+
const firstElem = dataArrays[0];
|
|
91
|
+
if (!Array.isArray(firstElem) && !isDatasetRow(firstElem)) {
|
|
92
|
+
dataArrays = [dataArrays];
|
|
93
|
+
}
|
|
94
|
+
const rows = dataArrays.map((row) => {
|
|
95
|
+
if (Array.isArray(row)) {
|
|
96
|
+
return {
|
|
97
|
+
id: newId(),
|
|
98
|
+
data: row.map((value) => coerceType(inferType(value), 'string')),
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
if ('id' in row && 'data' in row) {
|
|
102
|
+
return row;
|
|
103
|
+
}
|
|
104
|
+
throw new Error('Data input must be an array of strings or DatasetRows');
|
|
105
|
+
});
|
|
106
|
+
await datasetProvider.putDatasetData(datasetId, {
|
|
107
|
+
id: datasetId,
|
|
108
|
+
rows,
|
|
109
|
+
});
|
|
110
|
+
return {
|
|
111
|
+
['dataset']: {
|
|
112
|
+
type: 'object[]',
|
|
113
|
+
value: rows,
|
|
114
|
+
},
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
export const replaceDatasetNode = nodeDefinition(ReplaceDatasetNodeImpl, 'Replace Dataset');
|
|
@@ -0,0 +1,124 @@
|
|
|
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 { isArrayDataType, isScalarDataType, scalarDefaults, unwrapDataValue, } from '../DataValue.js';
|
|
6
|
+
import {} from '../GraphProcessor.js';
|
|
7
|
+
import { coerceType } from '../../utils/coerceType.js';
|
|
8
|
+
import {} from '../ProcessContext.js';
|
|
9
|
+
import { dedent } from 'ts-dedent';
|
|
10
|
+
import {} from '../EditorDefinition.js';
|
|
11
|
+
import {} from '../NodeBodySpec.js';
|
|
12
|
+
export class SetGlobalNodeImpl extends NodeImpl {
|
|
13
|
+
static create() {
|
|
14
|
+
const chartNode = {
|
|
15
|
+
type: 'setGlobal',
|
|
16
|
+
title: 'Set Global',
|
|
17
|
+
id: nanoid(),
|
|
18
|
+
visualData: {
|
|
19
|
+
x: 0,
|
|
20
|
+
y: 0,
|
|
21
|
+
width: 200,
|
|
22
|
+
},
|
|
23
|
+
data: {
|
|
24
|
+
id: 'variable-name',
|
|
25
|
+
dataType: 'string',
|
|
26
|
+
useIdInput: false,
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
return chartNode;
|
|
30
|
+
}
|
|
31
|
+
getInputDefinitions() {
|
|
32
|
+
const inputs = [
|
|
33
|
+
{
|
|
34
|
+
id: 'value',
|
|
35
|
+
title: 'Value',
|
|
36
|
+
dataType: this.chartNode.data.dataType,
|
|
37
|
+
},
|
|
38
|
+
];
|
|
39
|
+
if (this.data.useIdInput) {
|
|
40
|
+
inputs.push({
|
|
41
|
+
id: 'id',
|
|
42
|
+
title: 'Variable ID',
|
|
43
|
+
dataType: 'string',
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
return inputs;
|
|
47
|
+
}
|
|
48
|
+
getOutputDefinitions() {
|
|
49
|
+
return [
|
|
50
|
+
{
|
|
51
|
+
id: 'saved-value',
|
|
52
|
+
title: 'Value',
|
|
53
|
+
dataType: this.data.dataType,
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
id: 'previous-value',
|
|
57
|
+
title: 'Previous Value',
|
|
58
|
+
dataType: this.data.dataType,
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
id: 'variable_id_out',
|
|
62
|
+
title: 'Variable ID',
|
|
63
|
+
dataType: 'string',
|
|
64
|
+
},
|
|
65
|
+
];
|
|
66
|
+
}
|
|
67
|
+
getEditors() {
|
|
68
|
+
return [
|
|
69
|
+
{
|
|
70
|
+
type: 'string',
|
|
71
|
+
dataKey: 'id',
|
|
72
|
+
useInputToggleDataKey: 'useIdInput',
|
|
73
|
+
label: 'ID',
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
type: 'dataTypeSelector',
|
|
77
|
+
dataKey: 'dataType',
|
|
78
|
+
label: 'Data Type',
|
|
79
|
+
useInputToggleDataKey: 'useIdInput',
|
|
80
|
+
},
|
|
81
|
+
];
|
|
82
|
+
}
|
|
83
|
+
getBody() {
|
|
84
|
+
return dedent `
|
|
85
|
+
${this.data.id}
|
|
86
|
+
Type: ${this.data.dataType}
|
|
87
|
+
`;
|
|
88
|
+
}
|
|
89
|
+
static getUIData() {
|
|
90
|
+
return {
|
|
91
|
+
infoBoxBody: dedent `
|
|
92
|
+
Sets a global value that is shared across all graphs and subgraphs. The id of the global value and the value itself are configured in this node.
|
|
93
|
+
`,
|
|
94
|
+
infoBoxTitle: 'Set Global Node',
|
|
95
|
+
contextMenuTitle: 'Set Global',
|
|
96
|
+
group: ['Advanced'],
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
async process(inputs, context) {
|
|
100
|
+
const rawValue = inputs['value'];
|
|
101
|
+
if (!rawValue) {
|
|
102
|
+
return {};
|
|
103
|
+
}
|
|
104
|
+
const id = this.data.useIdInput ? coerceType(inputs['id'], 'string') : this.data.id;
|
|
105
|
+
if (!id) {
|
|
106
|
+
throw new Error('Missing variable ID');
|
|
107
|
+
}
|
|
108
|
+
let previousValue = context.getGlobal(this.data.id);
|
|
109
|
+
if (!previousValue && isArrayDataType(this.data.dataType)) {
|
|
110
|
+
previousValue = { type: this.data.dataType, value: [] };
|
|
111
|
+
}
|
|
112
|
+
else if (!previousValue && isScalarDataType(this.data.dataType)) {
|
|
113
|
+
previousValue = { type: this.data.dataType, value: scalarDefaults[this.data.dataType] };
|
|
114
|
+
}
|
|
115
|
+
const value = unwrapDataValue(rawValue);
|
|
116
|
+
context.setGlobal(id, value);
|
|
117
|
+
return {
|
|
118
|
+
['saved-value']: value,
|
|
119
|
+
['previous-value']: previousValue,
|
|
120
|
+
['variable_id_out']: { type: 'string', value: id },
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
export const setGlobalNode = nodeDefinition(SetGlobalNodeImpl, 'Set Global');
|
|
@@ -0,0 +1,64 @@
|
|
|
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 { shuffle } from 'lodash-es';
|
|
7
|
+
import { isArrayDataValue } from '../DataValue.js';
|
|
8
|
+
import { dedent } from 'ts-dedent';
|
|
9
|
+
export class ShuffleNodeImpl extends NodeImpl {
|
|
10
|
+
static create() {
|
|
11
|
+
const chartNode = {
|
|
12
|
+
type: 'shuffle',
|
|
13
|
+
title: 'Shuffle',
|
|
14
|
+
id: nanoid(),
|
|
15
|
+
visualData: {
|
|
16
|
+
x: 0,
|
|
17
|
+
y: 0,
|
|
18
|
+
width: 175,
|
|
19
|
+
},
|
|
20
|
+
data: {},
|
|
21
|
+
};
|
|
22
|
+
return chartNode;
|
|
23
|
+
}
|
|
24
|
+
getInputDefinitions() {
|
|
25
|
+
return [
|
|
26
|
+
{
|
|
27
|
+
dataType: 'any[]',
|
|
28
|
+
id: 'array',
|
|
29
|
+
title: 'Array',
|
|
30
|
+
},
|
|
31
|
+
];
|
|
32
|
+
}
|
|
33
|
+
getOutputDefinitions() {
|
|
34
|
+
return [
|
|
35
|
+
{
|
|
36
|
+
dataType: 'any[]',
|
|
37
|
+
id: 'shuffled',
|
|
38
|
+
title: 'Shuffled',
|
|
39
|
+
},
|
|
40
|
+
];
|
|
41
|
+
}
|
|
42
|
+
static getUIData() {
|
|
43
|
+
return {
|
|
44
|
+
infoBoxBody: dedent `
|
|
45
|
+
Shuffles the input array. Outputs the shuffled array.
|
|
46
|
+
`,
|
|
47
|
+
infoBoxTitle: 'Shuffle Node',
|
|
48
|
+
contextMenuTitle: 'Shuffle',
|
|
49
|
+
group: ['Lists'],
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
async process(inputs) {
|
|
53
|
+
const input = inputs['array'];
|
|
54
|
+
const items = input ? (isArrayDataValue(input) ? input.value : [input.value]) : [];
|
|
55
|
+
const shuffled = shuffle(items);
|
|
56
|
+
return {
|
|
57
|
+
['shuffled']: {
|
|
58
|
+
type: inputs['array']?.type ?? 'any[]',
|
|
59
|
+
value: shuffled,
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
export const shuffleNode = nodeDefinition(ShuffleNodeImpl, 'Shuffle');
|
|
@@ -0,0 +1,99 @@
|
|
|
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 { dedent } from 'ts-dedent';
|
|
7
|
+
import {} from '../EditorDefinition.js';
|
|
8
|
+
import {} from '../../index.js';
|
|
9
|
+
import { coerceType } from '../../utils/coerceType.js';
|
|
10
|
+
import { getInputOrData } from '../../utils/index.js';
|
|
11
|
+
export class SliceNodeImpl extends NodeImpl {
|
|
12
|
+
static create() {
|
|
13
|
+
const chartNode = {
|
|
14
|
+
type: 'slice',
|
|
15
|
+
title: 'Slice',
|
|
16
|
+
id: nanoid(),
|
|
17
|
+
visualData: {
|
|
18
|
+
x: 0,
|
|
19
|
+
y: 0,
|
|
20
|
+
width: 200,
|
|
21
|
+
},
|
|
22
|
+
data: {
|
|
23
|
+
start: 0,
|
|
24
|
+
count: undefined,
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
return chartNode;
|
|
28
|
+
}
|
|
29
|
+
getInputDefinitions() {
|
|
30
|
+
const inputs = [
|
|
31
|
+
{
|
|
32
|
+
dataType: 'any[]',
|
|
33
|
+
id: 'input',
|
|
34
|
+
title: 'Input',
|
|
35
|
+
},
|
|
36
|
+
];
|
|
37
|
+
if (this.data.useStartInput) {
|
|
38
|
+
inputs.push({
|
|
39
|
+
dataType: 'number',
|
|
40
|
+
id: 'start',
|
|
41
|
+
title: 'Start',
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
if (this.data.useCountInput) {
|
|
45
|
+
inputs.push({
|
|
46
|
+
dataType: 'number',
|
|
47
|
+
id: 'count',
|
|
48
|
+
title: 'Count',
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
return inputs;
|
|
52
|
+
}
|
|
53
|
+
getOutputDefinitions() {
|
|
54
|
+
return [
|
|
55
|
+
{
|
|
56
|
+
dataType: 'any[]',
|
|
57
|
+
id: 'output',
|
|
58
|
+
title: 'Output',
|
|
59
|
+
},
|
|
60
|
+
];
|
|
61
|
+
}
|
|
62
|
+
getEditors() {
|
|
63
|
+
return [
|
|
64
|
+
{ type: 'number', label: 'Start', dataKey: 'start', useInputToggleDataKey: 'useStartInput', allowEmpty: true },
|
|
65
|
+
{ type: 'number', label: 'Count', dataKey: 'count', useInputToggleDataKey: 'useCountInput', allowEmpty: true },
|
|
66
|
+
];
|
|
67
|
+
}
|
|
68
|
+
getBody() {
|
|
69
|
+
return dedent `
|
|
70
|
+
Start: ${this.data.useStartInput ? '(Using Input)' : this.data.start == null ? '0' : this.data.start}
|
|
71
|
+
Count: ${this.data.useCountInput ? '(Using Input)' : this.data.count == null ? 'All' : this.data.count}
|
|
72
|
+
`;
|
|
73
|
+
}
|
|
74
|
+
static getUIData() {
|
|
75
|
+
return {
|
|
76
|
+
infoBoxBody: dedent `
|
|
77
|
+
Slices an array from the start index for the count number of elements.
|
|
78
|
+
|
|
79
|
+
Useful for extracting a portion of an array.
|
|
80
|
+
`,
|
|
81
|
+
infoBoxTitle: 'Slice Node',
|
|
82
|
+
contextMenuTitle: 'Slice',
|
|
83
|
+
group: ['Lists'],
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
async process(inputs) {
|
|
87
|
+
const inputArray = coerceType(inputs['input'], 'any[]');
|
|
88
|
+
const start = getInputOrData(this.data, inputs, 'start', 'number') ?? 0;
|
|
89
|
+
const count = getInputOrData(this.data, inputs, 'count', 'number') ?? inputArray.length;
|
|
90
|
+
const outputArray = inputArray.slice(start, start + count);
|
|
91
|
+
return {
|
|
92
|
+
['output']: {
|
|
93
|
+
type: 'any[]',
|
|
94
|
+
value: outputArray,
|
|
95
|
+
},
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
export const sliceNode = nodeDefinition(SliceNodeImpl, 'Slice');
|