@alpic80/rivet-core 1.19.1-aidon.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (381) hide show
  1. package/LICENSE +7 -0
  2. package/README.md +176 -0
  3. package/dist/cjs/bundle.cjs +18915 -0
  4. package/dist/cjs/bundle.cjs.map +7 -0
  5. package/dist/esm/api/createProcessor.js +131 -0
  6. package/dist/esm/api/streaming.js +116 -0
  7. package/dist/esm/exports.js +32 -0
  8. package/dist/esm/index.js +2 -0
  9. package/dist/esm/integrations/AudioProvider.js +1 -0
  10. package/dist/esm/integrations/DatasetProvider.js +92 -0
  11. package/dist/esm/integrations/EmbeddingGenerator.js +1 -0
  12. package/dist/esm/integrations/GptTokenizerTokenizer.js +65 -0
  13. package/dist/esm/integrations/LLMProvider.js +1 -0
  14. package/dist/esm/integrations/Tokenizer.js +1 -0
  15. package/dist/esm/integrations/VectorDatabase.js +1 -0
  16. package/dist/esm/integrations/enableIntegrations.js +3 -0
  17. package/dist/esm/integrations/integrations.js +19 -0
  18. package/dist/esm/integrations/openai/OpenAIEmbeddingGenerator.js +23 -0
  19. package/dist/esm/model/DataValue.js +176 -0
  20. package/dist/esm/model/Dataset.js +1 -0
  21. package/dist/esm/model/EditorDefinition.js +1 -0
  22. package/dist/esm/model/GraphProcessor.js +1198 -0
  23. package/dist/esm/model/NodeBase.js +1 -0
  24. package/dist/esm/model/NodeBodySpec.js +1 -0
  25. package/dist/esm/model/NodeDefinition.js +12 -0
  26. package/dist/esm/model/NodeGraph.js +14 -0
  27. package/dist/esm/model/NodeImpl.js +49 -0
  28. package/dist/esm/model/NodeRegistration.js +144 -0
  29. package/dist/esm/model/Nodes.js +227 -0
  30. package/dist/esm/model/PluginLoadSpec.js +1 -0
  31. package/dist/esm/model/ProcessContext.js +1 -0
  32. package/dist/esm/model/Project.js +2 -0
  33. package/dist/esm/model/RivetPlugin.js +1 -0
  34. package/dist/esm/model/RivetUIContext.js +1 -0
  35. package/dist/esm/model/Settings.js +1 -0
  36. package/dist/esm/model/nodes/AbortGraphNode.js +100 -0
  37. package/dist/esm/model/nodes/AppendToDatasetNode.js +115 -0
  38. package/dist/esm/model/nodes/ArrayNode.js +144 -0
  39. package/dist/esm/model/nodes/AssembleMessageNode.js +199 -0
  40. package/dist/esm/model/nodes/AssemblePromptNode.js +129 -0
  41. package/dist/esm/model/nodes/AudioNode.js +101 -0
  42. package/dist/esm/model/nodes/BooleanNode.js +74 -0
  43. package/dist/esm/model/nodes/CallGraphNode.js +136 -0
  44. package/dist/esm/model/nodes/ChatNode.js +964 -0
  45. package/dist/esm/model/nodes/ChunkNode.js +166 -0
  46. package/dist/esm/model/nodes/CoalesceNode.js +104 -0
  47. package/dist/esm/model/nodes/CodeNode.js +136 -0
  48. package/dist/esm/model/nodes/CommentNode.js +69 -0
  49. package/dist/esm/model/nodes/CompareNode.js +138 -0
  50. package/dist/esm/model/nodes/ContextNode.js +99 -0
  51. package/dist/esm/model/nodes/CreateDatasetNode.js +71 -0
  52. package/dist/esm/model/nodes/DatasetNearestNeigborsNode.js +97 -0
  53. package/dist/esm/model/nodes/DelayNode.js +105 -0
  54. package/dist/esm/model/nodes/DelegateFunctionCallNode.js +136 -0
  55. package/dist/esm/model/nodes/DestructureNode.js +86 -0
  56. package/dist/esm/model/nodes/EvaluateNode.js +141 -0
  57. package/dist/esm/model/nodes/ExternalCallNode.js +162 -0
  58. package/dist/esm/model/nodes/ExtractJsonNode.js +122 -0
  59. package/dist/esm/model/nodes/ExtractMarkdownCodeBlocksNode.js +100 -0
  60. package/dist/esm/model/nodes/ExtractObjectPathNode.js +128 -0
  61. package/dist/esm/model/nodes/ExtractRegexNode.js +201 -0
  62. package/dist/esm/model/nodes/ExtractYamlNode.js +214 -0
  63. package/dist/esm/model/nodes/FilterNode.js +73 -0
  64. package/dist/esm/model/nodes/GetAllDatasetsNode.js +53 -0
  65. package/dist/esm/model/nodes/GetDatasetRowNode.js +99 -0
  66. package/dist/esm/model/nodes/GetEmbeddingNode.js +130 -0
  67. package/dist/esm/model/nodes/GetGlobalNode.js +139 -0
  68. package/dist/esm/model/nodes/GptFunctionNode.js +169 -0
  69. package/dist/esm/model/nodes/GraphInputNode.js +130 -0
  70. package/dist/esm/model/nodes/GraphOutputNode.js +104 -0
  71. package/dist/esm/model/nodes/GraphReferenceNode.js +128 -0
  72. package/dist/esm/model/nodes/HashNode.js +97 -0
  73. package/dist/esm/model/nodes/HttpCallNode.js +257 -0
  74. package/dist/esm/model/nodes/IfElseNode.js +138 -0
  75. package/dist/esm/model/nodes/IfNode.js +124 -0
  76. package/dist/esm/model/nodes/ImageNode.js +107 -0
  77. package/dist/esm/model/nodes/JoinNode.js +135 -0
  78. package/dist/esm/model/nodes/ListGraphsNode.js +61 -0
  79. package/dist/esm/model/nodes/LoadDatasetNode.js +83 -0
  80. package/dist/esm/model/nodes/LoopControllerNode.js +206 -0
  81. package/dist/esm/model/nodes/MatchNode.js +137 -0
  82. package/dist/esm/model/nodes/NumberNode.js +86 -0
  83. package/dist/esm/model/nodes/ObjectNode.js +121 -0
  84. package/dist/esm/model/nodes/PassthroughNode.js +78 -0
  85. package/dist/esm/model/nodes/PlayAudioNode.js +61 -0
  86. package/dist/esm/model/nodes/PopNode.js +89 -0
  87. package/dist/esm/model/nodes/PromptNode.js +227 -0
  88. package/dist/esm/model/nodes/RaceInputsNode.js +86 -0
  89. package/dist/esm/model/nodes/RaiseEventNode.js +84 -0
  90. package/dist/esm/model/nodes/RandomNumberNode.js +106 -0
  91. package/dist/esm/model/nodes/ReadDirectoryNode.js +165 -0
  92. package/dist/esm/model/nodes/ReadFileNode.js +114 -0
  93. package/dist/esm/model/nodes/ReplaceDatasetNode.js +118 -0
  94. package/dist/esm/model/nodes/SetGlobalNode.js +124 -0
  95. package/dist/esm/model/nodes/ShuffleNode.js +64 -0
  96. package/dist/esm/model/nodes/SliceNode.js +100 -0
  97. package/dist/esm/model/nodes/SplitNode.js +101 -0
  98. package/dist/esm/model/nodes/SubGraphNode.js +181 -0
  99. package/dist/esm/model/nodes/TextNode.js +97 -0
  100. package/dist/esm/model/nodes/ToJsonNode.js +78 -0
  101. package/dist/esm/model/nodes/ToYamlNode.js +68 -0
  102. package/dist/esm/model/nodes/TrimChatMessagesNode.js +120 -0
  103. package/dist/esm/model/nodes/URLReferenceNode.js +79 -0
  104. package/dist/esm/model/nodes/UserInputNode.js +111 -0
  105. package/dist/esm/model/nodes/VectorNearestNeighborsNode.js +127 -0
  106. package/dist/esm/model/nodes/VectorStoreNode.js +124 -0
  107. package/dist/esm/model/nodes/WaitForEventNode.js +88 -0
  108. package/dist/esm/native/BaseDir.js +32 -0
  109. package/dist/esm/native/BrowserNativeApi.js +19 -0
  110. package/dist/esm/native/NativeApi.js +1 -0
  111. package/dist/esm/plugins/aidon/index.js +2 -0
  112. package/dist/esm/plugins/aidon/nodes/ChatAidonNode.js +215 -0
  113. package/dist/esm/plugins/aidon/plugin.js +9 -0
  114. package/dist/esm/plugins/anthropic/anthropic.js +187 -0
  115. package/dist/esm/plugins/anthropic/fetchEventSource.js +106 -0
  116. package/dist/esm/plugins/anthropic/index.js +2 -0
  117. package/dist/esm/plugins/anthropic/nodes/ChatAnthropicNode.js +652 -0
  118. package/dist/esm/plugins/anthropic/plugin.js +18 -0
  119. package/dist/esm/plugins/assemblyAi/LemurActionItemsNode.js +75 -0
  120. package/dist/esm/plugins/assemblyAi/LemurQaNode.js +155 -0
  121. package/dist/esm/plugins/assemblyAi/LemurSummaryNode.js +79 -0
  122. package/dist/esm/plugins/assemblyAi/LemurTaskNode.js +82 -0
  123. package/dist/esm/plugins/assemblyAi/TranscribeAudioNode.js +125 -0
  124. package/dist/esm/plugins/assemblyAi/index.js +2 -0
  125. package/dist/esm/plugins/assemblyAi/lemurHelpers.js +114 -0
  126. package/dist/esm/plugins/assemblyAi/plugin.js +32 -0
  127. package/dist/esm/plugins/autoevals/AutoEvalsNode.js +223 -0
  128. package/dist/esm/plugins/autoevals/index.js +2 -0
  129. package/dist/esm/plugins/autoevals/plugin.js +8 -0
  130. package/dist/esm/plugins/gentrace/index.js +2 -0
  131. package/dist/esm/plugins/gentrace/plugin.js +192 -0
  132. package/dist/esm/plugins/google/google.js +60 -0
  133. package/dist/esm/plugins/google/index.js +2 -0
  134. package/dist/esm/plugins/google/nodes/ChatGoogleNode.js +364 -0
  135. package/dist/esm/plugins/google/plugin.js +32 -0
  136. package/dist/esm/plugins/huggingface/index.js +2 -0
  137. package/dist/esm/plugins/huggingface/nodes/ChatHuggingFace.js +243 -0
  138. package/dist/esm/plugins/huggingface/nodes/TextToImageHuggingFace.js +189 -0
  139. package/dist/esm/plugins/huggingface/plugin.js +26 -0
  140. package/dist/esm/plugins/openai/handleOpenaiError.js +17 -0
  141. package/dist/esm/plugins/openai/index.js +2 -0
  142. package/dist/esm/plugins/openai/nodes/AttachAssistantFileNode.js +123 -0
  143. package/dist/esm/plugins/openai/nodes/CreateAssistantNode.js +289 -0
  144. package/dist/esm/plugins/openai/nodes/CreateThreadMessageNode.js +176 -0
  145. package/dist/esm/plugins/openai/nodes/CreateThreadNode.js +157 -0
  146. package/dist/esm/plugins/openai/nodes/DeleteAssistantNode.js +104 -0
  147. package/dist/esm/plugins/openai/nodes/DeleteThreadNode.js +97 -0
  148. package/dist/esm/plugins/openai/nodes/GetAssistantNode.js +118 -0
  149. package/dist/esm/plugins/openai/nodes/GetOpenAIFileNode.js +100 -0
  150. package/dist/esm/plugins/openai/nodes/GetThreadNode.js +108 -0
  151. package/dist/esm/plugins/openai/nodes/ListAssistantsNode.js +202 -0
  152. package/dist/esm/plugins/openai/nodes/ListOpenAIFilesNode.js +94 -0
  153. package/dist/esm/plugins/openai/nodes/ListThreadMessagesNode.js +224 -0
  154. package/dist/esm/plugins/openai/nodes/RunThreadNode.js +630 -0
  155. package/dist/esm/plugins/openai/nodes/ThreadMessageNode.js +145 -0
  156. package/dist/esm/plugins/openai/nodes/UploadFileNode.js +121 -0
  157. package/dist/esm/plugins/openai/plugin.js +44 -0
  158. package/dist/esm/plugins/pinecone/PineconeVectorDatabase.js +88 -0
  159. package/dist/esm/plugins/pinecone/index.js +2 -0
  160. package/dist/esm/plugins/pinecone/plugin.js +19 -0
  161. package/dist/esm/plugins.js +21 -0
  162. package/dist/esm/recording/ExecutionRecorder.js +177 -0
  163. package/dist/esm/recording/RecordedEvents.js +1 -0
  164. package/dist/esm/utils/assertNever.js +3 -0
  165. package/dist/esm/utils/base64.js +25 -0
  166. package/dist/esm/utils/chatMessageToOpenAIChatCompletionMessage.js +60 -0
  167. package/dist/esm/utils/coerceType.js +322 -0
  168. package/dist/esm/utils/compatibility.js +27 -0
  169. package/dist/esm/utils/copyToClipboard.js +10 -0
  170. package/dist/esm/utils/defaults.js +2 -0
  171. package/dist/esm/utils/errors.js +7 -0
  172. package/dist/esm/utils/expectType.js +34 -0
  173. package/dist/esm/utils/fetchEventSource.js +120 -0
  174. package/dist/esm/utils/genericUtilFunctions.js +25 -0
  175. package/dist/esm/utils/getPluginConfig.js +23 -0
  176. package/dist/esm/utils/handleEscapeCharacters.js +11 -0
  177. package/dist/esm/utils/index.js +14 -0
  178. package/dist/esm/utils/inputs.js +16 -0
  179. package/dist/esm/utils/interpolation.js +6 -0
  180. package/dist/esm/utils/misc.js +1 -0
  181. package/dist/esm/utils/newId.js +4 -0
  182. package/dist/esm/utils/openai.js +219 -0
  183. package/dist/esm/utils/outputs.js +14 -0
  184. package/dist/esm/utils/serialization/serialization.js +86 -0
  185. package/dist/esm/utils/serialization/serializationUtils.js +13 -0
  186. package/dist/esm/utils/serialization/serialization_v1.js +19 -0
  187. package/dist/esm/utils/serialization/serialization_v2.js +24 -0
  188. package/dist/esm/utils/serialization/serialization_v3.js +145 -0
  189. package/dist/esm/utils/serialization/serialization_v4.js +200 -0
  190. package/dist/esm/utils/symbols.js +2 -0
  191. package/dist/esm/utils/time.js +14 -0
  192. package/dist/esm/utils/typeSafety.js +42 -0
  193. package/dist/types/api/createProcessor.d.ts +37 -0
  194. package/dist/types/api/streaming.d.ts +56 -0
  195. package/dist/types/exports.d.ts +33 -0
  196. package/dist/types/index.d.ts +4 -0
  197. package/dist/types/integrations/AudioProvider.d.ts +4 -0
  198. package/dist/types/integrations/DatasetProvider.d.ts +33 -0
  199. package/dist/types/integrations/EmbeddingGenerator.d.ts +3 -0
  200. package/dist/types/integrations/GptTokenizerTokenizer.d.ts +20 -0
  201. package/dist/types/integrations/LLMProvider.d.ts +7 -0
  202. package/dist/types/integrations/Tokenizer.d.ts +11 -0
  203. package/dist/types/integrations/VectorDatabase.d.ts +7 -0
  204. package/dist/types/integrations/enableIntegrations.d.ts +1 -0
  205. package/dist/types/integrations/integrations.d.ts +12 -0
  206. package/dist/types/integrations/openai/OpenAIEmbeddingGenerator.d.ts +10 -0
  207. package/dist/types/model/DataValue.d.ts +138 -0
  208. package/dist/types/model/Dataset.d.ts +19 -0
  209. package/dist/types/model/EditorDefinition.d.ts +142 -0
  210. package/dist/types/model/GraphProcessor.d.ts +192 -0
  211. package/dist/types/model/NodeBase.d.ts +110 -0
  212. package/dist/types/model/NodeBodySpec.d.ts +19 -0
  213. package/dist/types/model/NodeDefinition.d.ts +13 -0
  214. package/dist/types/model/NodeGraph.d.ts +15 -0
  215. package/dist/types/model/NodeImpl.d.ts +55 -0
  216. package/dist/types/model/NodeRegistration.d.ts +24 -0
  217. package/dist/types/model/Nodes.d.ts +84 -0
  218. package/dist/types/model/PluginLoadSpec.d.ts +17 -0
  219. package/dist/types/model/ProcessContext.d.ts +69 -0
  220. package/dist/types/model/Project.d.ts +17 -0
  221. package/dist/types/model/RivetPlugin.d.ts +45 -0
  222. package/dist/types/model/RivetUIContext.d.ts +18 -0
  223. package/dist/types/model/Settings.d.ts +15 -0
  224. package/dist/types/model/nodes/AbortGraphNode.d.ts +22 -0
  225. package/dist/types/model/nodes/AppendToDatasetNode.d.ts +21 -0
  226. package/dist/types/model/nodes/ArrayNode.d.ts +20 -0
  227. package/dist/types/model/nodes/AssembleMessageNode.d.ts +23 -0
  228. package/dist/types/model/nodes/AssemblePromptNode.d.ts +20 -0
  229. package/dist/types/model/nodes/AudioNode.d.ts +20 -0
  230. package/dist/types/model/nodes/BooleanNode.d.ts +19 -0
  231. package/dist/types/model/nodes/CallGraphNode.d.ts +16 -0
  232. package/dist/types/model/nodes/ChatNode.d.ts +77 -0
  233. package/dist/types/model/nodes/ChunkNode.d.ts +22 -0
  234. package/dist/types/model/nodes/CoalesceNode.d.ts +14 -0
  235. package/dist/types/model/nodes/CodeNode.d.ts +21 -0
  236. package/dist/types/model/nodes/CommentNode.d.ts +20 -0
  237. package/dist/types/model/nodes/CompareNode.d.ts +19 -0
  238. package/dist/types/model/nodes/ContextNode.d.ts +24 -0
  239. package/dist/types/model/nodes/CreateDatasetNode.d.ts +13 -0
  240. package/dist/types/model/nodes/DatasetNearestNeigborsNode.d.ts +19 -0
  241. package/dist/types/model/nodes/DelayNode.d.ts +20 -0
  242. package/dist/types/model/nodes/DelegateFunctionCallNode.d.ts +25 -0
  243. package/dist/types/model/nodes/DestructureNode.d.ts +18 -0
  244. package/dist/types/model/nodes/EvaluateNode.d.ts +19 -0
  245. package/dist/types/model/nodes/ExternalCallNode.d.ts +22 -0
  246. package/dist/types/model/nodes/ExtractJsonNode.d.ts +13 -0
  247. package/dist/types/model/nodes/ExtractMarkdownCodeBlocksNode.d.ts +12 -0
  248. package/dist/types/model/nodes/ExtractObjectPathNode.d.ts +19 -0
  249. package/dist/types/model/nodes/ExtractRegexNode.d.ts +22 -0
  250. package/dist/types/model/nodes/ExtractYamlNode.d.ts +21 -0
  251. package/dist/types/model/nodes/FilterNode.d.ts +13 -0
  252. package/dist/types/model/nodes/GetAllDatasetsNode.d.ts +14 -0
  253. package/dist/types/model/nodes/GetDatasetRowNode.d.ts +19 -0
  254. package/dist/types/model/nodes/GetEmbeddingNode.d.ts +24 -0
  255. package/dist/types/model/nodes/GetGlobalNode.d.ts +29 -0
  256. package/dist/types/model/nodes/GptFunctionNode.d.ts +25 -0
  257. package/dist/types/model/nodes/GraphInputNode.d.ts +24 -0
  258. package/dist/types/model/nodes/GraphOutputNode.d.ts +22 -0
  259. package/dist/types/model/nodes/GraphReferenceNode.d.ts +22 -0
  260. package/dist/types/model/nodes/HashNode.d.ts +17 -0
  261. package/dist/types/model/nodes/HttpCallNode.d.ts +27 -0
  262. package/dist/types/model/nodes/IfElseNode.d.ts +18 -0
  263. package/dist/types/model/nodes/IfNode.d.ts +17 -0
  264. package/dist/types/model/nodes/ImageNode.d.ts +20 -0
  265. package/dist/types/model/nodes/JoinNode.d.ts +21 -0
  266. package/dist/types/model/nodes/ListGraphsNode.d.ts +14 -0
  267. package/dist/types/model/nodes/LoadDatasetNode.d.ts +17 -0
  268. package/dist/types/model/nodes/LoopControllerNode.d.ts +20 -0
  269. package/dist/types/model/nodes/MatchNode.d.ts +19 -0
  270. package/dist/types/model/nodes/NumberNode.d.ts +21 -0
  271. package/dist/types/model/nodes/ObjectNode.d.ts +18 -0
  272. package/dist/types/model/nodes/PassthroughNode.d.ts +14 -0
  273. package/dist/types/model/nodes/PlayAudioNode.d.ts +15 -0
  274. package/dist/types/model/nodes/PopNode.d.ts +19 -0
  275. package/dist/types/model/nodes/PromptNode.d.ts +23 -0
  276. package/dist/types/model/nodes/RaceInputsNode.d.ts +17 -0
  277. package/dist/types/model/nodes/RaiseEventNode.d.ts +22 -0
  278. package/dist/types/model/nodes/RandomNumberNode.d.ts +23 -0
  279. package/dist/types/model/nodes/ReadDirectoryNode.d.ts +30 -0
  280. package/dist/types/model/nodes/ReadFileNode.d.ts +23 -0
  281. package/dist/types/model/nodes/ReplaceDatasetNode.d.ts +21 -0
  282. package/dist/types/model/nodes/SetGlobalNode.d.ts +23 -0
  283. package/dist/types/model/nodes/ShuffleNode.d.ts +12 -0
  284. package/dist/types/model/nodes/SliceNode.d.ts +22 -0
  285. package/dist/types/model/nodes/SplitNode.d.ts +19 -0
  286. package/dist/types/model/nodes/SubGraphNode.d.ts +29 -0
  287. package/dist/types/model/nodes/TextNode.d.ts +18 -0
  288. package/dist/types/model/nodes/ToJsonNode.d.ts +18 -0
  289. package/dist/types/model/nodes/ToYamlNode.d.ts +13 -0
  290. package/dist/types/model/nodes/TrimChatMessagesNode.d.ts +20 -0
  291. package/dist/types/model/nodes/URLReferenceNode.d.ts +19 -0
  292. package/dist/types/model/nodes/UserInputNode.d.ts +21 -0
  293. package/dist/types/model/nodes/VectorNearestNeighborsNode.d.ts +24 -0
  294. package/dist/types/model/nodes/VectorStoreNode.d.ts +22 -0
  295. package/dist/types/model/nodes/WaitForEventNode.d.ts +21 -0
  296. package/dist/types/native/BaseDir.d.ts +29 -0
  297. package/dist/types/native/BrowserNativeApi.d.ts +11 -0
  298. package/dist/types/native/NativeApi.d.ts +17 -0
  299. package/dist/types/plugins/aidon/index.d.ts +2 -0
  300. package/dist/types/plugins/aidon/nodes/ChatAidonNode.d.ts +3 -0
  301. package/dist/types/plugins/aidon/plugin.d.ts +2 -0
  302. package/dist/types/plugins/anthropic/anthropic.d.ts +216 -0
  303. package/dist/types/plugins/anthropic/fetchEventSource.d.ts +11 -0
  304. package/dist/types/plugins/anthropic/index.d.ts +2 -0
  305. package/dist/types/plugins/anthropic/nodes/ChatAnthropicNode.d.ts +30 -0
  306. package/dist/types/plugins/anthropic/plugin.d.ts +2 -0
  307. package/dist/types/plugins/assemblyAi/LemurActionItemsNode.d.ts +6 -0
  308. package/dist/types/plugins/assemblyAi/LemurQaNode.d.ts +22 -0
  309. package/dist/types/plugins/assemblyAi/LemurSummaryNode.d.ts +8 -0
  310. package/dist/types/plugins/assemblyAi/LemurTaskNode.d.ts +8 -0
  311. package/dist/types/plugins/assemblyAi/TranscribeAudioNode.d.ts +7 -0
  312. package/dist/types/plugins/assemblyAi/index.d.ts +2 -0
  313. package/dist/types/plugins/assemblyAi/lemurHelpers.d.ts +67 -0
  314. package/dist/types/plugins/assemblyAi/plugin.d.ts +2 -0
  315. package/dist/types/plugins/autoevals/AutoEvalsNode.d.ts +8 -0
  316. package/dist/types/plugins/autoevals/index.d.ts +2 -0
  317. package/dist/types/plugins/autoevals/plugin.d.ts +2 -0
  318. package/dist/types/plugins/gentrace/index.d.ts +2 -0
  319. package/dist/types/plugins/gentrace/plugin.d.ts +5 -0
  320. package/dist/types/plugins/google/google.d.ts +60 -0
  321. package/dist/types/plugins/google/index.d.ts +2 -0
  322. package/dist/types/plugins/google/nodes/ChatGoogleNode.d.ts +27 -0
  323. package/dist/types/plugins/google/plugin.d.ts +2 -0
  324. package/dist/types/plugins/huggingface/index.d.ts +2 -0
  325. package/dist/types/plugins/huggingface/nodes/ChatHuggingFace.d.ts +24 -0
  326. package/dist/types/plugins/huggingface/nodes/TextToImageHuggingFace.d.ts +20 -0
  327. package/dist/types/plugins/huggingface/plugin.d.ts +2 -0
  328. package/dist/types/plugins/openai/handleOpenaiError.d.ts +1 -0
  329. package/dist/types/plugins/openai/index.d.ts +2 -0
  330. package/dist/types/plugins/openai/nodes/AttachAssistantFileNode.d.ts +10 -0
  331. package/dist/types/plugins/openai/nodes/CreateAssistantNode.d.ts +26 -0
  332. package/dist/types/plugins/openai/nodes/CreateThreadMessageNode.d.ts +15 -0
  333. package/dist/types/plugins/openai/nodes/CreateThreadNode.d.ts +13 -0
  334. package/dist/types/plugins/openai/nodes/DeleteAssistantNode.d.ts +8 -0
  335. package/dist/types/plugins/openai/nodes/DeleteThreadNode.d.ts +8 -0
  336. package/dist/types/plugins/openai/nodes/GetAssistantNode.d.ts +8 -0
  337. package/dist/types/plugins/openai/nodes/GetOpenAIFileNode.d.ts +8 -0
  338. package/dist/types/plugins/openai/nodes/GetThreadNode.d.ts +8 -0
  339. package/dist/types/plugins/openai/nodes/ListAssistantsNode.d.ts +14 -0
  340. package/dist/types/plugins/openai/nodes/ListOpenAIFilesNode.d.ts +8 -0
  341. package/dist/types/plugins/openai/nodes/ListThreadMessagesNode.d.ts +16 -0
  342. package/dist/types/plugins/openai/nodes/RunThreadNode.d.ts +28 -0
  343. package/dist/types/plugins/openai/nodes/ThreadMessageNode.d.ts +14 -0
  344. package/dist/types/plugins/openai/nodes/UploadFileNode.d.ts +7 -0
  345. package/dist/types/plugins/openai/plugin.d.ts +2 -0
  346. package/dist/types/plugins/pinecone/PineconeVectorDatabase.d.ts +9 -0
  347. package/dist/types/plugins/pinecone/index.d.ts +2 -0
  348. package/dist/types/plugins/pinecone/plugin.d.ts +2 -0
  349. package/dist/types/plugins.d.ts +20 -0
  350. package/dist/types/recording/ExecutionRecorder.d.ts +25 -0
  351. package/dist/types/recording/RecordedEvents.d.ts +100 -0
  352. package/dist/types/utils/assertNever.d.ts +1 -0
  353. package/dist/types/utils/base64.d.ts +2 -0
  354. package/dist/types/utils/chatMessageToOpenAIChatCompletionMessage.d.ts +3 -0
  355. package/dist/types/utils/coerceType.d.ts +6 -0
  356. package/dist/types/utils/compatibility.d.ts +3 -0
  357. package/dist/types/utils/copyToClipboard.d.ts +1 -0
  358. package/dist/types/utils/defaults.d.ts +2 -0
  359. package/dist/types/utils/errors.d.ts +2 -0
  360. package/dist/types/utils/expectType.d.ts +3 -0
  361. package/dist/types/utils/fetchEventSource.d.ts +12 -0
  362. package/dist/types/utils/genericUtilFunctions.d.ts +21 -0
  363. package/dist/types/utils/getPluginConfig.d.ts +2 -0
  364. package/dist/types/utils/handleEscapeCharacters.d.ts +2 -0
  365. package/dist/types/utils/index.d.ts +14 -0
  366. package/dist/types/utils/inputs.d.ts +3 -0
  367. package/dist/types/utils/interpolation.d.ts +1 -0
  368. package/dist/types/utils/misc.d.ts +1 -0
  369. package/dist/types/utils/newId.d.ts +1 -0
  370. package/dist/types/utils/openai.d.ts +739 -0
  371. package/dist/types/utils/outputs.d.ts +3 -0
  372. package/dist/types/utils/serialization/serialization.d.ts +12 -0
  373. package/dist/types/utils/serialization/serializationUtils.d.ts +6 -0
  374. package/dist/types/utils/serialization/serialization_v1.d.ts +3 -0
  375. package/dist/types/utils/serialization/serialization_v2.d.ts +3 -0
  376. package/dist/types/utils/serialization/serialization_v3.d.ts +19 -0
  377. package/dist/types/utils/serialization/serialization_v4.d.ts +9 -0
  378. package/dist/types/utils/symbols.d.ts +3 -0
  379. package/dist/types/utils/time.d.ts +22 -0
  380. package/dist/types/utils/typeSafety.d.ts +37 -0
  381. package/package.json +97 -0
@@ -0,0 +1,201 @@
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 '../DataValue.js';
6
+ import { expectType, expectTypeOptional } from '../../utils/expectType.js';
7
+ import { dedent } from 'ts-dedent';
8
+ import {} from '../EditorDefinition.js';
9
+ import {} from '../NodeBodySpec.js';
10
+ export class ExtractRegexNodeImpl extends NodeImpl {
11
+ static create() {
12
+ const chartNode = {
13
+ type: 'extractRegex',
14
+ title: 'Extract Regex',
15
+ id: nanoid(),
16
+ visualData: {
17
+ x: 0,
18
+ y: 0,
19
+ width: 250,
20
+ },
21
+ data: {
22
+ regex: '([a-zA-Z]+)',
23
+ useRegexInput: false,
24
+ errorOnFailed: false,
25
+ },
26
+ };
27
+ return chartNode;
28
+ }
29
+ getInputDefinitions() {
30
+ const inputs = [
31
+ {
32
+ id: 'input',
33
+ title: 'Input',
34
+ dataType: 'string',
35
+ required: true,
36
+ coerced: false,
37
+ },
38
+ ];
39
+ if (this.chartNode.data.useRegexInput) {
40
+ inputs.push({
41
+ id: 'regex',
42
+ title: 'Regex',
43
+ dataType: 'string',
44
+ required: false,
45
+ coerced: false,
46
+ });
47
+ }
48
+ return inputs;
49
+ }
50
+ getOutputDefinitions() {
51
+ const regex = this.chartNode.data.regex;
52
+ try {
53
+ const regExp = new RegExp(regex, 'g');
54
+ const captureGroupCount = countCaptureGroups(regExp);
55
+ const outputs = [];
56
+ for (let i = 0; i < captureGroupCount; i++) {
57
+ outputs.push({
58
+ id: `output${i + 1}`,
59
+ title: `Output ${i + 1}`,
60
+ dataType: 'string',
61
+ });
62
+ }
63
+ outputs.push({
64
+ id: 'matches',
65
+ title: 'Matches',
66
+ dataType: 'string[]',
67
+ });
68
+ outputs.push({
69
+ id: 'succeeded',
70
+ title: 'Succeeded',
71
+ dataType: 'boolean',
72
+ }, {
73
+ id: 'failed',
74
+ title: 'Failed',
75
+ dataType: 'boolean',
76
+ });
77
+ return outputs;
78
+ }
79
+ catch (err) {
80
+ return [];
81
+ }
82
+ }
83
+ getEditors() {
84
+ return [
85
+ {
86
+ type: 'custom',
87
+ customEditorId: 'ExtractRegexNodeAiAssist',
88
+ label: 'AI Assist',
89
+ },
90
+ {
91
+ type: 'toggle',
92
+ label: 'Error on failed',
93
+ dataKey: 'errorOnFailed',
94
+ },
95
+ {
96
+ type: 'toggle',
97
+ label: 'Multiline mode',
98
+ dataKey: 'multilineMode',
99
+ },
100
+ {
101
+ type: 'code',
102
+ label: 'Regex',
103
+ dataKey: 'regex',
104
+ useInputToggleDataKey: 'useRegexInput',
105
+ language: 'regex',
106
+ },
107
+ ];
108
+ }
109
+ getBody() {
110
+ return this.data.useRegexInput ? '(Using regex input)' : this.data.regex;
111
+ }
112
+ static getUIData() {
113
+ return {
114
+ infoBoxBody: dedent `
115
+ Extracts data from the input text using the configured regular expression. The regular expression can contain capture groups to extract specific parts of the text.
116
+
117
+ Each capture group corresponds to an output port of the node.
118
+ `,
119
+ infoBoxTitle: 'Extract With Regex Node',
120
+ contextMenuTitle: 'Extract With Regex',
121
+ group: ['Text'],
122
+ };
123
+ }
124
+ async process(inputs) {
125
+ const inputString = expectType(inputs['input'], 'string');
126
+ const regex = expectTypeOptional(inputs['regex'], 'string') ?? this.chartNode.data.regex;
127
+ const regExp = new RegExp(regex, this.data.multilineMode ? 'gm' : 'g');
128
+ let matches = [];
129
+ let match;
130
+ let firstMatch;
131
+ while ((match = regExp.exec(inputString)) !== null) {
132
+ if (!firstMatch) {
133
+ firstMatch = match;
134
+ }
135
+ matches.push(match[1]);
136
+ }
137
+ matches = matches.filter((m) => m);
138
+ if (matches.length === 0 && this.chartNode.data.errorOnFailed) {
139
+ throw new Error(`No match found for regex ${regex}`);
140
+ }
141
+ const outputArray = {
142
+ type: 'string[]',
143
+ value: matches,
144
+ };
145
+ if (!firstMatch) {
146
+ if (this.chartNode.data.errorOnFailed) {
147
+ throw new Error(`No match found for regex ${regex}`);
148
+ }
149
+ return {
150
+ ['succeeded']: {
151
+ type: 'boolean',
152
+ value: false,
153
+ },
154
+ ['failed']: {
155
+ type: 'boolean',
156
+ value: true,
157
+ },
158
+ };
159
+ }
160
+ const output = {
161
+ ['succeeded']: {
162
+ type: 'boolean',
163
+ value: true,
164
+ },
165
+ ['failed']: {
166
+ type: 'boolean',
167
+ value: false,
168
+ },
169
+ };
170
+ output['matches'] = outputArray;
171
+ for (let i = 1; i < firstMatch.length; i++) {
172
+ output[`output${i}`] = {
173
+ type: 'string',
174
+ value: firstMatch[i],
175
+ };
176
+ }
177
+ return output;
178
+ }
179
+ }
180
+ function countCaptureGroups(regex) {
181
+ const regexSource = regex.source;
182
+ let count = 0;
183
+ let inCharacterClass = false;
184
+ for (let i = 0; i < regexSource.length; i++) {
185
+ const currentChar = regexSource[i];
186
+ const prevChar = i > 0 ? regexSource[i - 1] : null;
187
+ if (currentChar === '[' && prevChar !== '\\') {
188
+ inCharacterClass = true;
189
+ }
190
+ else if (currentChar === ']' && prevChar !== '\\') {
191
+ inCharacterClass = false;
192
+ }
193
+ else if (currentChar === '(' && prevChar !== '\\' && !inCharacterClass) {
194
+ if (regexSource[i + 1] !== '?' || regexSource[i + 2] === ':') {
195
+ count++;
196
+ }
197
+ }
198
+ }
199
+ return count;
200
+ }
201
+ export const extractRegexNode = nodeDefinition(ExtractRegexNodeImpl, 'Extract Regex');
@@ -0,0 +1,214 @@
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 '../DataValue.js';
6
+ import yaml from 'yaml';
7
+ import { expectType } from '../../utils/expectType.js';
8
+ import { JSONPath } from 'jsonpath-plus';
9
+ import { dedent } from 'ts-dedent';
10
+ import {} from '../../index.js';
11
+ import { coerceType } from '../../utils/coerceType.js';
12
+ export class ExtractYamlNodeImpl extends NodeImpl {
13
+ static create() {
14
+ const chartNode = {
15
+ type: 'extractYaml',
16
+ title: 'Extract YAML',
17
+ id: nanoid(),
18
+ visualData: {
19
+ x: 0,
20
+ y: 0,
21
+ width: 250,
22
+ },
23
+ data: {
24
+ rootPropertyName: 'yamlDocument',
25
+ useRootPropertyNameInput: false,
26
+ useObjectPathInput: false,
27
+ objectPath: undefined,
28
+ },
29
+ };
30
+ return chartNode;
31
+ }
32
+ getInputDefinitions() {
33
+ const inputs = [
34
+ {
35
+ id: 'input',
36
+ title: 'Input',
37
+ dataType: 'string',
38
+ required: true,
39
+ coerced: false,
40
+ },
41
+ ];
42
+ if (this.data.useRootPropertyNameInput) {
43
+ inputs.push({
44
+ id: 'rootPropertyName',
45
+ title: 'Root Property Name',
46
+ dataType: 'string',
47
+ required: true,
48
+ });
49
+ }
50
+ if (this.data.useObjectPathInput) {
51
+ inputs.push({
52
+ id: 'objectPath',
53
+ title: 'Object Path',
54
+ dataType: 'string',
55
+ required: true,
56
+ });
57
+ }
58
+ return inputs;
59
+ }
60
+ getOutputDefinitions() {
61
+ return [
62
+ {
63
+ id: 'output',
64
+ title: 'Output',
65
+ dataType: 'object',
66
+ },
67
+ {
68
+ id: 'matches',
69
+ title: 'Matches',
70
+ dataType: 'any[]',
71
+ },
72
+ {
73
+ id: 'noMatch',
74
+ title: 'No Match',
75
+ dataType: 'string',
76
+ },
77
+ ];
78
+ }
79
+ getEditors() {
80
+ return [
81
+ {
82
+ type: 'string',
83
+ label: 'Root Property Name',
84
+ dataKey: 'rootPropertyName',
85
+ useInputToggleDataKey: 'useRootPropertyNameInput',
86
+ },
87
+ {
88
+ type: 'code',
89
+ label: 'Object Path',
90
+ dataKey: 'objectPath',
91
+ language: 'jsonpath',
92
+ useInputToggleDataKey: 'useObjectPathInput',
93
+ },
94
+ ];
95
+ }
96
+ getBody() {
97
+ return dedent `
98
+ Root: ${this.data.useRootPropertyNameInput ? '(Using Input)' : this.data.rootPropertyName}
99
+ ${this.data.useObjectPathInput
100
+ ? 'Path: (Using Input)'
101
+ : this.data.objectPath
102
+ ? `Path: ${this.data.objectPath}`
103
+ : ``}
104
+ `;
105
+ }
106
+ static getUIData() {
107
+ return {
108
+ infoBoxBody: dedent `
109
+ Finds and parses a YAML object in the input text with a predefined root property name (configurable).
110
+
111
+ Defaults to \`yamlDocument\`, which means the input text must have a \`yamlDocument:\` root node somewhere in it. All indented text after that is considered part of the YAML.
112
+
113
+ Outputs the parsed object.
114
+ `,
115
+ infoBoxTitle: 'Extract YAML Node',
116
+ contextMenuTitle: 'Extract YAML',
117
+ group: ['Objects'],
118
+ };
119
+ }
120
+ async process(inputs) {
121
+ const inputString = expectType(inputs['input'], 'string');
122
+ const rootPropertyName = this.data.useRootPropertyNameInput
123
+ ? coerceType(inputs['rootPropertyName'], 'string')
124
+ : this.data.rootPropertyName;
125
+ const objectPath = this.data.useObjectPathInput
126
+ ? coerceType(inputs['objectPath'], 'string')
127
+ : this.data.objectPath;
128
+ const match = new RegExp(`^${rootPropertyName}:`, 'm').exec(inputString);
129
+ const rootPropertyStart = match?.index ?? -1;
130
+ const nextLines = inputString.slice(rootPropertyStart).split('\n');
131
+ const yamlLines = [nextLines.shift()]; // remove the first line, which is the root property name
132
+ while (nextLines[0]?.startsWith(' ') || nextLines[0]?.startsWith('\t') || nextLines[0] === '') {
133
+ yamlLines.push(nextLines.shift());
134
+ }
135
+ const potentialYaml = yamlLines.join('\n');
136
+ let yamlObject = undefined;
137
+ try {
138
+ yamlObject = yaml.parse(potentialYaml);
139
+ }
140
+ catch (err) {
141
+ return {
142
+ ['noMatch']: {
143
+ type: 'string',
144
+ value: potentialYaml,
145
+ },
146
+ ['output']: {
147
+ type: 'control-flow-excluded',
148
+ value: undefined,
149
+ },
150
+ };
151
+ }
152
+ if (!yamlObject?.hasOwnProperty(rootPropertyName)) {
153
+ return {
154
+ ['noMatch']: {
155
+ type: 'string',
156
+ value: potentialYaml,
157
+ },
158
+ ['output']: {
159
+ type: 'control-flow-excluded',
160
+ value: undefined,
161
+ },
162
+ };
163
+ }
164
+ let matches = [];
165
+ if (objectPath) {
166
+ try {
167
+ const extractedValue = JSONPath({ json: yamlObject, path: objectPath.trim() });
168
+ matches = extractedValue;
169
+ yamlObject = extractedValue.length > 0 ? extractedValue[0] : undefined;
170
+ }
171
+ catch (err) {
172
+ return {
173
+ ['noMatch']: {
174
+ type: 'string',
175
+ value: potentialYaml,
176
+ },
177
+ ['output']: {
178
+ type: 'control-flow-excluded',
179
+ value: undefined,
180
+ },
181
+ ['matches']: {
182
+ type: 'control-flow-excluded',
183
+ value: undefined,
184
+ },
185
+ };
186
+ }
187
+ }
188
+ return {
189
+ ['output']: yamlObject === undefined
190
+ ? {
191
+ type: 'control-flow-excluded',
192
+ value: undefined,
193
+ }
194
+ : this.data.objectPath
195
+ ? {
196
+ type: 'any',
197
+ value: yamlObject,
198
+ }
199
+ : {
200
+ type: 'object',
201
+ value: yamlObject,
202
+ },
203
+ ['noMatch']: {
204
+ type: 'control-flow-excluded',
205
+ value: undefined,
206
+ },
207
+ ['matches']: {
208
+ type: 'any[]',
209
+ value: matches,
210
+ },
211
+ };
212
+ }
213
+ }
214
+ export const extractYamlNode = nodeDefinition(ExtractYamlNodeImpl, 'Extract YAML');
@@ -0,0 +1,73 @@
1
+ import {} from '../NodeBase.js';
2
+ import { nanoid } from 'nanoid/non-secure';
3
+ import { NodeImpl } from '../NodeImpl.js';
4
+ import { nodeDefinition } from '../NodeDefinition.js';
5
+ import {} from '../GraphProcessor.js';
6
+ import {} from '../../index.js';
7
+ import { zip } from 'lodash-es';
8
+ import { dedent } from 'ts-dedent';
9
+ import { coerceType } from '../../utils/coerceType.js';
10
+ export class FilterNodeImpl extends NodeImpl {
11
+ static create() {
12
+ const chartNode = {
13
+ type: 'filter',
14
+ title: 'Filter',
15
+ id: nanoid(),
16
+ visualData: {
17
+ x: 0,
18
+ y: 0,
19
+ width: 175,
20
+ },
21
+ data: {},
22
+ };
23
+ return chartNode;
24
+ }
25
+ getInputDefinitions() {
26
+ return [
27
+ {
28
+ id: 'array',
29
+ title: 'Array',
30
+ dataType: 'any[]',
31
+ required: true,
32
+ },
33
+ {
34
+ id: 'include',
35
+ title: 'Include',
36
+ dataType: 'boolean[]',
37
+ required: true,
38
+ },
39
+ ];
40
+ }
41
+ getOutputDefinitions() {
42
+ return [
43
+ {
44
+ id: 'filtered',
45
+ title: 'Filtered',
46
+ dataType: 'any[]',
47
+ },
48
+ ];
49
+ }
50
+ static getUIData() {
51
+ return {
52
+ infoBoxBody: dedent `
53
+ Takes in both an array of values, and an array of booleans of the same length, and filters the array where the corresponding boolean is true.
54
+ `,
55
+ infoBoxTitle: 'Filter Node',
56
+ contextMenuTitle: 'Filter',
57
+ group: ['Lists'],
58
+ };
59
+ }
60
+ async process(inputs) {
61
+ const array = coerceType(inputs['array'], 'any[]');
62
+ const include = coerceType(inputs['include'], 'boolean[]');
63
+ const zipped = zip(array, include);
64
+ const filtered = zipped.filter(([_, include]) => include).map(([value, _]) => value);
65
+ return {
66
+ ['filtered']: {
67
+ type: inputs['array']?.type ?? 'any',
68
+ value: filtered,
69
+ },
70
+ };
71
+ }
72
+ }
73
+ export const filterNode = nodeDefinition(FilterNodeImpl, 'Filter');
@@ -0,0 +1,53 @@
1
+ import { NodeImpl } from '../NodeImpl.js';
2
+ import { dedent, newId } from '../../utils/index.js';
3
+ import { nodeDefinition } from '../NodeDefinition.js';
4
+ export class GetAllDatasetsNodeImpl extends NodeImpl {
5
+ static create() {
6
+ return {
7
+ id: newId(),
8
+ type: 'getAllDatasets',
9
+ title: 'Get All Datasets',
10
+ visualData: { x: 0, y: 0, width: 250 },
11
+ data: {},
12
+ };
13
+ }
14
+ getInputDefinitions() {
15
+ return [];
16
+ }
17
+ getOutputDefinitions() {
18
+ return [
19
+ {
20
+ id: 'datasets',
21
+ title: 'Datasets',
22
+ dataType: 'object[]',
23
+ },
24
+ ];
25
+ }
26
+ static getUIData() {
27
+ return {
28
+ infoBoxBody: dedent `
29
+ Retrieves all datasets. If no datasets exist, it returns an empty array.
30
+ `,
31
+ infoBoxTitle: 'Get All Datasets Node',
32
+ contextMenuTitle: 'Get All Datasets',
33
+ group: ['Input/Output'],
34
+ };
35
+ }
36
+ getEditors() {
37
+ return [];
38
+ }
39
+ async process(inputs, context) {
40
+ const { datasetProvider } = context;
41
+ if (datasetProvider == null) {
42
+ throw new Error('datasetProvider is required');
43
+ }
44
+ const datasets = await datasetProvider.getDatasetsForProject(context.project.metadata.id);
45
+ return {
46
+ ['datasets']: {
47
+ type: 'object[]',
48
+ value: datasets,
49
+ },
50
+ };
51
+ }
52
+ }
53
+ export const getAllDatasetsNode = nodeDefinition(GetAllDatasetsNodeImpl, 'Get All Datasets');
@@ -0,0 +1,99 @@
1
+ import { NodeImpl } from '../NodeImpl.js';
2
+ import { dedent, getInputOrData, newId } from '../../utils/index.js';
3
+ import { nodeDefinition } from '../NodeDefinition.js';
4
+ export class GetDatasetRowNodeImpl extends NodeImpl {
5
+ static create() {
6
+ return {
7
+ id: newId(),
8
+ type: 'getDatasetRow',
9
+ title: 'Get Dataset Row',
10
+ visualData: { x: 0, y: 0, width: 250 },
11
+ data: {
12
+ datasetId: '',
13
+ rowId: '',
14
+ },
15
+ };
16
+ }
17
+ getInputDefinitions() {
18
+ const inputs = [];
19
+ if (this.data.useRowIdInput) {
20
+ inputs.push({
21
+ id: 'rowId',
22
+ title: 'Row ID',
23
+ dataType: 'string',
24
+ });
25
+ }
26
+ if (this.data.useDatasetIdInput) {
27
+ inputs.push({
28
+ id: 'datasetId',
29
+ title: 'Dataset ID',
30
+ dataType: 'string',
31
+ });
32
+ }
33
+ return inputs;
34
+ }
35
+ getOutputDefinitions() {
36
+ return [
37
+ {
38
+ id: 'row',
39
+ title: 'Row',
40
+ dataType: 'object',
41
+ },
42
+ ];
43
+ }
44
+ static getUIData() {
45
+ return {
46
+ infoBoxBody: dedent `
47
+ Gets a row from a dataset with the provided ID. If the dataset or row does not exist, it throws an error.
48
+ `,
49
+ infoBoxTitle: 'Get Dataset Row Node',
50
+ contextMenuTitle: 'Get Dataset Row',
51
+ group: ['Input/Output'],
52
+ };
53
+ }
54
+ getEditors() {
55
+ return [
56
+ {
57
+ type: 'datasetSelector',
58
+ label: 'Dataset',
59
+ dataKey: 'datasetId',
60
+ useInputToggleDataKey: 'useDatasetIdInput',
61
+ },
62
+ {
63
+ type: 'string',
64
+ label: 'Row ID',
65
+ dataKey: 'rowId',
66
+ useInputToggleDataKey: 'useRowIdInput',
67
+ },
68
+ ];
69
+ }
70
+ async process(inputs, context) {
71
+ const { datasetProvider } = context;
72
+ if (datasetProvider == null) {
73
+ throw new Error('datasetProvider is required');
74
+ }
75
+ const datasetId = getInputOrData(this.data, inputs, 'datasetId', 'string');
76
+ const rowId = getInputOrData(this.data, inputs, 'rowId', 'string');
77
+ const dataset = await datasetProvider.getDatasetData(datasetId);
78
+ if (!dataset) {
79
+ throw new Error(`Dataset with ID ${datasetId} does not exist`);
80
+ }
81
+ // TODO be more efficient
82
+ const row = dataset.rows.find((r) => r.id === rowId);
83
+ if (!row) {
84
+ return {
85
+ ['row']: {
86
+ type: 'control-flow-excluded',
87
+ value: undefined,
88
+ },
89
+ };
90
+ }
91
+ return {
92
+ ['row']: {
93
+ type: 'object',
94
+ value: row,
95
+ },
96
+ };
97
+ }
98
+ }
99
+ export const getDatasetRowNode = nodeDefinition(GetDatasetRowNodeImpl, 'Get Dataset Row');