@nodetool-ai/base-nodes 0.7.0-rc.22 → 0.8.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 (363) hide show
  1. package/README.md +21 -0
  2. package/dist/.nodetool-build-stamp +1 -0
  3. package/dist/index.d.ts +61 -67
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/index.js +179 -173
  6. package/dist/index.js.map +1 -1
  7. package/dist/platforms/browser.d.ts +19 -0
  8. package/dist/platforms/browser.d.ts.map +1 -0
  9. package/dist/platforms/browser.js +29 -0
  10. package/dist/platforms/browser.js.map +1 -0
  11. package/package.json +53 -65
  12. package/dist/lib/audio-wav.d.ts +0 -66
  13. package/dist/lib/audio-wav.d.ts.map +0 -1
  14. package/dist/lib/audio-wav.js +0 -215
  15. package/dist/lib/audio-wav.js.map +0 -1
  16. package/dist/nodes/agent-tool-hydration.d.ts +0 -10
  17. package/dist/nodes/agent-tool-hydration.d.ts.map +0 -1
  18. package/dist/nodes/agent-tool-hydration.js +0 -43
  19. package/dist/nodes/agent-tool-hydration.js.map +0 -1
  20. package/dist/nodes/agents.d.ts +0 -262
  21. package/dist/nodes/agents.d.ts.map +0 -1
  22. package/dist/nodes/agents.js +0 -2856
  23. package/dist/nodes/agents.js.map +0 -1
  24. package/dist/nodes/anthropic.d.ts +0 -26
  25. package/dist/nodes/anthropic.d.ts.map +0 -1
  26. package/dist/nodes/anthropic.js +0 -133
  27. package/dist/nodes/anthropic.js.map +0 -1
  28. package/dist/nodes/apify.d.ts +0 -120
  29. package/dist/nodes/apify.d.ts.map +0 -1
  30. package/dist/nodes/apify.js +0 -618
  31. package/dist/nodes/apify.js.map +0 -1
  32. package/dist/nodes/audio.d.ts +0 -301
  33. package/dist/nodes/audio.d.ts.map +0 -1
  34. package/dist/nodes/audio.js +0 -1274
  35. package/dist/nodes/audio.js.map +0 -1
  36. package/dist/nodes/code-node.d.ts +0 -34
  37. package/dist/nodes/code-node.d.ts.map +0 -1
  38. package/dist/nodes/code-node.js +0 -343
  39. package/dist/nodes/code-node.js.map +0 -1
  40. package/dist/nodes/code.d.ts +0 -301
  41. package/dist/nodes/code.d.ts.map +0 -1
  42. package/dist/nodes/code.js +0 -850
  43. package/dist/nodes/code.js.map +0 -1
  44. package/dist/nodes/compare.d.ts +0 -18
  45. package/dist/nodes/compare.d.ts.map +0 -1
  46. package/dist/nodes/compare.js +0 -122
  47. package/dist/nodes/compare.js.map +0 -1
  48. package/dist/nodes/constant.d.ts +0 -315
  49. package/dist/nodes/constant.d.ts.map +0 -1
  50. package/dist/nodes/constant.js +0 -715
  51. package/dist/nodes/constant.js.map +0 -1
  52. package/dist/nodes/control.d.ts +0 -83
  53. package/dist/nodes/control.d.ts.map +0 -1
  54. package/dist/nodes/control.js +0 -212
  55. package/dist/nodes/control.js.map +0 -1
  56. package/dist/nodes/data.d.ts +0 -369
  57. package/dist/nodes/data.d.ts.map +0 -1
  58. package/dist/nodes/data.js +0 -1590
  59. package/dist/nodes/data.js.map +0 -1
  60. package/dist/nodes/document.d.ts +0 -134
  61. package/dist/nodes/document.d.ts.map +0 -1
  62. package/dist/nodes/document.js +0 -984
  63. package/dist/nodes/document.js.map +0 -1
  64. package/dist/nodes/extended-placeholders.d.ts +0 -6
  65. package/dist/nodes/extended-placeholders.d.ts.map +0 -1
  66. package/dist/nodes/extended-placeholders.js +0 -19
  67. package/dist/nodes/extended-placeholders.js.map +0 -1
  68. package/dist/nodes/gemini.d.ts +0 -110
  69. package/dist/nodes/gemini.d.ts.map +0 -1
  70. package/dist/nodes/gemini.js +0 -871
  71. package/dist/nodes/gemini.js.map +0 -1
  72. package/dist/nodes/generators.d.ts +0 -84
  73. package/dist/nodes/generators.d.ts.map +0 -1
  74. package/dist/nodes/generators.js +0 -968
  75. package/dist/nodes/generators.js.map +0 -1
  76. package/dist/nodes/image.d.ts +0 -232
  77. package/dist/nodes/image.d.ts.map +0 -1
  78. package/dist/nodes/image.js +0 -1395
  79. package/dist/nodes/image.js.map +0 -1
  80. package/dist/nodes/input.d.ts +0 -445
  81. package/dist/nodes/input.d.ts.map +0 -1
  82. package/dist/nodes/input.js +0 -1459
  83. package/dist/nodes/input.js.map +0 -1
  84. package/dist/nodes/kie-dynamic.d.ts +0 -31
  85. package/dist/nodes/kie-dynamic.d.ts.map +0 -1
  86. package/dist/nodes/kie-dynamic.js +0 -270
  87. package/dist/nodes/kie-dynamic.js.map +0 -1
  88. package/dist/nodes/lib-audio-dsp.d.ts +0 -85
  89. package/dist/nodes/lib-audio-dsp.d.ts.map +0 -1
  90. package/dist/nodes/lib-audio-dsp.js +0 -450
  91. package/dist/nodes/lib-audio-dsp.js.map +0 -1
  92. package/dist/nodes/lib-audio-effects.d.ts +0 -116
  93. package/dist/nodes/lib-audio-effects.d.ts.map +0 -1
  94. package/dist/nodes/lib-audio-effects.js +0 -905
  95. package/dist/nodes/lib-audio-effects.js.map +0 -1
  96. package/dist/nodes/lib-browser.d.ts +0 -99
  97. package/dist/nodes/lib-browser.d.ts.map +0 -1
  98. package/dist/nodes/lib-browser.js +0 -692
  99. package/dist/nodes/lib-browser.js.map +0 -1
  100. package/dist/nodes/lib-charts.d.ts +0 -20
  101. package/dist/nodes/lib-charts.d.ts.map +0 -1
  102. package/dist/nodes/lib-charts.js +0 -245
  103. package/dist/nodes/lib-charts.js.map +0 -1
  104. package/dist/nodes/lib-datetime.d.ts +0 -108
  105. package/dist/nodes/lib-datetime.d.ts.map +0 -1
  106. package/dist/nodes/lib-datetime.js +0 -421
  107. package/dist/nodes/lib-datetime.js.map +0 -1
  108. package/dist/nodes/lib-doc-convert.d.ts +0 -19
  109. package/dist/nodes/lib-doc-convert.d.ts.map +0 -1
  110. package/dist/nodes/lib-doc-convert.js +0 -257
  111. package/dist/nodes/lib-doc-convert.js.map +0 -1
  112. package/dist/nodes/lib-doc-transform.d.ts +0 -39
  113. package/dist/nodes/lib-doc-transform.d.ts.map +0 -1
  114. package/dist/nodes/lib-doc-transform.js +0 -335
  115. package/dist/nodes/lib-doc-transform.js.map +0 -1
  116. package/dist/nodes/lib-docx.d.ts +0 -106
  117. package/dist/nodes/lib-docx.d.ts.map +0 -1
  118. package/dist/nodes/lib-docx.js +0 -595
  119. package/dist/nodes/lib-docx.js.map +0 -1
  120. package/dist/nodes/lib-epub.d.ts +0 -55
  121. package/dist/nodes/lib-epub.d.ts.map +0 -1
  122. package/dist/nodes/lib-epub.js +0 -220
  123. package/dist/nodes/lib-epub.js.map +0 -1
  124. package/dist/nodes/lib-excel.d.ts +0 -74
  125. package/dist/nodes/lib-excel.d.ts.map +0 -1
  126. package/dist/nodes/lib-excel.js +0 -448
  127. package/dist/nodes/lib-excel.js.map +0 -1
  128. package/dist/nodes/lib-graphql.d.ts +0 -66
  129. package/dist/nodes/lib-graphql.d.ts.map +0 -1
  130. package/dist/nodes/lib-graphql.js +0 -333
  131. package/dist/nodes/lib-graphql.js.map +0 -1
  132. package/dist/nodes/lib-grid.d.ts +0 -27
  133. package/dist/nodes/lib-grid.d.ts.map +0 -1
  134. package/dist/nodes/lib-grid.js +0 -172
  135. package/dist/nodes/lib-grid.js.map +0 -1
  136. package/dist/nodes/lib-html-parse.d.ts +0 -108
  137. package/dist/nodes/lib-html-parse.d.ts.map +0 -1
  138. package/dist/nodes/lib-html-parse.js +0 -365
  139. package/dist/nodes/lib-html-parse.js.map +0 -1
  140. package/dist/nodes/lib-http.d.ts +0 -98
  141. package/dist/nodes/lib-http.d.ts.map +0 -1
  142. package/dist/nodes/lib-http.js +0 -267
  143. package/dist/nodes/lib-http.js.map +0 -1
  144. package/dist/nodes/lib-image-color-grading.d.ts +0 -3
  145. package/dist/nodes/lib-image-color-grading.d.ts.map +0 -1
  146. package/dist/nodes/lib-image-color-grading.js +0 -1386
  147. package/dist/nodes/lib-image-color-grading.js.map +0 -1
  148. package/dist/nodes/lib-image-draw.d.ts +0 -3
  149. package/dist/nodes/lib-image-draw.d.ts.map +0 -1
  150. package/dist/nodes/lib-image-draw.js +0 -470
  151. package/dist/nodes/lib-image-draw.js.map +0 -1
  152. package/dist/nodes/lib-image-enhance.d.ts +0 -3
  153. package/dist/nodes/lib-image-enhance.d.ts.map +0 -1
  154. package/dist/nodes/lib-image-enhance.js +0 -731
  155. package/dist/nodes/lib-image-enhance.js.map +0 -1
  156. package/dist/nodes/lib-image-filter.d.ts +0 -3
  157. package/dist/nodes/lib-image-filter.d.ts.map +0 -1
  158. package/dist/nodes/lib-image-filter.js +0 -684
  159. package/dist/nodes/lib-image-filter.js.map +0 -1
  160. package/dist/nodes/lib-image-utils.d.ts +0 -24
  161. package/dist/nodes/lib-image-utils.d.ts.map +0 -1
  162. package/dist/nodes/lib-image-utils.js +0 -150
  163. package/dist/nodes/lib-image-utils.js.map +0 -1
  164. package/dist/nodes/lib-mail.d.ts +0 -74
  165. package/dist/nodes/lib-mail.d.ts.map +0 -1
  166. package/dist/nodes/lib-mail.js +0 -452
  167. package/dist/nodes/lib-mail.js.map +0 -1
  168. package/dist/nodes/lib-markdown.d.ts +0 -70
  169. package/dist/nodes/lib-markdown.d.ts.map +0 -1
  170. package/dist/nodes/lib-markdown.js +0 -236
  171. package/dist/nodes/lib-markdown.js.map +0 -1
  172. package/dist/nodes/lib-nlp.d.ts +0 -98
  173. package/dist/nodes/lib-nlp.d.ts.map +0 -1
  174. package/dist/nodes/lib-nlp.js +0 -374
  175. package/dist/nodes/lib-nlp.js.map +0 -1
  176. package/dist/nodes/lib-notion.d.ts +0 -99
  177. package/dist/nodes/lib-notion.d.ts.map +0 -1
  178. package/dist/nodes/lib-notion.js +0 -601
  179. package/dist/nodes/lib-notion.js.map +0 -1
  180. package/dist/nodes/lib-ocr.d.ts +0 -31
  181. package/dist/nodes/lib-ocr.d.ts.map +0 -1
  182. package/dist/nodes/lib-ocr.js +0 -143
  183. package/dist/nodes/lib-ocr.js.map +0 -1
  184. package/dist/nodes/lib-os.d.ts +0 -312
  185. package/dist/nodes/lib-os.d.ts.map +0 -1
  186. package/dist/nodes/lib-os.js +0 -909
  187. package/dist/nodes/lib-os.js.map +0 -1
  188. package/dist/nodes/lib-pdf.d.ts +0 -142
  189. package/dist/nodes/lib-pdf.d.ts.map +0 -1
  190. package/dist/nodes/lib-pdf.js +0 -871
  191. package/dist/nodes/lib-pdf.js.map +0 -1
  192. package/dist/nodes/lib-pptx.d.ts +0 -29
  193. package/dist/nodes/lib-pptx.d.ts.map +0 -1
  194. package/dist/nodes/lib-pptx.js +0 -122
  195. package/dist/nodes/lib-pptx.js.map +0 -1
  196. package/dist/nodes/lib-rss.d.ts +0 -31
  197. package/dist/nodes/lib-rss.d.ts.map +0 -1
  198. package/dist/nodes/lib-rss.js +0 -163
  199. package/dist/nodes/lib-rss.js.map +0 -1
  200. package/dist/nodes/lib-s3.d.ts +0 -112
  201. package/dist/nodes/lib-s3.d.ts.map +0 -1
  202. package/dist/nodes/lib-s3.js +0 -521
  203. package/dist/nodes/lib-s3.js.map +0 -1
  204. package/dist/nodes/lib-secret.d.ts +0 -15
  205. package/dist/nodes/lib-secret.d.ts.map +0 -1
  206. package/dist/nodes/lib-secret.js +0 -42
  207. package/dist/nodes/lib-secret.js.map +0 -1
  208. package/dist/nodes/lib-sqlite.d.ts +0 -102
  209. package/dist/nodes/lib-sqlite.d.ts.map +0 -1
  210. package/dist/nodes/lib-sqlite.js +0 -532
  211. package/dist/nodes/lib-sqlite.js.map +0 -1
  212. package/dist/nodes/lib-supabase.d.ts +0 -86
  213. package/dist/nodes/lib-supabase.d.ts.map +0 -1
  214. package/dist/nodes/lib-supabase.js +0 -425
  215. package/dist/nodes/lib-supabase.js.map +0 -1
  216. package/dist/nodes/lib-svg.d.ts +0 -199
  217. package/dist/nodes/lib-svg.d.ts.map +0 -1
  218. package/dist/nodes/lib-svg.js +0 -1027
  219. package/dist/nodes/lib-svg.js.map +0 -1
  220. package/dist/nodes/lib-tensorflow.d.ts +0 -71
  221. package/dist/nodes/lib-tensorflow.d.ts.map +0 -1
  222. package/dist/nodes/lib-tensorflow.js +0 -351
  223. package/dist/nodes/lib-tensorflow.js.map +0 -1
  224. package/dist/nodes/lib-twilio.d.ts +0 -71
  225. package/dist/nodes/lib-twilio.d.ts.map +0 -1
  226. package/dist/nodes/lib-twilio.js +0 -469
  227. package/dist/nodes/lib-twilio.js.map +0 -1
  228. package/dist/nodes/lib-validate.d.ts +0 -84
  229. package/dist/nodes/lib-validate.d.ts.map +0 -1
  230. package/dist/nodes/lib-validate.js +0 -215
  231. package/dist/nodes/lib-validate.js.map +0 -1
  232. package/dist/nodes/lib-video-download.d.ts +0 -26
  233. package/dist/nodes/lib-video-download.d.ts.map +0 -1
  234. package/dist/nodes/lib-video-download.js +0 -299
  235. package/dist/nodes/lib-video-download.js.map +0 -1
  236. package/dist/nodes/messaging.d.ts +0 -88
  237. package/dist/nodes/messaging.d.ts.map +0 -1
  238. package/dist/nodes/messaging.js +0 -418
  239. package/dist/nodes/messaging.js.map +0 -1
  240. package/dist/nodes/mistral.d.ts +0 -83
  241. package/dist/nodes/mistral.d.ts.map +0 -1
  242. package/dist/nodes/mistral.js +0 -450
  243. package/dist/nodes/mistral.js.map +0 -1
  244. package/dist/nodes/model3d/analysis.d.ts +0 -13
  245. package/dist/nodes/model3d/analysis.d.ts.map +0 -1
  246. package/dist/nodes/model3d/analysis.js +0 -36
  247. package/dist/nodes/model3d/analysis.js.map +0 -1
  248. package/dist/nodes/model3d/base.d.ts +0 -11
  249. package/dist/nodes/model3d/base.d.ts.map +0 -1
  250. package/dist/nodes/model3d/base.js +0 -20
  251. package/dist/nodes/model3d/base.js.map +0 -1
  252. package/dist/nodes/model3d/boolean-ops.d.ts +0 -2
  253. package/dist/nodes/model3d/boolean-ops.d.ts.map +0 -1
  254. package/dist/nodes/model3d/boolean-ops.js +0 -172
  255. package/dist/nodes/model3d/boolean-ops.js.map +0 -1
  256. package/dist/nodes/model3d/cleanup.d.ts +0 -47
  257. package/dist/nodes/model3d/cleanup.d.ts.map +0 -1
  258. package/dist/nodes/model3d/cleanup.js +0 -136
  259. package/dist/nodes/model3d/cleanup.js.map +0 -1
  260. package/dist/nodes/model3d/convert.d.ts +0 -14
  261. package/dist/nodes/model3d/convert.d.ts.map +0 -1
  262. package/dist/nodes/model3d/convert.js +0 -64
  263. package/dist/nodes/model3d/convert.js.map +0 -1
  264. package/dist/nodes/model3d/defaults.d.ts +0 -34
  265. package/dist/nodes/model3d/defaults.d.ts.map +0 -1
  266. package/dist/nodes/model3d/defaults.js +0 -28
  267. package/dist/nodes/model3d/defaults.js.map +0 -1
  268. package/dist/nodes/model3d/document-ops.d.ts +0 -4
  269. package/dist/nodes/model3d/document-ops.d.ts.map +0 -1
  270. package/dist/nodes/model3d/document-ops.js +0 -40
  271. package/dist/nodes/model3d/document-ops.js.map +0 -1
  272. package/dist/nodes/model3d/generation.d.ts +0 -39
  273. package/dist/nodes/model3d/generation.d.ts.map +0 -1
  274. package/dist/nodes/model3d/generation.js +0 -179
  275. package/dist/nodes/model3d/generation.js.map +0 -1
  276. package/dist/nodes/model3d/glb.d.ts +0 -29
  277. package/dist/nodes/model3d/glb.d.ts.map +0 -1
  278. package/dist/nodes/model3d/glb.js +0 -255
  279. package/dist/nodes/model3d/glb.js.map +0 -1
  280. package/dist/nodes/model3d/index.d.ts +0 -20
  281. package/dist/nodes/model3d/index.d.ts.map +0 -1
  282. package/dist/nodes/model3d/index.js +0 -38
  283. package/dist/nodes/model3d/index.js.map +0 -1
  284. package/dist/nodes/model3d/io.d.ts +0 -38
  285. package/dist/nodes/model3d/io.d.ts.map +0 -1
  286. package/dist/nodes/model3d/io.js +0 -162
  287. package/dist/nodes/model3d/io.js.map +0 -1
  288. package/dist/nodes/model3d/mesh-ops.d.ts +0 -40
  289. package/dist/nodes/model3d/mesh-ops.d.ts.map +0 -1
  290. package/dist/nodes/model3d/mesh-ops.js +0 -775
  291. package/dist/nodes/model3d/mesh-ops.js.map +0 -1
  292. package/dist/nodes/model3d/nodes.d.ts +0 -2
  293. package/dist/nodes/model3d/nodes.d.ts.map +0 -1
  294. package/dist/nodes/model3d/nodes.js +0 -2
  295. package/dist/nodes/model3d/nodes.js.map +0 -1
  296. package/dist/nodes/model3d/ops.d.ts +0 -37
  297. package/dist/nodes/model3d/ops.d.ts.map +0 -1
  298. package/dist/nodes/model3d/ops.js +0 -137
  299. package/dist/nodes/model3d/ops.js.map +0 -1
  300. package/dist/nodes/model3d/transforms.d.ts +0 -49
  301. package/dist/nodes/model3d/transforms.d.ts.map +0 -1
  302. package/dist/nodes/model3d/transforms.js +0 -142
  303. package/dist/nodes/model3d/transforms.js.map +0 -1
  304. package/dist/nodes/model3d/types.d.ts +0 -81
  305. package/dist/nodes/model3d/types.d.ts.map +0 -1
  306. package/dist/nodes/model3d/types.js +0 -2
  307. package/dist/nodes/model3d/types.js.map +0 -1
  308. package/dist/nodes/model3d/utils.d.ts +0 -34
  309. package/dist/nodes/model3d/utils.d.ts.map +0 -1
  310. package/dist/nodes/model3d/utils.js +0 -185
  311. package/dist/nodes/model3d/utils.js.map +0 -1
  312. package/dist/nodes/model3d.d.ts +0 -2
  313. package/dist/nodes/model3d.d.ts.map +0 -1
  314. package/dist/nodes/model3d.js +0 -2
  315. package/dist/nodes/model3d.js.map +0 -1
  316. package/dist/nodes/openai.d.ts +0 -172
  317. package/dist/nodes/openai.d.ts.map +0 -1
  318. package/dist/nodes/openai.js +0 -1294
  319. package/dist/nodes/openai.js.map +0 -1
  320. package/dist/nodes/output.d.ts +0 -29
  321. package/dist/nodes/output.d.ts.map +0 -1
  322. package/dist/nodes/output.js +0 -87
  323. package/dist/nodes/output.js.map +0 -1
  324. package/dist/nodes/sandbox.d.ts +0 -63
  325. package/dist/nodes/sandbox.d.ts.map +0 -1
  326. package/dist/nodes/sandbox.js +0 -633
  327. package/dist/nodes/sandbox.js.map +0 -1
  328. package/dist/nodes/search.d.ts +0 -117
  329. package/dist/nodes/search.d.ts.map +0 -1
  330. package/dist/nodes/search.js +0 -607
  331. package/dist/nodes/search.js.map +0 -1
  332. package/dist/nodes/team.d.ts +0 -74
  333. package/dist/nodes/team.d.ts.map +0 -1
  334. package/dist/nodes/team.js +0 -309
  335. package/dist/nodes/team.js.map +0 -1
  336. package/dist/nodes/text-extra.d.ts +0 -633
  337. package/dist/nodes/text-extra.d.ts.map +0 -1
  338. package/dist/nodes/text-extra.js +0 -2226
  339. package/dist/nodes/text-extra.js.map +0 -1
  340. package/dist/nodes/tool-agents.d.ts +0 -334
  341. package/dist/nodes/tool-agents.d.ts.map +0 -1
  342. package/dist/nodes/tool-agents.js +0 -1861
  343. package/dist/nodes/tool-agents.js.map +0 -1
  344. package/dist/nodes/triggers.d.ts +0 -107
  345. package/dist/nodes/triggers.d.ts.map +0 -1
  346. package/dist/nodes/triggers.js +0 -706
  347. package/dist/nodes/triggers.js.map +0 -1
  348. package/dist/nodes/vector.d.ts +0 -168
  349. package/dist/nodes/vector.d.ts.map +0 -1
  350. package/dist/nodes/vector.js +0 -1121
  351. package/dist/nodes/vector.js.map +0 -1
  352. package/dist/nodes/video.d.ts +0 -387
  353. package/dist/nodes/video.d.ts.map +0 -1
  354. package/dist/nodes/video.js +0 -2383
  355. package/dist/nodes/video.js.map +0 -1
  356. package/dist/nodes/workflow.d.ts +0 -24
  357. package/dist/nodes/workflow.d.ts.map +0 -1
  358. package/dist/nodes/workflow.js +0 -146
  359. package/dist/nodes/workflow.js.map +0 -1
  360. package/dist/nodes/workspace.d.ts +0 -203
  361. package/dist/nodes/workspace.d.ts.map +0 -1
  362. package/dist/nodes/workspace.js +0 -795
  363. package/dist/nodes/workspace.js.map +0 -1
@@ -1,871 +0,0 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- import { BaseNode, prop } from "@nodetool-ai/node-sdk";
8
- const GEMINI_API_BASE = "https://generativelanguage.googleapis.com/v1beta";
9
- function getGeminiApiKey(secrets) {
10
- const key = secrets.GEMINI_API_KEY || process.env.GEMINI_API_KEY || "";
11
- if (!key)
12
- throw new Error("GEMINI_API_KEY is not configured");
13
- return key;
14
- }
15
- function getAudioBytes(audio) {
16
- if (typeof audio.data === "string") {
17
- return Uint8Array.from(Buffer.from(audio.data, "base64"));
18
- }
19
- if (audio.data instanceof Uint8Array) {
20
- return audio.data;
21
- }
22
- throw new Error("Audio data is required");
23
- }
24
- function getImageBytes(image) {
25
- if (typeof image.data === "string" && image.data.length > 0) {
26
- return Uint8Array.from(Buffer.from(image.data, "base64"));
27
- }
28
- if (image.data instanceof Uint8Array) {
29
- return image.data;
30
- }
31
- return null;
32
- }
33
- function isRefSet(ref) {
34
- if (!ref || typeof ref !== "object")
35
- return false;
36
- const r = ref;
37
- return Boolean(r.data || r.uri || r.asset_id);
38
- }
39
- // ── Text nodes ──────────────────────────────────────────────────────────────
40
- export class GroundedSearchNode extends BaseNode {
41
- static nodeType = "gemini.text.GroundedSearch";
42
- static title = "Grounded Search";
43
- static description = "Search the web using Google's Gemini API with grounding capabilities.\n google, search, grounded, web, gemini, ai\n\n This node uses Google's Gemini API to perform web searches and return structured results\n with source information. Requires a Gemini API key.\n\n Use cases:\n - Research current events and latest information\n - Find reliable sources for fact-checking\n - Gather web-based information with citations\n - Get up-to-date information beyond the model's training data";
44
- static metadataOutputTypes = {
45
- results: "list[str]",
46
- sources: "list[source]",
47
- text: "str"
48
- };
49
- static requiredSettings = ["GEMINI_API_KEY"];
50
- static exposeAsTool = true;
51
- async process() {
52
- const apiKey = getGeminiApiKey(this._secrets);
53
- const query = String(this.query ?? "");
54
- const model = String(this.model ?? "gemini-3-flash-preview");
55
- if (!query)
56
- throw new Error("Search query is required");
57
- const url = `${GEMINI_API_BASE}/models/${model}:generateContent?key=${apiKey}`;
58
- const body = {
59
- contents: [{ parts: [{ text: query }] }],
60
- tools: [{ google_search: {} }],
61
- generationConfig: {
62
- responseMimeType: "text/plain"
63
- }
64
- };
65
- const res = await fetch(url, {
66
- method: "POST",
67
- headers: { "Content-Type": "application/json" },
68
- body: JSON.stringify(body)
69
- });
70
- if (!res.ok) {
71
- const errText = await res.text();
72
- throw new Error(`Gemini API error ${res.status}: ${errText}`);
73
- }
74
- const data = (await res.json());
75
- const candidates = data.candidates;
76
- if (!candidates || candidates.length === 0) {
77
- throw new Error("No response received from Gemini API");
78
- }
79
- const candidate = candidates[0];
80
- const content = candidate.content;
81
- if (!content)
82
- throw new Error("Invalid response format from Gemini API");
83
- const parts = content.parts;
84
- const results = [];
85
- if (parts) {
86
- for (const part of parts) {
87
- if (typeof part.text === "string") {
88
- results.push(part.text);
89
- }
90
- }
91
- }
92
- const sources = [];
93
- const groundingMetadata = candidate.groundingMetadata;
94
- if (groundingMetadata) {
95
- const chunks = groundingMetadata.groundingChunks;
96
- if (chunks) {
97
- for (const chunk of chunks) {
98
- const web = chunk.web;
99
- if (web) {
100
- const source = {
101
- title: String(web.title ?? ""),
102
- url: String(web.uri ?? "")
103
- };
104
- if (source.url && !sources.some((s) => s.url === source.url)) {
105
- sources.push(source);
106
- }
107
- }
108
- }
109
- }
110
- }
111
- return { results, sources, text: results.join("\n") };
112
- }
113
- }
114
- __decorate([
115
- prop({
116
- type: "str",
117
- default: "",
118
- title: "Query",
119
- description: "The search query to execute"
120
- })
121
- ], GroundedSearchNode.prototype, "query", void 0);
122
- __decorate([
123
- prop({
124
- type: "enum",
125
- default: "gemini-3-flash-preview",
126
- title: "Model",
127
- description: "The Gemini model to use for search",
128
- values: [
129
- "gemini-3.1-pro-preview",
130
- "gemini-3.1-flash-image-preview",
131
- "gemini-3-pro-image-preview",
132
- "gemini-3-flash-preview",
133
- "gemini-2.5-pro",
134
- "gemini-2.5-flash",
135
- "gemini-2.5-flash-lite",
136
- "gemini-2.0-flash"
137
- ]
138
- })
139
- ], GroundedSearchNode.prototype, "model", void 0);
140
- export class EmbeddingNode extends BaseNode {
141
- static nodeType = "gemini.text.Embedding";
142
- static title = "Embedding";
143
- static description = "Generate vector representations of text for semantic analysis using Google's Gemini API.\n embeddings, similarity, search, clustering, classification, gemini\n\n Uses Google's text embedding models to create dense vector representations of text.\n These vectors capture semantic meaning, enabling:\n - Semantic search\n - Text clustering\n - Document classification\n - Recommendation systems\n - Anomaly detection\n - Measuring text similarity and diversity";
144
- static metadataOutputTypes = {
145
- output: "list"
146
- };
147
- static requiredSettings = ["GEMINI_API_KEY"];
148
- static exposeAsTool = true;
149
- async process() {
150
- const apiKey = getGeminiApiKey(this._secrets);
151
- const input = String(this.input ?? "");
152
- const model = String(this.model ?? "text-embedding-004");
153
- if (!input)
154
- throw new Error("Input text is required for embedding generation");
155
- const url = `${GEMINI_API_BASE}/models/${model}:embedContent?key=${apiKey}`;
156
- const body = {
157
- content: { parts: [{ text: input }] }
158
- };
159
- const res = await fetch(url, {
160
- method: "POST",
161
- headers: { "Content-Type": "application/json" },
162
- body: JSON.stringify(body)
163
- });
164
- if (!res.ok) {
165
- const errText = await res.text();
166
- throw new Error(`Gemini API error ${res.status}: ${errText}`);
167
- }
168
- const data = (await res.json());
169
- const embedding = data.embedding;
170
- if (!embedding || !embedding.values) {
171
- throw new Error("No embedding generated from the input text");
172
- }
173
- return { output: embedding.values };
174
- }
175
- }
176
- __decorate([
177
- prop({
178
- type: "str",
179
- default: "",
180
- title: "Input",
181
- description: "The text to embed."
182
- })
183
- ], EmbeddingNode.prototype, "input", void 0);
184
- __decorate([
185
- prop({
186
- type: "enum",
187
- default: "text-embedding-004",
188
- title: "Model",
189
- description: "The embedding model to use",
190
- values: ["text-embedding-004", "gemini-embedding-001"]
191
- })
192
- ], EmbeddingNode.prototype, "model", void 0);
193
- // ── Image nodes ─────────────────────────────────────────────────────────────
194
- export class ImageGenerationNode extends BaseNode {
195
- static nodeType = "gemini.image.ImageGeneration";
196
- static title = "Image Generation";
197
- static description = "Generate an image using Google's Imagen model via the Gemini API.\n google, image generation, ai, imagen\n\n Use cases:\n - Create images from text descriptions\n - Generate assets for creative projects\n - Explore AI-powered image synthesis";
198
- static metadataOutputTypes = {
199
- output: "image"
200
- };
201
- static requiredSettings = ["GEMINI_API_KEY"];
202
- static exposeAsTool = true;
203
- static autoSaveAsset = true;
204
- async process() {
205
- const apiKey = getGeminiApiKey(this._secrets);
206
- const prompt = String(this.prompt ?? "");
207
- const model = String(this.model ?? "imagen-3.0-generate-002");
208
- const image = (this.image ?? {});
209
- if (!prompt)
210
- throw new Error("The input prompt cannot be empty.");
211
- // Gemini image-capable models use generateContent with IMAGE+TEXT modalities
212
- if (model.startsWith("gemini-")) {
213
- const contentParts = [{ text: prompt }];
214
- // Add optional input image
215
- const imageBytes = getImageBytes(image);
216
- if (imageBytes) {
217
- contentParts.push({
218
- inline_data: {
219
- mime_type: "image/png",
220
- data: Buffer.from(imageBytes).toString("base64")
221
- }
222
- });
223
- }
224
- const url = `${GEMINI_API_BASE}/models/${model}:generateContent?key=${apiKey}`;
225
- const body = {
226
- contents: [{ parts: contentParts }],
227
- generationConfig: {
228
- responseModalities: ["IMAGE", "TEXT"]
229
- }
230
- };
231
- const res = await fetch(url, {
232
- method: "POST",
233
- headers: { "Content-Type": "application/json" },
234
- body: JSON.stringify(body)
235
- });
236
- if (!res.ok) {
237
- const errText = await res.text();
238
- throw new Error(`Gemini API error ${res.status}: ${errText}`);
239
- }
240
- const data = (await res.json());
241
- const candidates = data.candidates;
242
- if (!candidates || candidates.length === 0) {
243
- throw new Error("No response received from Gemini API");
244
- }
245
- const candidate = candidates[0];
246
- if (candidate.finishReason === "PROHIBITED_CONTENT") {
247
- throw new Error("Prohibited content in the input prompt");
248
- }
249
- const content = candidate.content;
250
- const parts = content?.parts;
251
- if (!parts)
252
- throw new Error("Invalid response format from Gemini API");
253
- for (const part of parts) {
254
- const inlineData = part.inlineData;
255
- // Also check snake_case variant from API
256
- const inlineData2 = part.inline_data;
257
- const d = inlineData ?? inlineData2;
258
- if (d && typeof d.data === "string") {
259
- return { output: { type: "image", data: d.data } };
260
- }
261
- }
262
- throw new Error("No image bytes returned in response");
263
- }
264
- // Imagen models use the generateImages endpoint
265
- const url = `${GEMINI_API_BASE}/models/${model}:generateImages?key=${apiKey}`;
266
- const body = {
267
- prompt,
268
- config: { numberOfImages: 1 }
269
- };
270
- const res = await fetch(url, {
271
- method: "POST",
272
- headers: { "Content-Type": "application/json" },
273
- body: JSON.stringify(body)
274
- });
275
- if (!res.ok) {
276
- const errText = await res.text();
277
- throw new Error(`Gemini API error ${res.status}: ${errText}`);
278
- }
279
- const data = (await res.json());
280
- const generatedImages = data.generatedImages;
281
- if (!generatedImages || generatedImages.length === 0) {
282
- throw new Error("No images generated");
283
- }
284
- const imgObj = generatedImages[0].image;
285
- if (!imgObj)
286
- throw new Error("No image in response");
287
- const imageBytes = imgObj.imageBytes;
288
- if (!imageBytes)
289
- throw new Error("No image bytes in response");
290
- return { output: { type: "image", data: imageBytes } };
291
- }
292
- }
293
- __decorate([
294
- prop({
295
- type: "str",
296
- default: "",
297
- title: "Prompt",
298
- description: "The text prompt describing the image to generate."
299
- })
300
- ], ImageGenerationNode.prototype, "prompt", void 0);
301
- __decorate([
302
- prop({
303
- type: "enum",
304
- default: "imagen-3.0-generate-002",
305
- title: "Model",
306
- description: "The image generation model to use",
307
- values: [
308
- "gemini-2.0-flash-preview-image-generation",
309
- "gemini-2.5-flash-image-preview",
310
- "gemini-3-pro-image-preview",
311
- "imagen-3.0-generate-001",
312
- "imagen-3.0-generate-002",
313
- "imagen-4.0-generate-001"
314
- ]
315
- })
316
- ], ImageGenerationNode.prototype, "model", void 0);
317
- __decorate([
318
- prop({
319
- type: "image",
320
- default: {
321
- type: "image",
322
- uri: "",
323
- asset_id: null,
324
- data: null,
325
- metadata: null
326
- },
327
- title: "Image",
328
- description: "The image to use as a base for the generation."
329
- })
330
- ], ImageGenerationNode.prototype, "image", void 0);
331
- // ── Video nodes ─────────────────────────────────────────────────────────────
332
- export class TextToVideoGeminiNode extends BaseNode {
333
- static nodeType = "gemini.video.TextToVideo";
334
- static title = "Text To Video";
335
- static description = "Generate videos from text prompts using Google's Veo models.\n google, video, generation, text-to-video, veo, ai\n\n This node uses Google's Veo models to generate high-quality videos from text descriptions.\n Supports 720p resolution at 24fps with 8-second duration and native audio generation.";
336
- static metadataOutputTypes = {
337
- output: "video"
338
- };
339
- static requiredSettings = ["GEMINI_API_KEY"];
340
- static exposeAsTool = true;
341
- static autoSaveAsset = true;
342
- async process() {
343
- const apiKey = getGeminiApiKey(this._secrets);
344
- const prompt = String(this.prompt ?? "");
345
- const model = String(this.model ?? "veo-3.1-generate-preview");
346
- const aspectRatio = String(this.aspect_ratio ?? "16:9");
347
- const negativePrompt = String(this.negative_prompt ?? "");
348
- if (!prompt)
349
- throw new Error("Video generation prompt is required");
350
- // Start the long-running video generation operation
351
- const url = `${GEMINI_API_BASE}/models/${model}:generateVideos?key=${apiKey}`;
352
- const config = {};
353
- if (aspectRatio)
354
- config.aspectRatio = aspectRatio;
355
- if (negativePrompt)
356
- config.negativePrompt = negativePrompt;
357
- const body = {
358
- prompt
359
- };
360
- if (Object.keys(config).length > 0)
361
- body.config = config;
362
- const res = await fetch(url, {
363
- method: "POST",
364
- headers: { "Content-Type": "application/json" },
365
- body: JSON.stringify(body)
366
- });
367
- if (!res.ok) {
368
- const errText = await res.text();
369
- throw new Error(`Gemini API error ${res.status}: ${errText}`);
370
- }
371
- const operation = (await res.json());
372
- const videoData = await pollVideoOperation(apiKey, operation);
373
- return { output: { type: "video", data: videoData } };
374
- }
375
- }
376
- __decorate([
377
- prop({
378
- type: "str",
379
- default: "",
380
- title: "Prompt",
381
- description: "The text prompt describing the video to generate"
382
- })
383
- ], TextToVideoGeminiNode.prototype, "prompt", void 0);
384
- __decorate([
385
- prop({
386
- type: "enum",
387
- default: "veo-3.1-generate-preview",
388
- title: "Model",
389
- description: "The Veo model to use for video generation",
390
- values: ["veo-3.1-generate-preview", "veo-2.0-generate-001"]
391
- })
392
- ], TextToVideoGeminiNode.prototype, "model", void 0);
393
- __decorate([
394
- prop({
395
- type: "enum",
396
- default: "16:9",
397
- title: "Aspect Ratio",
398
- description: "The aspect ratio of the generated video",
399
- values: ["16:9", "9:16"]
400
- })
401
- ], TextToVideoGeminiNode.prototype, "aspect_ratio", void 0);
402
- __decorate([
403
- prop({
404
- type: "str",
405
- default: "",
406
- title: "Negative Prompt",
407
- description: "Negative prompt to guide what to avoid in the video"
408
- })
409
- ], TextToVideoGeminiNode.prototype, "negative_prompt", void 0);
410
- export class ImageToVideoGeminiNode extends BaseNode {
411
- static nodeType = "gemini.video.ImageToVideo";
412
- static title = "Image To Video";
413
- static description = "Generate videos from images using Google's Veo models.\n google, video, generation, image-to-video, veo, ai, animation\n\n This node uses Google's Veo models to animate static images into dynamic videos.\n Supports 720p resolution at 24fps with 8-second duration and native audio generation.";
414
- static metadataOutputTypes = {
415
- output: "video"
416
- };
417
- static requiredSettings = ["GEMINI_API_KEY"];
418
- static exposeAsTool = true;
419
- static autoSaveAsset = true;
420
- async process() {
421
- const apiKey = getGeminiApiKey(this._secrets);
422
- const image = (this.image ?? {});
423
- const prompt = String(this.prompt ?? "Animate this image");
424
- const model = String(this.model ?? "veo-3.1-generate-preview");
425
- const aspectRatio = String(this.aspect_ratio ?? "16:9");
426
- const negativePrompt = String(this.negative_prompt ?? "");
427
- if (!isRefSet(image))
428
- throw new Error("Input image is required");
429
- const imageBytes = getImageBytes(image);
430
- if (!imageBytes)
431
- throw new Error("Image data is required");
432
- const config = {};
433
- if (aspectRatio)
434
- config.aspectRatio = aspectRatio;
435
- if (negativePrompt)
436
- config.negativePrompt = negativePrompt;
437
- const url = `${GEMINI_API_BASE}/models/${model}:generateVideos?key=${apiKey}`;
438
- const body = {
439
- prompt: prompt || "Animate this image",
440
- image: {
441
- imageBytes: Buffer.from(imageBytes).toString("base64"),
442
- mimeType: "image/png"
443
- }
444
- };
445
- if (Object.keys(config).length > 0)
446
- body.config = config;
447
- const res = await fetch(url, {
448
- method: "POST",
449
- headers: { "Content-Type": "application/json" },
450
- body: JSON.stringify(body)
451
- });
452
- if (!res.ok) {
453
- const errText = await res.text();
454
- throw new Error(`Gemini API error ${res.status}: ${errText}`);
455
- }
456
- const operation = (await res.json());
457
- const videoData = await pollVideoOperation(apiKey, operation);
458
- return { output: { type: "video", data: videoData } };
459
- }
460
- }
461
- __decorate([
462
- prop({
463
- type: "image",
464
- default: {
465
- type: "image",
466
- uri: "",
467
- asset_id: null,
468
- data: null,
469
- metadata: null
470
- },
471
- title: "Image",
472
- description: "The image to animate into a video"
473
- })
474
- ], ImageToVideoGeminiNode.prototype, "image", void 0);
475
- __decorate([
476
- prop({
477
- type: "str",
478
- default: "",
479
- title: "Prompt",
480
- description: "Optional text prompt describing the desired animation"
481
- })
482
- ], ImageToVideoGeminiNode.prototype, "prompt", void 0);
483
- __decorate([
484
- prop({
485
- type: "enum",
486
- default: "veo-3.1-generate-preview",
487
- title: "Model",
488
- description: "The Veo model to use for video generation",
489
- values: ["veo-3.1-generate-preview", "veo-2.0-generate-001"]
490
- })
491
- ], ImageToVideoGeminiNode.prototype, "model", void 0);
492
- __decorate([
493
- prop({
494
- type: "enum",
495
- default: "16:9",
496
- title: "Aspect Ratio",
497
- description: "The aspect ratio of the generated video",
498
- values: ["16:9", "9:16"]
499
- })
500
- ], ImageToVideoGeminiNode.prototype, "aspect_ratio", void 0);
501
- __decorate([
502
- prop({
503
- type: "str",
504
- default: "",
505
- title: "Negative Prompt",
506
- description: "Negative prompt to guide what to avoid in the video"
507
- })
508
- ], ImageToVideoGeminiNode.prototype, "negative_prompt", void 0);
509
- async function pollVideoOperation(apiKey, operation) {
510
- // If the operation already has the result, return it
511
- if (operation.done) {
512
- return extractVideoFromResponse(operation);
513
- }
514
- // Otherwise poll the operation
515
- const opName = operation.name;
516
- if (!opName)
517
- throw new Error("No operation name in response");
518
- const maxAttempts = 120; // 10 minutes at 5s intervals
519
- for (let i = 0; i < maxAttempts; i++) {
520
- await new Promise((resolve) => setTimeout(resolve, 5000));
521
- const pollUrl = `https://generativelanguage.googleapis.com/v1beta/${opName}?key=${apiKey}`;
522
- const pollRes = await fetch(pollUrl);
523
- if (!pollRes.ok) {
524
- const errText = await pollRes.text();
525
- throw new Error(`Gemini poll error ${pollRes.status}: ${errText}`);
526
- }
527
- const pollData = (await pollRes.json());
528
- if (pollData.done) {
529
- return extractVideoFromResponse(pollData);
530
- }
531
- }
532
- throw new Error("Video generation timed out");
533
- }
534
- function extractVideoFromResponse(data) {
535
- const response = (data.response ?? data);
536
- const generatedVideos = response.generatedVideos;
537
- if (!generatedVideos || generatedVideos.length === 0) {
538
- throw new Error("No video generated");
539
- }
540
- const video = generatedVideos[0].video;
541
- if (!video)
542
- throw new Error("No video in response");
543
- const videoBytes = video.videoBytes;
544
- if (!videoBytes)
545
- throw new Error("No video bytes in response");
546
- return videoBytes;
547
- }
548
- // ── Audio nodes ─────────────────────────────────────────────────────────────
549
- export class TextToSpeechGeminiNode extends BaseNode {
550
- static nodeType = "gemini.audio.TextToSpeech";
551
- static title = "Text To Speech";
552
- static description = "Generate speech audio from text using Google's Gemini text-to-speech models.\n google, text-to-speech, tts, audio, speech, voice, ai\n\n This node converts text input into natural-sounding speech audio using Google's\n advanced text-to-speech models with support for multiple voices and speech styles.\n\n Supported voices:\n - achernar, achird, algenib, algieba, alnilam\n - aoede, autonoe, callirrhoe, charon, despina\n - enceladus, erinome, fenrir, gacrux, iapetus\n - kore, laomedeia, leda, orus, puck\n - pulcherrima, rasalgethi, sadachbia, sadaltager, schedar\n - sulafat, umbriel, vindemiatrix, zephyr, zubenelgenubi\n\n Use cases:\n - Create voiceovers for videos and presentations\n - Generate audio content for podcasts and audiobooks\n - Add voice narration to applications\n - Create accessibility features with speech output\n - Generate multilingual audio content";
553
- static metadataOutputTypes = {
554
- output: "audio"
555
- };
556
- static requiredSettings = ["GEMINI_API_KEY"];
557
- static exposeAsTool = true;
558
- static autoSaveAsset = true;
559
- async process() {
560
- const apiKey = getGeminiApiKey(this._secrets);
561
- const text = String(this.text ?? "");
562
- const model = String(this.model ?? "gemini-2.5-pro-preview-tts");
563
- const stylePrompt = String(this.style_prompt ?? "");
564
- const VALID_VOICES = [
565
- "achernar", "achird", "algenib", "algieba", "alnilam",
566
- "aoede", "autonoe", "callirrhoe", "charon", "despina",
567
- "enceladus", "erinome", "fenrir", "gacrux", "iapetus",
568
- "kore", "laomedeia", "leda", "orus", "puck",
569
- "pulcherrima", "rasalgethi", "sadachbia", "sadaltager", "schedar",
570
- "sulafat", "umbriel", "vindemiatrix", "zephyr", "zubenelgenubi"
571
- ];
572
- const rawVoice = String(this.voice_name ?? "kore").toLowerCase();
573
- const voiceName = VALID_VOICES.includes(rawVoice) ? rawVoice : "kore";
574
- if (!text)
575
- throw new Error("The input text cannot be empty.");
576
- let content = text;
577
- if (stylePrompt) {
578
- content = `${stylePrompt}: ${text}`;
579
- }
580
- const url = `${GEMINI_API_BASE}/models/${model}:generateContent?key=${apiKey}`;
581
- const body = {
582
- contents: [{ parts: [{ text: content }] }],
583
- generationConfig: {
584
- responseModalities: ["AUDIO"],
585
- speechConfig: {
586
- voiceConfig: {
587
- prebuiltVoiceConfig: {
588
- voiceName: voiceName
589
- }
590
- }
591
- }
592
- }
593
- };
594
- const res = await fetch(url, {
595
- method: "POST",
596
- headers: { "Content-Type": "application/json" },
597
- body: JSON.stringify(body)
598
- });
599
- if (!res.ok) {
600
- const errText = await res.text();
601
- throw new Error(`Gemini API error ${res.status}: ${errText}`);
602
- }
603
- const data = (await res.json());
604
- const candidates = data.candidates;
605
- if (!candidates || candidates.length === 0) {
606
- throw new Error("No audio generated from the text-to-speech request");
607
- }
608
- const candidate = candidates[0];
609
- const contentObj = candidate.content;
610
- const parts = contentObj?.parts;
611
- if (!parts)
612
- throw new Error("No audio generated from the text-to-speech request");
613
- for (const part of parts) {
614
- const inlineData = part.inlineData ??
615
- part.inline_data;
616
- if (inlineData && typeof inlineData.data === "string") {
617
- // The API returns raw PCM audio at 24kHz, 16-bit mono
618
- // Encode as WAV for the audio ref
619
- const pcmBase64 = inlineData.data;
620
- const pcmBytes = Buffer.from(pcmBase64, "base64");
621
- const wavBytes = encodeWav(pcmBytes, 24000, 1, 16);
622
- return {
623
- output: {
624
- uri: "",
625
- data: Buffer.from(wavBytes).toString("base64")
626
- }
627
- };
628
- }
629
- }
630
- throw new Error("No audio data found in the response");
631
- }
632
- }
633
- __decorate([
634
- prop({
635
- type: "str",
636
- default: "",
637
- title: "Text",
638
- description: "The text to convert to speech."
639
- })
640
- ], TextToSpeechGeminiNode.prototype, "text", void 0);
641
- __decorate([
642
- prop({
643
- type: "enum",
644
- default: "gemini-2.5-pro-preview-tts",
645
- title: "Model",
646
- description: "The text-to-speech model to use",
647
- values: ["gemini-2.5-pro-preview-tts"]
648
- })
649
- ], TextToSpeechGeminiNode.prototype, "model", void 0);
650
- __decorate([
651
- prop({
652
- type: "enum",
653
- default: "kore",
654
- title: "Voice Name",
655
- description: "The voice to use for speech generation",
656
- values: [
657
- "achernar",
658
- "achird",
659
- "algenib",
660
- "algieba",
661
- "alnilam",
662
- "aoede",
663
- "autonoe",
664
- "callirrhoe",
665
- "charon",
666
- "despina",
667
- "enceladus",
668
- "erinome",
669
- "fenrir",
670
- "gacrux",
671
- "iapetus",
672
- "kore",
673
- "laomedeia",
674
- "leda",
675
- "orus",
676
- "puck",
677
- "pulcherrima",
678
- "rasalgethi",
679
- "sadachbia",
680
- "sadaltager",
681
- "schedar",
682
- "sulafat",
683
- "umbriel",
684
- "vindemiatrix",
685
- "zephyr",
686
- "zubenelgenubi"
687
- ]
688
- })
689
- ], TextToSpeechGeminiNode.prototype, "voice_name", void 0);
690
- __decorate([
691
- prop({
692
- type: "str",
693
- default: "",
694
- title: "Style Prompt",
695
- description: "Optional style prompt to control speech characteristics (e.g., 'Say cheerfully', 'Speak with excitement')"
696
- })
697
- ], TextToSpeechGeminiNode.prototype, "style_prompt", void 0);
698
- export class TranscribeGeminiNode extends BaseNode {
699
- static nodeType = "gemini.audio.Transcribe";
700
- static title = "Transcribe";
701
- static description = "Transcribe audio to text using Google's Gemini models.\n google, transcription, speech-to-text, audio, whisper, ai\n\n This node converts audio input into text using Google's multimodal Gemini models.\n Supports various audio formats and provides accurate speech-to-text transcription.\n\n Use cases:\n - Convert recorded audio to text\n - Transcribe podcasts and interviews\n - Generate subtitles from audio tracks\n - Create meeting notes from audio recordings\n - Analyze speech content in audio files";
702
- static metadataOutputTypes = {
703
- output: "str"
704
- };
705
- static requiredSettings = ["GEMINI_API_KEY"];
706
- static exposeAsTool = true;
707
- async process() {
708
- const apiKey = getGeminiApiKey(this._secrets);
709
- const audio = (this.audio ?? {});
710
- const model = String(this.model ?? "gemini-2.5-flash");
711
- const prompt = String(this.prompt ??
712
- this.prompt ??
713
- "Transcribe the following audio accurately. Return only the transcription text without any additional commentary.");
714
- if (!isRefSet(audio))
715
- throw new Error("Audio file is required for transcription");
716
- const audioBytes = getAudioBytes(audio);
717
- // Detect MIME type from first bytes (simple magic-number check)
718
- const mimeType = detectAudioMime(audioBytes);
719
- const url = `${GEMINI_API_BASE}/models/${model}:generateContent?key=${apiKey}`;
720
- const body = {
721
- contents: [
722
- {
723
- parts: [
724
- { text: prompt },
725
- {
726
- inline_data: {
727
- mime_type: mimeType,
728
- data: Buffer.from(audioBytes).toString("base64")
729
- }
730
- }
731
- ]
732
- }
733
- ],
734
- generationConfig: {
735
- responseModalities: ["TEXT"]
736
- }
737
- };
738
- const res = await fetch(url, {
739
- method: "POST",
740
- headers: { "Content-Type": "application/json" },
741
- body: JSON.stringify(body)
742
- });
743
- if (!res.ok) {
744
- const errText = await res.text();
745
- throw new Error(`Gemini API error ${res.status}: ${errText}`);
746
- }
747
- const data = (await res.json());
748
- const candidates = data.candidates;
749
- if (!candidates || candidates.length === 0) {
750
- throw new Error("No transcription generated from the audio");
751
- }
752
- const candidate = candidates[0];
753
- const content = candidate.content;
754
- const parts = content?.parts;
755
- if (!parts)
756
- throw new Error("No transcription generated from the audio");
757
- const transcriptionParts = [];
758
- for (const part of parts) {
759
- if (typeof part.text === "string") {
760
- transcriptionParts.push(part.text);
761
- }
762
- }
763
- return { output: transcriptionParts.join("") };
764
- }
765
- }
766
- __decorate([
767
- prop({
768
- type: "audio",
769
- default: {
770
- type: "audio",
771
- uri: "",
772
- asset_id: null,
773
- data: null,
774
- metadata: null
775
- },
776
- title: "Audio",
777
- description: "The audio file to transcribe."
778
- })
779
- ], TranscribeGeminiNode.prototype, "audio", void 0);
780
- __decorate([
781
- prop({
782
- type: "enum",
783
- default: "gemini-2.5-flash",
784
- title: "Model",
785
- description: "The Gemini model to use for transcription",
786
- values: ["gemini-2.5-flash", "gemini-2.0-flash"]
787
- })
788
- ], TranscribeGeminiNode.prototype, "model", void 0);
789
- __decorate([
790
- prop({
791
- type: "str",
792
- default: "Transcribe the following audio accurately. Return only the transcription text without any additional commentary.",
793
- title: "Prompt",
794
- description: "Instructions for the transcription. You can customize this to request specific formatting or focus."
795
- })
796
- ], TranscribeGeminiNode.prototype, "prompt", void 0);
797
- // ── Utility functions ───────────────────────────────────────────────────────
798
- function detectAudioMime(bytes) {
799
- if (bytes.length < 4)
800
- return "audio/mpeg";
801
- // WAV: RIFF header
802
- if (bytes[0] === 0x52 &&
803
- bytes[1] === 0x49 &&
804
- bytes[2] === 0x46 &&
805
- bytes[3] === 0x46) {
806
- return "audio/wav";
807
- }
808
- // FLAC
809
- if (bytes[0] === 0x66 &&
810
- bytes[1] === 0x4c &&
811
- bytes[2] === 0x61 &&
812
- bytes[3] === 0x43) {
813
- return "audio/flac";
814
- }
815
- // OGG
816
- if (bytes[0] === 0x4f &&
817
- bytes[1] === 0x67 &&
818
- bytes[2] === 0x67 &&
819
- bytes[3] === 0x53) {
820
- return "audio/ogg";
821
- }
822
- // MP3 frame sync or ID3 tag
823
- if ((bytes[0] === 0xff && (bytes[1] & 0xe0) === 0xe0) ||
824
- (bytes[0] === 0x49 && bytes[1] === 0x44 && bytes[2] === 0x33)) {
825
- return "audio/mpeg";
826
- }
827
- return "audio/mpeg";
828
- }
829
- function encodeWav(pcmData, sampleRate, channels, bitsPerSample) {
830
- const byteRate = (sampleRate * channels * bitsPerSample) / 8;
831
- const blockAlign = (channels * bitsPerSample) / 8;
832
- const dataSize = pcmData.length;
833
- const headerSize = 44;
834
- const buffer = new ArrayBuffer(headerSize + dataSize);
835
- const view = new DataView(buffer);
836
- const out = new Uint8Array(buffer);
837
- // RIFF header
838
- writeString(view, 0, "RIFF");
839
- view.setUint32(4, 36 + dataSize, true);
840
- writeString(view, 8, "WAVE");
841
- // fmt chunk
842
- writeString(view, 12, "fmt ");
843
- view.setUint32(16, 16, true); // chunk size
844
- view.setUint16(20, 1, true); // PCM format
845
- view.setUint16(22, channels, true);
846
- view.setUint32(24, sampleRate, true);
847
- view.setUint32(28, byteRate, true);
848
- view.setUint16(32, blockAlign, true);
849
- view.setUint16(34, bitsPerSample, true);
850
- // data chunk
851
- writeString(view, 36, "data");
852
- view.setUint32(40, dataSize, true);
853
- out.set(pcmData instanceof Buffer ? new Uint8Array(pcmData) : pcmData, headerSize);
854
- return out;
855
- }
856
- function writeString(view, offset, str) {
857
- for (let i = 0; i < str.length; i++) {
858
- view.setUint8(offset + i, str.charCodeAt(i));
859
- }
860
- }
861
- // ── Exports ─────────────────────────────────────────────────────────────────
862
- export const GEMINI_NODES = [
863
- GroundedSearchNode,
864
- EmbeddingNode,
865
- ImageGenerationNode,
866
- TextToVideoGeminiNode,
867
- ImageToVideoGeminiNode,
868
- TextToSpeechGeminiNode,
869
- TranscribeGeminiNode
870
- ];
871
- //# sourceMappingURL=gemini.js.map