@bubblelab/bubble-core 0.1.10 → 0.1.12

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 (350) hide show
  1. package/dist/bubble-bundle.d.ts +803 -351
  2. package/dist/bubble-factory.d.ts.map +1 -1
  3. package/dist/bubble-factory.js +130 -35
  4. package/dist/bubble-factory.js.map +1 -1
  5. package/dist/bubble-flow/bubble-flow-class.d.ts +5 -0
  6. package/dist/bubble-flow/bubble-flow-class.d.ts.map +1 -1
  7. package/dist/bubble-flow/bubble-flow-class.js +20 -0
  8. package/dist/bubble-flow/bubble-flow-class.js.map +1 -1
  9. package/dist/bubble-flow/sample/simplified-data-analysis.flow.d.ts.map +1 -1
  10. package/dist/bubble-flow/sample/simplified-data-analysis.flow.js +6 -3
  11. package/dist/bubble-flow/sample/simplified-data-analysis.flow.js.map +1 -1
  12. package/dist/bubbles/service-bubble/agi-inc.d.ts +1121 -0
  13. package/dist/bubbles/service-bubble/agi-inc.d.ts.map +1 -0
  14. package/dist/bubbles/service-bubble/agi-inc.js +730 -0
  15. package/dist/bubbles/service-bubble/agi-inc.js.map +1 -0
  16. package/dist/bubbles/service-bubble/ai-agent.d.ts +273 -61
  17. package/dist/bubbles/service-bubble/ai-agent.d.ts.map +1 -1
  18. package/dist/bubbles/service-bubble/ai-agent.js +536 -405
  19. package/dist/bubbles/service-bubble/ai-agent.js.map +1 -1
  20. package/dist/bubbles/service-bubble/airtable.d.ts +1753 -0
  21. package/dist/bubbles/service-bubble/airtable.d.ts.map +1 -0
  22. package/dist/bubbles/service-bubble/airtable.js +1173 -0
  23. package/dist/bubbles/service-bubble/airtable.js.map +1 -0
  24. package/dist/bubbles/service-bubble/apify/actors/google-maps-scraper.d.ts +240 -0
  25. package/dist/bubbles/service-bubble/apify/actors/google-maps-scraper.d.ts.map +1 -0
  26. package/dist/bubbles/service-bubble/apify/actors/google-maps-scraper.js +119 -0
  27. package/dist/bubbles/service-bubble/apify/actors/google-maps-scraper.js.map +1 -0
  28. package/dist/bubbles/service-bubble/apify/actors/instagram-hashtag-scraper.d.ts +4 -4
  29. package/dist/bubbles/service-bubble/apify/actors/instagram-scraper.d.ts +14 -14
  30. package/dist/bubbles/service-bubble/apify/actors/linkedin-jobs-scraper.d.ts +137 -0
  31. package/dist/bubbles/service-bubble/apify/actors/linkedin-jobs-scraper.d.ts.map +1 -0
  32. package/dist/bubbles/service-bubble/apify/actors/linkedin-jobs-scraper.js +81 -0
  33. package/dist/bubbles/service-bubble/apify/actors/linkedin-jobs-scraper.js.map +1 -0
  34. package/dist/bubbles/service-bubble/apify/actors/linkedin-posts-search.d.ts +6 -6
  35. package/dist/bubbles/service-bubble/apify/actors/linkedin-profile-posts.d.ts +32 -32
  36. package/dist/bubbles/service-bubble/apify/actors/tiktok-scraper.d.ts +488 -0
  37. package/dist/bubbles/service-bubble/apify/actors/tiktok-scraper.d.ts.map +1 -0
  38. package/dist/bubbles/service-bubble/apify/actors/tiktok-scraper.js +463 -0
  39. package/dist/bubbles/service-bubble/apify/actors/tiktok-scraper.js.map +1 -0
  40. package/dist/bubbles/service-bubble/apify/actors/twitter-scraper.d.ts +262 -0
  41. package/dist/bubbles/service-bubble/apify/actors/twitter-scraper.d.ts.map +1 -0
  42. package/dist/bubbles/service-bubble/apify/actors/twitter-scraper.js +291 -0
  43. package/dist/bubbles/service-bubble/apify/actors/twitter-scraper.js.map +1 -0
  44. package/dist/bubbles/service-bubble/apify/actors/youtube-scraper.d.ts +12 -12
  45. package/dist/bubbles/service-bubble/apify/apify-scraper.schema.d.ts +1301 -170
  46. package/dist/bubbles/service-bubble/apify/apify-scraper.schema.d.ts.map +1 -1
  47. package/dist/bubbles/service-bubble/apify/apify-scraper.schema.js +32 -0
  48. package/dist/bubbles/service-bubble/apify/apify-scraper.schema.js.map +1 -1
  49. package/dist/bubbles/service-bubble/apify/apify.d.ts +158 -13
  50. package/dist/bubbles/service-bubble/apify/apify.d.ts.map +1 -1
  51. package/dist/bubbles/service-bubble/apify/apify.js +222 -37
  52. package/dist/bubbles/service-bubble/apify/apify.js.map +1 -1
  53. package/dist/bubbles/service-bubble/browserbase/browserbase.d.ts +542 -0
  54. package/dist/bubbles/service-bubble/browserbase/browserbase.d.ts.map +1 -0
  55. package/dist/bubbles/service-bubble/browserbase/browserbase.integration.flow.d.ts +37 -0
  56. package/dist/bubbles/service-bubble/browserbase/browserbase.integration.flow.d.ts.map +1 -0
  57. package/dist/bubbles/service-bubble/browserbase/browserbase.integration.flow.js +203 -0
  58. package/dist/bubbles/service-bubble/browserbase/browserbase.integration.flow.js.map +1 -0
  59. package/dist/bubbles/service-bubble/browserbase/browserbase.js +593 -0
  60. package/dist/bubbles/service-bubble/browserbase/browserbase.js.map +1 -0
  61. package/dist/bubbles/service-bubble/browserbase/browserbase.schema.d.ts +518 -0
  62. package/dist/bubbles/service-bubble/browserbase/browserbase.schema.d.ts.map +1 -0
  63. package/dist/bubbles/service-bubble/browserbase/browserbase.schema.js +311 -0
  64. package/dist/bubbles/service-bubble/browserbase/browserbase.schema.js.map +1 -0
  65. package/dist/bubbles/service-bubble/browserbase/index.d.ts +3 -0
  66. package/dist/bubbles/service-bubble/browserbase/index.d.ts.map +1 -0
  67. package/dist/bubbles/service-bubble/browserbase/index.js +3 -0
  68. package/dist/bubbles/service-bubble/browserbase/index.js.map +1 -0
  69. package/dist/bubbles/service-bubble/crustdata/crustdata.d.ts +1358 -0
  70. package/dist/bubbles/service-bubble/crustdata/crustdata.d.ts.map +1 -0
  71. package/dist/bubbles/service-bubble/crustdata/crustdata.js +219 -0
  72. package/dist/bubbles/service-bubble/crustdata/crustdata.js.map +1 -0
  73. package/dist/bubbles/service-bubble/crustdata/crustdata.schema.d.ts +1604 -0
  74. package/dist/bubbles/service-bubble/crustdata/crustdata.schema.d.ts.map +1 -0
  75. package/dist/bubbles/service-bubble/crustdata/crustdata.schema.js +194 -0
  76. package/dist/bubbles/service-bubble/crustdata/crustdata.schema.js.map +1 -0
  77. package/dist/bubbles/service-bubble/crustdata/index.d.ts +3 -0
  78. package/dist/bubbles/service-bubble/crustdata/index.d.ts.map +1 -0
  79. package/dist/bubbles/service-bubble/crustdata/index.js +3 -0
  80. package/dist/bubbles/service-bubble/crustdata/index.js.map +1 -0
  81. package/dist/bubbles/service-bubble/eleven-labs.d.ts +421 -0
  82. package/dist/bubbles/service-bubble/eleven-labs.d.ts.map +1 -0
  83. package/dist/bubbles/service-bubble/eleven-labs.js +479 -0
  84. package/dist/bubbles/service-bubble/eleven-labs.js.map +1 -0
  85. package/dist/bubbles/service-bubble/firecrawl.d.ts +37748 -0
  86. package/dist/bubbles/service-bubble/firecrawl.d.ts.map +1 -0
  87. package/dist/bubbles/service-bubble/firecrawl.js +1489 -0
  88. package/dist/bubbles/service-bubble/firecrawl.js.map +1 -0
  89. package/dist/bubbles/service-bubble/followupboss.d.ts +6822 -0
  90. package/dist/bubbles/service-bubble/followupboss.d.ts.map +1 -0
  91. package/dist/bubbles/service-bubble/followupboss.js +1394 -0
  92. package/dist/bubbles/service-bubble/followupboss.js.map +1 -0
  93. package/dist/bubbles/service-bubble/github.d.ts +2393 -0
  94. package/dist/bubbles/service-bubble/github.d.ts.map +1 -0
  95. package/dist/bubbles/service-bubble/github.js +1046 -0
  96. package/dist/bubbles/service-bubble/github.js.map +1 -0
  97. package/dist/bubbles/service-bubble/gmail.d.ts +180 -180
  98. package/dist/bubbles/service-bubble/google-calendar.d.ts +60 -60
  99. package/dist/bubbles/service-bubble/google-drive.d.ts +69 -68
  100. package/dist/bubbles/service-bubble/google-drive.d.ts.map +1 -1
  101. package/dist/bubbles/service-bubble/google-drive.js +35 -3
  102. package/dist/bubbles/service-bubble/google-drive.js.map +1 -1
  103. package/dist/bubbles/service-bubble/google-sheets/google-sheets.d.ts +943 -0
  104. package/dist/bubbles/service-bubble/google-sheets/google-sheets.d.ts.map +1 -0
  105. package/dist/bubbles/service-bubble/google-sheets/google-sheets.integration.flow.d.ts +31 -0
  106. package/dist/bubbles/service-bubble/google-sheets/google-sheets.integration.flow.d.ts.map +1 -0
  107. package/dist/bubbles/service-bubble/google-sheets/google-sheets.integration.flow.js +184 -0
  108. package/dist/bubbles/service-bubble/google-sheets/google-sheets.integration.flow.js.map +1 -0
  109. package/dist/bubbles/service-bubble/google-sheets/google-sheets.js +401 -0
  110. package/dist/bubbles/service-bubble/google-sheets/google-sheets.js.map +1 -0
  111. package/dist/bubbles/service-bubble/google-sheets/google-sheets.schema.d.ts +1024 -0
  112. package/dist/bubbles/service-bubble/google-sheets/google-sheets.schema.d.ts.map +1 -0
  113. package/dist/bubbles/service-bubble/{google-sheets.js → google-sheets/google-sheets.schema.js} +45 -409
  114. package/dist/bubbles/service-bubble/google-sheets/google-sheets.schema.js.map +1 -0
  115. package/dist/bubbles/service-bubble/google-sheets/google-sheets.utils.d.ts +38 -0
  116. package/dist/bubbles/service-bubble/google-sheets/google-sheets.utils.d.ts.map +1 -0
  117. package/dist/bubbles/service-bubble/google-sheets/google-sheets.utils.js +183 -0
  118. package/dist/bubbles/service-bubble/google-sheets/google-sheets.utils.js.map +1 -0
  119. package/dist/bubbles/service-bubble/google-sheets/index.d.ts +4 -0
  120. package/dist/bubbles/service-bubble/google-sheets/index.d.ts.map +1 -0
  121. package/dist/bubbles/service-bubble/google-sheets/index.js +4 -0
  122. package/dist/bubbles/service-bubble/google-sheets/index.js.map +1 -0
  123. package/dist/bubbles/service-bubble/hello-world.d.ts +4 -4
  124. package/dist/bubbles/service-bubble/http.d.ts +17 -5
  125. package/dist/bubbles/service-bubble/http.d.ts.map +1 -1
  126. package/dist/bubbles/service-bubble/http.integration.flow.d.ts +49 -0
  127. package/dist/bubbles/service-bubble/http.integration.flow.d.ts.map +1 -0
  128. package/dist/bubbles/service-bubble/http.integration.flow.js +425 -0
  129. package/dist/bubbles/service-bubble/http.integration.flow.js.map +1 -0
  130. package/dist/bubbles/service-bubble/http.js +47 -5
  131. package/dist/bubbles/service-bubble/http.js.map +1 -1
  132. package/dist/bubbles/service-bubble/insforge-db.d.ts +140 -0
  133. package/dist/bubbles/service-bubble/insforge-db.d.ts.map +1 -0
  134. package/dist/bubbles/service-bubble/insforge-db.js +260 -0
  135. package/dist/bubbles/service-bubble/insforge-db.js.map +1 -0
  136. package/dist/bubbles/service-bubble/notion/index.d.ts +3 -0
  137. package/dist/bubbles/service-bubble/notion/index.d.ts.map +1 -0
  138. package/dist/bubbles/service-bubble/notion/index.js +3 -0
  139. package/dist/bubbles/service-bubble/notion/index.js.map +1 -0
  140. package/dist/bubbles/service-bubble/notion/notion.d.ts +35405 -0
  141. package/dist/bubbles/service-bubble/notion/notion.d.ts.map +1 -0
  142. package/dist/bubbles/service-bubble/notion/notion.js +1492 -0
  143. package/dist/bubbles/service-bubble/notion/notion.js.map +1 -0
  144. package/dist/bubbles/service-bubble/notion/property-schemas.d.ts +1148 -0
  145. package/dist/bubbles/service-bubble/notion/property-schemas.d.ts.map +1 -0
  146. package/dist/bubbles/service-bubble/notion/property-schemas.js +341 -0
  147. package/dist/bubbles/service-bubble/notion/property-schemas.js.map +1 -0
  148. package/dist/bubbles/service-bubble/postgresql.d.ts +12 -12
  149. package/dist/bubbles/service-bubble/resend.d.ts +30 -9
  150. package/dist/bubbles/service-bubble/resend.d.ts.map +1 -1
  151. package/dist/bubbles/service-bubble/resend.js +133 -2
  152. package/dist/bubbles/service-bubble/resend.js.map +1 -1
  153. package/dist/bubbles/service-bubble/slack.d.ts +1741 -798
  154. package/dist/bubbles/service-bubble/slack.d.ts.map +1 -1
  155. package/dist/bubbles/service-bubble/slack.js +322 -28
  156. package/dist/bubbles/service-bubble/slack.js.map +1 -1
  157. package/dist/bubbles/service-bubble/storage.d.ts +26 -22
  158. package/dist/bubbles/service-bubble/storage.d.ts.map +1 -1
  159. package/dist/bubbles/service-bubble/storage.js +45 -4
  160. package/dist/bubbles/service-bubble/storage.js.map +1 -1
  161. package/dist/bubbles/service-bubble/telegram.d.ts +7742 -0
  162. package/dist/bubbles/service-bubble/telegram.d.ts.map +1 -0
  163. package/dist/bubbles/service-bubble/telegram.js +1132 -0
  164. package/dist/bubbles/service-bubble/telegram.js.map +1 -0
  165. package/dist/bubbles/tool-bubble/amazon-shopping-tool/amazon-shopping-tool.d.ts +494 -0
  166. package/dist/bubbles/tool-bubble/amazon-shopping-tool/amazon-shopping-tool.d.ts.map +1 -0
  167. package/dist/bubbles/tool-bubble/amazon-shopping-tool/amazon-shopping-tool.integration.flow.d.ts +31 -0
  168. package/dist/bubbles/tool-bubble/amazon-shopping-tool/amazon-shopping-tool.integration.flow.d.ts.map +1 -0
  169. package/dist/bubbles/tool-bubble/amazon-shopping-tool/amazon-shopping-tool.integration.flow.js +100 -0
  170. package/dist/bubbles/tool-bubble/amazon-shopping-tool/amazon-shopping-tool.integration.flow.js.map +1 -0
  171. package/dist/bubbles/tool-bubble/amazon-shopping-tool/amazon-shopping-tool.js +1301 -0
  172. package/dist/bubbles/tool-bubble/amazon-shopping-tool/amazon-shopping-tool.js.map +1 -0
  173. package/dist/bubbles/tool-bubble/amazon-shopping-tool/amazon-shopping-tool.schema.d.ts +473 -0
  174. package/dist/bubbles/tool-bubble/amazon-shopping-tool/amazon-shopping-tool.schema.d.ts.map +1 -0
  175. package/dist/bubbles/tool-bubble/amazon-shopping-tool/amazon-shopping-tool.schema.js +230 -0
  176. package/dist/bubbles/tool-bubble/amazon-shopping-tool/amazon-shopping-tool.schema.js.map +1 -0
  177. package/dist/bubbles/tool-bubble/amazon-shopping-tool/index.d.ts +3 -0
  178. package/dist/bubbles/tool-bubble/amazon-shopping-tool/index.d.ts.map +1 -0
  179. package/dist/bubbles/tool-bubble/amazon-shopping-tool/index.js +3 -0
  180. package/dist/bubbles/tool-bubble/amazon-shopping-tool/index.js.map +1 -0
  181. package/dist/bubbles/tool-bubble/bubbleflow-validation-tool.d.ts +76 -20
  182. package/dist/bubbles/tool-bubble/bubbleflow-validation-tool.d.ts.map +1 -1
  183. package/dist/bubbles/tool-bubble/bubbleflow-validation-tool.js +12 -0
  184. package/dist/bubbles/tool-bubble/bubbleflow-validation-tool.js.map +1 -1
  185. package/dist/bubbles/tool-bubble/chart-js-tool.d.ts +14 -14
  186. package/dist/bubbles/tool-bubble/code-edit-tool.d.ts +188 -0
  187. package/dist/bubbles/tool-bubble/code-edit-tool.d.ts.map +1 -0
  188. package/dist/bubbles/tool-bubble/code-edit-tool.js +321 -0
  189. package/dist/bubbles/tool-bubble/code-edit-tool.js.map +1 -0
  190. package/dist/bubbles/tool-bubble/company-enrichment-tool.d.ts +740 -0
  191. package/dist/bubbles/tool-bubble/company-enrichment-tool.d.ts.map +1 -0
  192. package/dist/bubbles/tool-bubble/company-enrichment-tool.js +350 -0
  193. package/dist/bubbles/tool-bubble/company-enrichment-tool.js.map +1 -0
  194. package/dist/bubbles/tool-bubble/get-bubble-details-tool.d.ts +8 -4
  195. package/dist/bubbles/tool-bubble/get-bubble-details-tool.d.ts.map +1 -1
  196. package/dist/bubbles/tool-bubble/get-bubble-details-tool.js +115 -10
  197. package/dist/bubbles/tool-bubble/get-bubble-details-tool.js.map +1 -1
  198. package/dist/bubbles/tool-bubble/google-maps-tool.d.ts +455 -0
  199. package/dist/bubbles/tool-bubble/google-maps-tool.d.ts.map +1 -0
  200. package/dist/bubbles/tool-bubble/google-maps-tool.js +206 -0
  201. package/dist/bubbles/tool-bubble/google-maps-tool.js.map +1 -0
  202. package/dist/bubbles/tool-bubble/instagram-tool.d.ts +36 -36
  203. package/dist/bubbles/tool-bubble/instagram-tool.d.ts.map +1 -1
  204. package/dist/bubbles/tool-bubble/instagram-tool.js +4 -2
  205. package/dist/bubbles/tool-bubble/instagram-tool.js.map +1 -1
  206. package/dist/bubbles/tool-bubble/linkedin-tool.d.ts +830 -453
  207. package/dist/bubbles/tool-bubble/linkedin-tool.d.ts.map +1 -1
  208. package/dist/bubbles/tool-bubble/linkedin-tool.js +236 -14
  209. package/dist/bubbles/tool-bubble/linkedin-tool.js.map +1 -1
  210. package/dist/bubbles/tool-bubble/list-bubbles-tool.d.ts +4 -4
  211. package/dist/bubbles/tool-bubble/reddit-scrape-tool.d.ts +66 -66
  212. package/dist/bubbles/tool-bubble/research-agent-tool.d.ts +17 -16
  213. package/dist/bubbles/tool-bubble/research-agent-tool.d.ts.map +1 -1
  214. package/dist/bubbles/tool-bubble/research-agent-tool.js +32 -17
  215. package/dist/bubbles/tool-bubble/research-agent-tool.js.map +1 -1
  216. package/dist/bubbles/tool-bubble/sql-query-tool.d.ts +8 -8
  217. package/dist/bubbles/tool-bubble/tiktok-tool.d.ts +485 -0
  218. package/dist/bubbles/tool-bubble/tiktok-tool.d.ts.map +1 -0
  219. package/dist/bubbles/tool-bubble/tiktok-tool.js +226 -0
  220. package/dist/bubbles/tool-bubble/tiktok-tool.js.map +1 -0
  221. package/dist/bubbles/tool-bubble/tool-template.d.ts +8 -8
  222. package/dist/bubbles/tool-bubble/twitter-tool.d.ts +947 -0
  223. package/dist/bubbles/tool-bubble/twitter-tool.d.ts.map +1 -0
  224. package/dist/bubbles/tool-bubble/twitter-tool.js +497 -0
  225. package/dist/bubbles/tool-bubble/twitter-tool.js.map +1 -0
  226. package/dist/bubbles/tool-bubble/web-crawl-tool.d.ts +22 -16
  227. package/dist/bubbles/tool-bubble/web-crawl-tool.d.ts.map +1 -1
  228. package/dist/bubbles/tool-bubble/web-crawl-tool.js +58 -59
  229. package/dist/bubbles/tool-bubble/web-crawl-tool.js.map +1 -1
  230. package/dist/bubbles/tool-bubble/web-extract-tool.d.ts +8 -8
  231. package/dist/bubbles/tool-bubble/web-extract-tool.d.ts.map +1 -1
  232. package/dist/bubbles/tool-bubble/web-extract-tool.js +17 -17
  233. package/dist/bubbles/tool-bubble/web-extract-tool.js.map +1 -1
  234. package/dist/bubbles/tool-bubble/web-scrape-tool.d.ts +21 -113
  235. package/dist/bubbles/tool-bubble/web-scrape-tool.d.ts.map +1 -1
  236. package/dist/bubbles/tool-bubble/web-scrape-tool.js +55 -73
  237. package/dist/bubbles/tool-bubble/web-scrape-tool.js.map +1 -1
  238. package/dist/bubbles/tool-bubble/web-search-tool.d.ts +20 -9
  239. package/dist/bubbles/tool-bubble/web-search-tool.d.ts.map +1 -1
  240. package/dist/bubbles/tool-bubble/web-search-tool.js +45 -35
  241. package/dist/bubbles/tool-bubble/web-search-tool.js.map +1 -1
  242. package/dist/bubbles/tool-bubble/youtube-tool.d.ts +25 -25
  243. package/dist/bubbles/tool-bubble/youtube-tool.d.ts.map +1 -1
  244. package/dist/bubbles/tool-bubble/youtube-tool.js +8 -5
  245. package/dist/bubbles/tool-bubble/youtube-tool.js.map +1 -1
  246. package/dist/bubbles/workflow-bubble/database-analyzer.workflow.d.ts +4 -4
  247. package/dist/bubbles/workflow-bubble/generate-document.workflow.d.ts +30 -30
  248. package/dist/bubbles/workflow-bubble/generate-document.workflow.js +1 -1
  249. package/dist/bubbles/workflow-bubble/parse-document.workflow.d.ts +22 -22
  250. package/dist/bubbles/workflow-bubble/parse-document.workflow.js +1 -1
  251. package/dist/bubbles/workflow-bubble/pdf-form-operations.workflow.d.ts +70 -70
  252. package/dist/bubbles/workflow-bubble/pdf-form-operations.workflow.d.ts.map +1 -1
  253. package/dist/bubbles/workflow-bubble/pdf-form-operations.workflow.js +4 -4
  254. package/dist/bubbles/workflow-bubble/pdf-form-operations.workflow.js.map +1 -1
  255. package/dist/bubbles/workflow-bubble/pdf-ocr.workflow.d.ts +36 -36
  256. package/dist/bubbles/workflow-bubble/pdf-ocr.workflow.js +1 -1
  257. package/dist/bubbles/workflow-bubble/slack-data-assistant.workflow.d.ts +14 -14
  258. package/dist/bubbles/workflow-bubble/slack-data-assistant.workflow.d.ts.map +1 -1
  259. package/dist/bubbles/workflow-bubble/slack-data-assistant.workflow.js +6 -6
  260. package/dist/bubbles/workflow-bubble/slack-data-assistant.workflow.js.map +1 -1
  261. package/dist/bubbles/workflow-bubble/slack-formatter-agent.d.ts +18 -18
  262. package/dist/bubbles/workflow-bubble/slack-formatter-agent.d.ts.map +1 -1
  263. package/dist/bubbles/workflow-bubble/slack-formatter-agent.js +24 -4
  264. package/dist/bubbles/workflow-bubble/slack-formatter-agent.js.map +1 -1
  265. package/dist/bubbles/workflow-bubble/slack-notifier.workflow.d.ts +19 -19
  266. package/dist/bubbles/workflow-bubble/slack-notifier.workflow.d.ts.map +1 -1
  267. package/dist/bubbles/workflow-bubble/slack-notifier.workflow.js +8 -8
  268. package/dist/bubbles/workflow-bubble/slack-notifier.workflow.js.map +1 -1
  269. package/dist/bubbles.json +260 -77
  270. package/dist/index.d.ts +25 -4
  271. package/dist/index.d.ts.map +1 -1
  272. package/dist/index.js +18 -3
  273. package/dist/index.js.map +1 -1
  274. package/dist/logging/BubbleLogger.d.ts +55 -16
  275. package/dist/logging/BubbleLogger.d.ts.map +1 -1
  276. package/dist/logging/BubbleLogger.js +192 -77
  277. package/dist/logging/BubbleLogger.js.map +1 -1
  278. package/dist/logging/StreamingBubbleLogger.d.ts +21 -1
  279. package/dist/logging/StreamingBubbleLogger.d.ts.map +1 -1
  280. package/dist/logging/StreamingBubbleLogger.js +80 -8
  281. package/dist/logging/StreamingBubbleLogger.js.map +1 -1
  282. package/dist/logging/WebhookStreamLogger.d.ts +66 -0
  283. package/dist/logging/WebhookStreamLogger.d.ts.map +1 -0
  284. package/dist/logging/WebhookStreamLogger.js +291 -0
  285. package/dist/logging/WebhookStreamLogger.js.map +1 -0
  286. package/dist/types/available-tools.d.ts +1 -1
  287. package/dist/types/available-tools.d.ts.map +1 -1
  288. package/dist/types/available-tools.js +7 -0
  289. package/dist/types/available-tools.js.map +1 -1
  290. package/dist/types/base-bubble-class.d.ts +6 -4
  291. package/dist/types/base-bubble-class.d.ts.map +1 -1
  292. package/dist/types/base-bubble-class.js +30 -23
  293. package/dist/types/base-bubble-class.js.map +1 -1
  294. package/dist/types/bubble.d.ts +2 -0
  295. package/dist/types/bubble.d.ts.map +1 -1
  296. package/dist/types/service-bubble-class.d.ts +1 -1
  297. package/dist/types/service-bubble-class.d.ts.map +1 -1
  298. package/dist/types/service-bubble-class.js +2 -2
  299. package/dist/types/service-bubble-class.js.map +1 -1
  300. package/dist/types/tool-bubble-class.d.ts +1 -1
  301. package/dist/types/tool-bubble-class.d.ts.map +1 -1
  302. package/dist/types/tool-bubble-class.js +60 -10
  303. package/dist/types/tool-bubble-class.js.map +1 -1
  304. package/dist/types/workflow-bubble-class.d.ts +1 -1
  305. package/dist/types/workflow-bubble-class.d.ts.map +1 -1
  306. package/dist/types/workflow-bubble-class.js +2 -2
  307. package/dist/types/workflow-bubble-class.js.map +1 -1
  308. package/dist/utils/agent-formatter.d.ts +14 -2
  309. package/dist/utils/agent-formatter.d.ts.map +1 -1
  310. package/dist/utils/agent-formatter.js +174 -26
  311. package/dist/utils/agent-formatter.js.map +1 -1
  312. package/dist/utils/bubbleflow-validation.d.ts +7 -0
  313. package/dist/utils/bubbleflow-validation.d.ts.map +1 -1
  314. package/dist/utils/bubbleflow-validation.js +171 -6
  315. package/dist/utils/bubbleflow-validation.js.map +1 -1
  316. package/dist/utils/json-parsing.d.ts.map +1 -1
  317. package/dist/utils/json-parsing.js +146 -0
  318. package/dist/utils/json-parsing.js.map +1 -1
  319. package/dist/utils/safe-gemini-chat.d.ts +31 -0
  320. package/dist/utils/safe-gemini-chat.d.ts.map +1 -0
  321. package/dist/utils/safe-gemini-chat.js +93 -0
  322. package/dist/utils/safe-gemini-chat.js.map +1 -0
  323. package/dist/utils/schema-comparison.d.ts +92 -0
  324. package/dist/utils/schema-comparison.d.ts.map +1 -0
  325. package/dist/utils/schema-comparison.js +716 -0
  326. package/dist/utils/schema-comparison.js.map +1 -0
  327. package/dist/utils/zod-schema.d.ts +24 -0
  328. package/dist/utils/zod-schema.d.ts.map +1 -0
  329. package/dist/utils/zod-schema.js +56 -0
  330. package/dist/utils/zod-schema.js.map +1 -0
  331. package/package.json +6 -4
  332. package/dist/bubbles/service-bubble/google-sheets.d.ts +0 -1811
  333. package/dist/bubbles/service-bubble/google-sheets.d.ts.map +0 -1
  334. package/dist/bubbles/service-bubble/google-sheets.js.map +0 -1
  335. package/dist/bubbles/service-bubble/x-twitter.d.ts +0 -814
  336. package/dist/bubbles/service-bubble/x-twitter.d.ts.map +0 -1
  337. package/dist/bubbles/service-bubble/x-twitter.js +0 -445
  338. package/dist/bubbles/service-bubble/x-twitter.js.map +0 -1
  339. package/dist/bubbles/workflow-bubble/bubbleflow-generator.workflow.d.ts +0 -125
  340. package/dist/bubbles/workflow-bubble/bubbleflow-generator.workflow.d.ts.map +0 -1
  341. package/dist/bubbles/workflow-bubble/bubbleflow-generator.workflow.js +0 -808
  342. package/dist/bubbles/workflow-bubble/bubbleflow-generator.workflow.js.map +0 -1
  343. package/dist/test-gm.d.ts +0 -10
  344. package/dist/test-gm.d.ts.map +0 -1
  345. package/dist/test-gm.js +0 -95
  346. package/dist/test-gm.js.map +0 -1
  347. package/dist/utils/param-helper.d.ts +0 -2
  348. package/dist/utils/param-helper.d.ts.map +0 -1
  349. package/dist/utils/param-helper.js +0 -5
  350. package/dist/utils/param-helper.js.map +0 -1
@@ -0,0 +1,1489 @@
1
+ import { z } from 'zod';
2
+ import { ServiceBubble } from '../../types/service-bubble-class.js';
3
+ import { CredentialType } from '@bubblelab/shared-schemas';
4
+ import { Firecrawl } from '@mendable/firecrawl-js';
5
+ // Define the schema for Firecrawl document metadata
6
+ const FirecrawlDocumentMetadataSchema = z
7
+ .object({
8
+ title: z.string().optional().describe('Title of the document'),
9
+ description: z.string().optional().describe('Description of the document'),
10
+ url: z.string().url().optional().describe('URL of the document'),
11
+ language: z
12
+ .union([z.string(), z.array(z.string())])
13
+ .optional()
14
+ .describe('Language of the document'),
15
+ keywords: z
16
+ .union([z.string(), z.array(z.string())])
17
+ .optional()
18
+ .describe('Keywords associated with the document'),
19
+ robots: z
20
+ .union([z.string(), z.array(z.string())])
21
+ .optional()
22
+ .describe('Robots meta tag content'),
23
+ ogTitle: z.string().optional().describe('Open Graph title'),
24
+ ogDescription: z.string().optional().describe('Open Graph description'),
25
+ ogUrl: z.string().optional().describe('Open Graph URL'),
26
+ ogImage: z.string().optional().describe('Open Graph image URL'),
27
+ ogAudio: z.string().optional().describe('Open Graph audio URL'),
28
+ ogDeterminer: z.string().optional().describe('Open Graph determiner'),
29
+ ogLocale: z.string().optional().describe('Open Graph locale'),
30
+ ogLocaleAlternate: z
31
+ .array(z.string())
32
+ .optional()
33
+ .describe('Alternate Open Graph locales'),
34
+ ogSiteName: z.string().optional().describe('Open Graph site name'),
35
+ ogVideo: z.string().optional().describe('Open Graph video URL'),
36
+ favicon: z.string().optional().describe('Favicon URL'),
37
+ dcTermsCreated: z.string().optional().describe('Dublin Core terms created'),
38
+ dcDateCreated: z.string().optional().describe('Dublin Core date created'),
39
+ dcDate: z.string().optional().describe('Dublin Core date'),
40
+ dcTermsType: z.string().optional().describe('Dublin Core terms type'),
41
+ dcType: z.string().optional().describe('Dublin Core type'),
42
+ dcTermsAudience: z
43
+ .string()
44
+ .optional()
45
+ .describe('Dublin Core terms audience'),
46
+ dcTermsSubject: z.string().optional().describe('Dublin Core terms subject'),
47
+ dcSubject: z.string().optional().describe('Dublin Core subject'),
48
+ dcDescription: z.string().optional().describe('Dublin Core description'),
49
+ dcTermsKeywords: z
50
+ .string()
51
+ .optional()
52
+ .describe('Dublin Core terms keywords'),
53
+ modifiedTime: z.string().optional().describe('Last modified time'),
54
+ publishedTime: z.string().optional().describe('Published time'),
55
+ articleTag: z.string().optional().describe('Article tag'),
56
+ articleSection: z.string().optional().describe('Article section'),
57
+ sourceURL: z.string().url().optional().describe('Source URL'),
58
+ statusCode: z.number().optional().describe('HTTP status code'),
59
+ scrapeId: z.string().optional().describe('Scrape identifier'),
60
+ numPages: z.number().optional().describe('Number of pages scraped'),
61
+ contentType: z.string().optional().describe('Content type of the document'),
62
+ proxyUsed: z
63
+ .enum(['basic', 'stealth'])
64
+ .optional()
65
+ .describe('Type of proxy used'),
66
+ cacheState: z.enum(['hit', 'miss']).optional().describe('Cache state'),
67
+ cachedAt: z.string().optional().describe('Cache timestamp'),
68
+ creditsUsed: z.number().optional().describe('Number of credits used'),
69
+ error: z.string().optional().describe('Error message if any'),
70
+ })
71
+ .catchall(z.unknown());
72
+ // Define the schema for Firecrawl branding profile
73
+ const FirecrawlBrandingProfileSchema = z
74
+ .object({
75
+ colorScheme: z
76
+ .enum(['light', 'dark'])
77
+ .optional()
78
+ .describe('The detected color scheme ("light" or "dark")'),
79
+ logo: z
80
+ .string()
81
+ .url()
82
+ .nullable()
83
+ .optional()
84
+ .describe('URL of the primary logo'),
85
+ fonts: z
86
+ .array(z
87
+ .object({
88
+ family: z.string().describe('Font family name'),
89
+ })
90
+ .catchall(z.unknown()))
91
+ .optional()
92
+ .describe('Array of font families used on the page'),
93
+ colors: z
94
+ .object({
95
+ primary: z.string().optional().describe('Primary brand color'),
96
+ secondary: z.string().optional().describe('Secondary brand color'),
97
+ accent: z.string().optional().describe('Accent brand color'),
98
+ background: z.string().optional().describe('UI Background color'),
99
+ textPrimary: z.string().optional().describe('UI Primary text color'),
100
+ textSecondary: z
101
+ .string()
102
+ .optional()
103
+ .describe('UI Secondary text color'),
104
+ link: z.string().optional().describe('Semantic Link color'),
105
+ success: z.string().optional().describe('Semantic Success color'),
106
+ warning: z.string().optional().describe('Semantic Warning color'),
107
+ error: z.string().optional().describe('Semantic Error color'),
108
+ })
109
+ .catchall(z.union([z.string(), z.undefined()]))
110
+ .optional()
111
+ .describe('Object containing brand colors'),
112
+ typography: z
113
+ .object({
114
+ fontFamilies: z
115
+ .object({
116
+ primary: z.string().optional().describe('Primary font family'),
117
+ heading: z.string().optional().describe('Heading font family'),
118
+ code: z.string().optional().describe('Code font family'),
119
+ })
120
+ .catchall(z.union([z.string(), z.undefined()]))
121
+ .optional()
122
+ .describe('Primary, heading, and code font families'),
123
+ fontStacks: z
124
+ .object({
125
+ primary: z
126
+ .array(z.string())
127
+ .optional()
128
+ .describe('Primary font stack array'),
129
+ heading: z
130
+ .array(z.string())
131
+ .optional()
132
+ .describe('Heading font stack array'),
133
+ body: z
134
+ .array(z.string())
135
+ .optional()
136
+ .describe('Body font stack array'),
137
+ paragraph: z
138
+ .array(z.string())
139
+ .optional()
140
+ .describe('Paragraph font stack array'),
141
+ })
142
+ .catchall(z.union([z.array(z.string()), z.undefined()]))
143
+ .optional()
144
+ .describe('Font stack arrays for primary, heading, body, and paragraph'),
145
+ fontSizes: z
146
+ .object({
147
+ h1: z.string().optional().describe('H1 font size'),
148
+ h2: z.string().optional().describe('H2 font size'),
149
+ h3: z.string().optional().describe('H3 font size'),
150
+ body: z.string().optional().describe('Body font size'),
151
+ small: z.string().optional().describe('Small text font size'),
152
+ })
153
+ .catchall(z.union([z.string(), z.undefined()]))
154
+ .optional()
155
+ .describe('Size definitions for headings and body text'),
156
+ lineHeights: z
157
+ .object({
158
+ heading: z.number().optional().describe('Heading line height'),
159
+ body: z.number().optional().describe('Body text line height'),
160
+ })
161
+ .catchall(z.union([z.number(), z.undefined()]))
162
+ .optional()
163
+ .describe('Line height values for different text types'),
164
+ fontWeights: z
165
+ .object({
166
+ light: z.number().optional().describe('Light font weight'),
167
+ regular: z.number().optional().describe('Regular font weight'),
168
+ medium: z.number().optional().describe('Medium font weight'),
169
+ bold: z.number().optional().describe('Bold font weight'),
170
+ })
171
+ .catchall(z.union([z.number(), z.undefined()]))
172
+ .optional()
173
+ .describe('Weight definitions (light, regular, medium, bold)'),
174
+ })
175
+ .optional()
176
+ .describe('Detailed typography information'),
177
+ spacing: z
178
+ .object({
179
+ baseUnit: z.number().optional().describe('Base spacing unit in pixels'),
180
+ padding: z
181
+ .record(z.number())
182
+ .optional()
183
+ .describe('Padding spacing values'),
184
+ margins: z
185
+ .record(z.number())
186
+ .optional()
187
+ .describe('Margin spacing values'),
188
+ gridGutter: z
189
+ .number()
190
+ .optional()
191
+ .describe('Grid gutter size in pixels'),
192
+ borderRadius: z.string().optional().describe('Default border radius'),
193
+ })
194
+ .catchall(z.union([
195
+ z.number(),
196
+ z.string(),
197
+ z.record(z.union([z.number(), z.string()])),
198
+ z.undefined(),
199
+ ]))
200
+ .optional()
201
+ .describe('Spacing and layout information'),
202
+ components: z
203
+ .object({
204
+ buttonPrimary: z
205
+ .object({
206
+ background: z
207
+ .string()
208
+ .optional()
209
+ .describe('Button background color'),
210
+ textColor: z.string().optional().describe('Button text color'),
211
+ borderColor: z.string().optional().describe('Button border color'),
212
+ borderRadius: z
213
+ .string()
214
+ .optional()
215
+ .describe('Button border radius'),
216
+ })
217
+ .catchall(z.union([z.string(), z.undefined()]))
218
+ .optional()
219
+ .describe('Primary button styles'),
220
+ buttonSecondary: z
221
+ .object({
222
+ background: z
223
+ .string()
224
+ .optional()
225
+ .describe('Button background color'),
226
+ textColor: z.string().optional().describe('Button text color'),
227
+ borderColor: z.string().optional().describe('Button border color'),
228
+ borderRadius: z
229
+ .string()
230
+ .optional()
231
+ .describe('Button border radius'),
232
+ })
233
+ .catchall(z.union([z.string(), z.undefined()]))
234
+ .optional()
235
+ .describe('Secondary button styles'),
236
+ input: z
237
+ .object({
238
+ borderColor: z.string().optional().describe('Input border color'),
239
+ focusBorderColor: z
240
+ .string()
241
+ .optional()
242
+ .describe('Input focus border color'),
243
+ borderRadius: z.string().optional().describe('Input border radius'),
244
+ })
245
+ .catchall(z.union([z.string(), z.undefined()]))
246
+ .optional()
247
+ .describe('Input field styles'),
248
+ })
249
+ .catchall(z.unknown())
250
+ .optional()
251
+ .describe('UI component styles'),
252
+ icons: z
253
+ .object({
254
+ style: z.string().optional().describe('Icon style'),
255
+ primaryColor: z.string().optional().describe('Primary icon color'),
256
+ })
257
+ .catchall(z.union([z.string(), z.undefined()]))
258
+ .optional()
259
+ .describe('Icon style information'),
260
+ images: z
261
+ .object({
262
+ logo: z.string().url().nullable().optional().describe('Logo image URL'),
263
+ favicon: z
264
+ .string()
265
+ .url()
266
+ .nullable()
267
+ .optional()
268
+ .describe('Favicon image URL'),
269
+ ogImage: z
270
+ .string()
271
+ .url()
272
+ .nullable()
273
+ .optional()
274
+ .describe('Open Graph image URL'),
275
+ })
276
+ .catchall(z.union([z.string(), z.null(), z.undefined()]))
277
+ .optional()
278
+ .describe('Brand images (logo, favicon, og:image)'),
279
+ animations: z
280
+ .object({
281
+ transitionDuration: z
282
+ .string()
283
+ .optional()
284
+ .describe('Transition duration for animations'),
285
+ easing: z
286
+ .string()
287
+ .optional()
288
+ .describe('Easing function for animations'),
289
+ })
290
+ .catchall(z.unknown())
291
+ .optional()
292
+ .describe('Animation and transition settings'),
293
+ layout: z
294
+ .object({
295
+ grid: z
296
+ .object({
297
+ columns: z.number().optional().describe('Number of grid columns'),
298
+ maxWidth: z.string().optional().describe('Maximum grid width'),
299
+ })
300
+ .catchall(z.union([z.number(), z.string(), z.undefined()]))
301
+ .optional()
302
+ .describe('Grid layout configuration'),
303
+ headerHeight: z.string().optional().describe('Header height'),
304
+ footerHeight: z.string().optional().describe('Footer height'),
305
+ })
306
+ .catchall(z.union([
307
+ z.number(),
308
+ z.string(),
309
+ z.record(z.union([z.number(), z.string(), z.undefined()])),
310
+ z.undefined(),
311
+ ]))
312
+ .optional()
313
+ .describe('Layout configuration (grid, header/footer heights)'),
314
+ tone: z
315
+ .object({
316
+ voice: z.string().optional().describe('Brand voice tone'),
317
+ emojiUsage: z.string().optional().describe('Emoji usage style'),
318
+ })
319
+ .catchall(z.union([z.string(), z.undefined()]))
320
+ .optional()
321
+ .describe('Tone and voice characteristics'),
322
+ personality: z
323
+ .object({
324
+ tone: z
325
+ .enum([
326
+ 'professional',
327
+ 'playful',
328
+ 'modern',
329
+ 'traditional',
330
+ 'minimalist',
331
+ 'bold',
332
+ ])
333
+ .describe('Brand tone'),
334
+ energy: z
335
+ .enum(['low', 'medium', 'high'])
336
+ .describe('Brand energy level'),
337
+ targetAudience: z
338
+ .string()
339
+ .describe('Description of the target audience'),
340
+ })
341
+ .optional()
342
+ .describe('Brand personality traits (tone, energy, target audience)'),
343
+ })
344
+ .catchall(z.unknown());
345
+ // Define the schema for Firecrawl documents
346
+ const FirecrawlDocumentSchema = z.object({
347
+ markdown: z
348
+ .string()
349
+ .describe('Document content in markdown format')
350
+ .optional(),
351
+ html: z.string().describe('Document content in HTML format').optional(),
352
+ rawHtml: z
353
+ .string()
354
+ .describe('Document content in raw HTML format')
355
+ .optional(),
356
+ json: z
357
+ .unknown()
358
+ .describe('Document content in structured JSON format')
359
+ .optional(),
360
+ summary: z.string().describe('Summary of the document content').optional(),
361
+ metadata: FirecrawlDocumentMetadataSchema.describe('Metadata associated with the document').optional(),
362
+ links: z
363
+ .array(z.string().url())
364
+ .describe('Array of links found in the document')
365
+ .optional(),
366
+ images: z
367
+ .array(z.string().url())
368
+ .describe('Array of image URLs found in the document')
369
+ .optional(),
370
+ screenshot: z
371
+ .string()
372
+ .describe('Base64-encoded screenshot of the document')
373
+ .optional(),
374
+ attributes: z
375
+ .array(z.object({
376
+ selector: z.string().describe('CSS selector for the element'),
377
+ attribute: z.string().describe('Attribute name to extract'),
378
+ values: z.array(z.string()).describe('Extracted attribute values'),
379
+ }))
380
+ .describe('Array of extracted attributes from the document')
381
+ .optional(),
382
+ actions: z
383
+ .record(z.unknown())
384
+ .describe('Record of actions performed on the document')
385
+ .optional(),
386
+ warning: z.string().describe('Warning message if any').optional(),
387
+ changeTracking: z
388
+ .record(z.unknown())
389
+ .describe('Change tracking information for the document')
390
+ .optional(),
391
+ branding: FirecrawlBrandingProfileSchema.describe('Branding profile associated with the document').optional(),
392
+ });
393
+ // Define the schema for Firecrawl scrape option FormatString
394
+ const FirecrawlScrapeOptionsFormatStringSchema = z.enum([
395
+ 'markdown',
396
+ 'html',
397
+ 'rawHtml',
398
+ 'links',
399
+ 'images',
400
+ 'screenshot',
401
+ 'summary',
402
+ 'changeTracking',
403
+ 'json',
404
+ 'attributes',
405
+ 'branding',
406
+ ]);
407
+ // Define the schema for Firecrawl scrape options
408
+ const FirecrawlScrapeOptionsSchema = z.object({
409
+ formats: z
410
+ .array(z.union([
411
+ FirecrawlScrapeOptionsFormatStringSchema.describe('Scrape format'),
412
+ z.object({
413
+ type: FirecrawlScrapeOptionsFormatStringSchema.describe('Scrape format'),
414
+ }),
415
+ z.object({
416
+ type: z.literal('json'),
417
+ prompt: z
418
+ .string()
419
+ .optional()
420
+ .describe('Optional prompt for JSON extraction'),
421
+ schema: z
422
+ .union([z.record(z.unknown()), z.any()])
423
+ .optional()
424
+ .describe('Optional JSON schema for structured data extraction'),
425
+ }),
426
+ z.object({
427
+ type: z.literal('changeTracking'),
428
+ modes: z
429
+ .array(z.enum(['git-diff', 'json']))
430
+ .describe('Modes for change tracking'),
431
+ schema: z
432
+ .record(z.unknown())
433
+ .optional()
434
+ .describe('Optional schema for change tracking'),
435
+ prompt: z
436
+ .string()
437
+ .optional()
438
+ .describe('Optional prompt for change tracking'),
439
+ tag: z
440
+ .string()
441
+ .optional()
442
+ .describe('Optional tag for change tracking'),
443
+ }),
444
+ z.object({
445
+ type: z.literal('screenshot'),
446
+ fullPage: z
447
+ .boolean()
448
+ .optional()
449
+ .describe('Whether to capture full page screenshot'),
450
+ quality: z
451
+ .number()
452
+ .optional()
453
+ .describe('Quality of the screenshot (1-100)'),
454
+ viewport: z
455
+ .object({
456
+ width: z.number().describe('Viewport width in pixels'),
457
+ height: z.number().describe('Viewport height in pixels'),
458
+ })
459
+ .optional()
460
+ .describe('Viewport dimensions for the screenshot'),
461
+ }),
462
+ z.object({
463
+ type: z.literal('attributes'),
464
+ selectors: z
465
+ .array(z.object({
466
+ selector: z.string().describe('CSS selector for the element'),
467
+ attribute: z.string().describe('Attribute name to extract'),
468
+ }))
469
+ .describe('Array of selectors and attributes to extract'),
470
+ }),
471
+ ]))
472
+ .default(['markdown'])
473
+ .describe('Formats to scrape from the URL'),
474
+ headers: z
475
+ .record(z.string())
476
+ .optional()
477
+ .describe('HTTP headers to include in the request'),
478
+ includeTags: z
479
+ .array(z.string())
480
+ .optional()
481
+ .describe('HTML tags/classes/ids to include in the scrape'),
482
+ excludeTags: z
483
+ .array(z.string())
484
+ .optional()
485
+ .describe('HTML tags/classes/ids to exclude from the scrape'),
486
+ onlyMainContent: z
487
+ .boolean()
488
+ .default(true)
489
+ .describe('Whether to extract only main content or full page content'),
490
+ timeout: z
491
+ .number()
492
+ .default(30000)
493
+ .describe('Max duration in milliseconds before aborting the request'),
494
+ waitFor: z
495
+ .number()
496
+ .default(0)
497
+ .describe('Milliseconds of extra wait time before scraping (use sparingly). This waiting time is in addition to Firecrawl’s smart wait feature.'),
498
+ mobile: z.boolean().optional().describe('Whether to emulate a mobile device'),
499
+ parsers: z
500
+ .array(z.union([
501
+ z.string(),
502
+ z.object({
503
+ type: z.literal('pdf'),
504
+ maxPages: z
505
+ .number()
506
+ .optional()
507
+ .describe('Maximum number of PDF pages to parse'),
508
+ }),
509
+ ]))
510
+ .optional()
511
+ .describe('Extract structured content from various document formats'),
512
+ actions: z
513
+ .array(z.union([
514
+ z.object({
515
+ type: z.literal('wait'),
516
+ milliseconds: z
517
+ .number()
518
+ .optional()
519
+ .describe('Time to wait in milliseconds (for wait)'),
520
+ selector: z
521
+ .string()
522
+ .optional()
523
+ .describe('CSS selector to wait for (for wait)'),
524
+ }),
525
+ z.object({
526
+ type: z.literal('screenshot'),
527
+ fullPage: z
528
+ .boolean()
529
+ .optional()
530
+ .describe('Whether to capture full page screenshot'),
531
+ quality: z
532
+ .number()
533
+ .optional()
534
+ .describe('Quality of the screenshot (1-100)'),
535
+ viewport: z
536
+ .object({
537
+ width: z.number().describe('Viewport width in pixels'),
538
+ height: z.number().describe('Viewport height in pixels'),
539
+ })
540
+ .optional()
541
+ .describe('Viewport dimensions for the screenshot'),
542
+ }),
543
+ z.object({
544
+ type: z.literal('click'),
545
+ selector: z.string().describe('CSS selector to click on'),
546
+ }),
547
+ z.object({
548
+ type: z.literal('write'),
549
+ text: z.string().describe('Text to write into the element'),
550
+ }),
551
+ z.object({
552
+ type: z.literal('press'),
553
+ key: z.string().describe('Key to press (e.g., "Enter")'),
554
+ }),
555
+ z.object({
556
+ type: z.literal('scroll'),
557
+ direction: z
558
+ .enum(['up', 'down'])
559
+ .describe('Scroll direction (for scroll)'),
560
+ selector: z
561
+ .string()
562
+ .optional()
563
+ .describe('CSS selector to scroll to (for scroll)'),
564
+ }),
565
+ z.object({
566
+ type: z.literal('scrape'),
567
+ }),
568
+ z.object({
569
+ type: z.literal('executeJavascript'),
570
+ script: z.string().describe('JavaScript code to execute on the page'),
571
+ }),
572
+ z.object({
573
+ type: z.literal('pdf'),
574
+ format: z
575
+ .enum([
576
+ 'A0',
577
+ 'A1',
578
+ 'A2',
579
+ 'A3',
580
+ 'A4',
581
+ 'A5',
582
+ 'A6',
583
+ 'Letter',
584
+ 'Legal',
585
+ 'Tabloid',
586
+ 'Ledger',
587
+ ])
588
+ .optional()
589
+ .describe('Page format for PDF generation'),
590
+ landscape: z
591
+ .boolean()
592
+ .optional()
593
+ .describe('Whether to generate PDF in landscape orientation'),
594
+ scale: z
595
+ .number()
596
+ .optional()
597
+ .describe('Scale factor for PDF rendering'),
598
+ }),
599
+ ]))
600
+ .optional()
601
+ .describe('Sequence of browser actions to perform before scraping'),
602
+ location: z
603
+ .object({
604
+ country: z
605
+ .string()
606
+ .optional()
607
+ .describe('Country code for proxy location'),
608
+ languages: z
609
+ .array(z.string())
610
+ .optional()
611
+ .describe('Preferred languages for proxy location'),
612
+ })
613
+ .optional()
614
+ .describe('Location configuration for proxy location'),
615
+ skipTlsVerification: z
616
+ .boolean()
617
+ .optional()
618
+ .describe('Whether to skip TLS certificate verification'),
619
+ removeBase64Images: z
620
+ .boolean()
621
+ .optional()
622
+ .describe('Whether to remove base64-encoded images from the content'),
623
+ fastMode: z
624
+ .boolean()
625
+ .optional()
626
+ .describe('Whether to enable fast mode for scraping'),
627
+ useMock: z
628
+ .string()
629
+ .optional()
630
+ .describe('Use a mock response for testing purposes'),
631
+ blockAds: z
632
+ .boolean()
633
+ .optional()
634
+ .describe('Whether to block ads during scraping'),
635
+ proxy: z
636
+ .union([z.enum(['basic', 'stealth', 'auto']), z.string()])
637
+ .optional()
638
+ .describe('Type of proxy to use for scraping'),
639
+ maxAge: z
640
+ .number()
641
+ .default(172800000)
642
+ .describe('If a cached version of the page is newer than `maxAge` (in milliseconds), Firecrawl returns it instantly; otherwise it scrapes fresh and updates the cache. Set 0 to always fetch fresh.'),
643
+ storeInCache: z
644
+ .boolean()
645
+ .optional()
646
+ .describe('Whether to store the scraped result in cache'),
647
+ integration: z
648
+ .string()
649
+ .optional()
650
+ .describe('Integration identifier for the scrape request'),
651
+ });
652
+ // Define the base shared parameters schema for Firecrawl operations
653
+ const FirecrawlParamsBaseSchema = z.object({
654
+ maxRetries: z
655
+ .number()
656
+ .optional()
657
+ .describe('Maximum number of retries for the scrape request'),
658
+ backoffFactor: z
659
+ .number()
660
+ .optional()
661
+ .describe('Backoff factor for retry delays'),
662
+ credentials: z
663
+ .record(z.nativeEnum(CredentialType), z.string())
664
+ .optional()
665
+ .describe('Object mapping credential types to values (injected at runtime)'),
666
+ });
667
+ // Define the parameters schema for Firecrawl operations
668
+ const FirecrawlParamsSchema = z.discriminatedUnion('operation', [
669
+ // Scrape operation
670
+ FirecrawlParamsBaseSchema.merge(FirecrawlScrapeOptionsSchema).extend({
671
+ operation: z.literal('scrape').describe('Scrape a single URL'),
672
+ url: z
673
+ .string()
674
+ .url('Must be a valid URL')
675
+ .describe('The URL to scrape content from'),
676
+ }),
677
+ // Search operation
678
+ FirecrawlParamsBaseSchema.extend({
679
+ operation: z
680
+ .literal('search')
681
+ .describe('Search the web and optionally scrape each result'),
682
+ query: z.string().describe('The search query to execute'),
683
+ sources: z
684
+ .array(z.union([
685
+ z.enum(['web', 'news', 'images']),
686
+ z.object({
687
+ type: z.enum(['web', 'news', 'images']),
688
+ }),
689
+ ]))
690
+ .optional()
691
+ .describe('Specialized result types to include in addition to regular web results'),
692
+ categories: z
693
+ .array(z.union([
694
+ z.enum(['github', 'research', 'pdf']),
695
+ z.object({
696
+ type: z.enum(['github', 'research', 'pdf']),
697
+ }),
698
+ ]))
699
+ .optional()
700
+ .describe('Filter search results by specific categories'),
701
+ limit: z
702
+ .number()
703
+ .min(1)
704
+ .optional()
705
+ .describe('Maximum number of search results to return'),
706
+ tbs: z
707
+ .string()
708
+ .optional()
709
+ .describe('Filter results by time (e.g., "qdr:h" for past hour, "qdr:m" for past month)'),
710
+ location: z
711
+ .string()
712
+ .optional()
713
+ .describe('Geographical location to tailor search results'),
714
+ ignoreInvalidURLs: z
715
+ .boolean()
716
+ .optional()
717
+ .describe('Whether to ignore invalid URLs in the search results'),
718
+ timeout: z
719
+ .number()
720
+ .optional()
721
+ .describe('Timeout in milliseconds for the search operation'),
722
+ scrapeOptions: FirecrawlScrapeOptionsSchema.optional().describe('Scrape options to apply to each search result'),
723
+ integration: z
724
+ .string()
725
+ .optional()
726
+ .describe('Integration identifier for the search request'),
727
+ }),
728
+ // Map operation
729
+ FirecrawlParamsBaseSchema.extend({
730
+ operation: z.literal('map').describe('Map a site to discover URLs'),
731
+ url: z
732
+ .string()
733
+ .url('Must be a valid URL')
734
+ .describe('The base URL of the site to map'),
735
+ search: z
736
+ .string()
737
+ .optional()
738
+ .describe('Search for specific urls inside a website'),
739
+ sitemap: z
740
+ .enum(['only', 'include', 'skip'])
741
+ .optional()
742
+ .describe('Sitemap handling strategy'),
743
+ includeSubdomains: z
744
+ .boolean()
745
+ .optional()
746
+ .describe('Whether to include subdomains in the site map'),
747
+ limit: z.number().optional().describe('Maximum number of URLs to discover'),
748
+ timeout: z
749
+ .number()
750
+ .optional()
751
+ .describe('Timeout in milliseconds for the mapping operation'),
752
+ integration: z
753
+ .string()
754
+ .optional()
755
+ .describe('Integration identifier for the map request'),
756
+ location: z
757
+ .object({
758
+ country: z
759
+ .string()
760
+ .optional()
761
+ .describe('Country code for proxy location'),
762
+ languages: z
763
+ .array(z.string())
764
+ .optional()
765
+ .describe('Preferred languages for proxy location'),
766
+ })
767
+ .optional()
768
+ .describe('Location configuration for proxy location'),
769
+ }),
770
+ // Crawl operation
771
+ FirecrawlParamsBaseSchema.extend({
772
+ operation: z
773
+ .literal('crawl')
774
+ .describe('Recursively search through a urls subdomains, and gather the content'),
775
+ url: z.string().url('Must be a valid URL').describe('The URL to crawl'),
776
+ prompt: z
777
+ .string()
778
+ .optional()
779
+ .describe('Optional prompt to guide the crawl behavior'),
780
+ excludePaths: z
781
+ .array(z.string())
782
+ .optional()
783
+ .describe('List of URL paths to exclude from the crawl'),
784
+ includePaths: z
785
+ .array(z.string())
786
+ .optional()
787
+ .describe('List of URL paths to include in the crawl'),
788
+ maxDiscoveryDepth: z
789
+ .number()
790
+ .optional()
791
+ .describe('Maximum depth for link discovery during the crawl'),
792
+ sitemap: z
793
+ .enum(['skip', 'include'])
794
+ .optional()
795
+ .describe('Sitemap handling strategy during the crawl'),
796
+ ignoreQueryParameters: z
797
+ .boolean()
798
+ .optional()
799
+ .describe('Whether to ignore query parameters when crawling URLs'),
800
+ limit: z.number().optional().describe('Maximum number of pages to crawl'),
801
+ crawlEntireDomain: z
802
+ .boolean()
803
+ .optional()
804
+ .describe('Whether to crawl the entire domain including subdomains'),
805
+ allowExternalLinks: z
806
+ .boolean()
807
+ .optional()
808
+ .describe('Whether to allow crawling external links'),
809
+ allowSubdomains: z
810
+ .boolean()
811
+ .optional()
812
+ .describe('Whether to include subdomains in the crawl'),
813
+ delay: z
814
+ .number()
815
+ .optional()
816
+ .describe('Delay in milliseconds between requests during the crawl'),
817
+ maxConcurrency: z
818
+ .number()
819
+ .optional()
820
+ .describe('Maximum number of concurrent requests during the crawl'),
821
+ webhook: z
822
+ .union([
823
+ z.string().url().describe('Webhook URL to send crawl results to'),
824
+ z.object({
825
+ url: z
826
+ .string()
827
+ .url()
828
+ .describe('Webhook URL to send crawl results to'),
829
+ headers: z
830
+ .record(z.string())
831
+ .optional()
832
+ .describe('HTTP headers to include in the webhook request'),
833
+ metadata: z
834
+ .record(z.string())
835
+ .optional()
836
+ .describe('Additional metadata to include in the webhook payload'),
837
+ events: z
838
+ .array(z.enum(['completed', 'failed', 'page', 'started']))
839
+ .optional()
840
+ .describe('Events that trigger the webhook'),
841
+ }),
842
+ ])
843
+ .optional()
844
+ .describe('Webhook configuration for crawl events'),
845
+ scrapeOptions: FirecrawlScrapeOptionsSchema.optional().describe('Scrape options to apply to each crawled page'),
846
+ zeroDataRetention: z
847
+ .boolean()
848
+ .optional()
849
+ .describe('Whether to retain zero data from the crawl'),
850
+ integration: z
851
+ .string()
852
+ .optional()
853
+ .describe('Integration identifier for the crawl request'),
854
+ pollInterval: z
855
+ .number()
856
+ .optional()
857
+ .describe('Interval in milliseconds to poll for crawl status'),
858
+ timeout: z
859
+ .number()
860
+ .optional()
861
+ .describe('Timeout in milliseconds for the crawl operation'),
862
+ }),
863
+ // Extract operation
864
+ FirecrawlParamsBaseSchema.extend({
865
+ operation: z
866
+ .literal('extract')
867
+ .describe('Extract structured data from a URL'),
868
+ urls: z
869
+ .array(z.string().url('Must be a valid URL'))
870
+ .describe('Array of URLs to extract data from'),
871
+ prompt: z
872
+ .string()
873
+ .optional()
874
+ .describe('Optional prompt to guide the extraction process'),
875
+ schema: z
876
+ .union([z.record(z.unknown()), z.any()])
877
+ .optional()
878
+ .describe('Optional schema to structure the extracted data'),
879
+ systemPrompt: z
880
+ .string()
881
+ .optional()
882
+ .describe('Optional system prompt for the extraction AI agent'),
883
+ allowExternalLinks: z
884
+ .boolean()
885
+ .optional()
886
+ .describe('Whether to allow extraction from external links found on the page'),
887
+ enableWebSearch: z
888
+ .boolean()
889
+ .optional()
890
+ .describe('Whether to enable web search to supplement extraction'),
891
+ showSources: z
892
+ .boolean()
893
+ .optional()
894
+ .describe('Whether to include source URLs in the extraction results'),
895
+ scrapeOptions: FirecrawlScrapeOptionsSchema.optional().describe('Optional scrape options to apply to the extraction process'),
896
+ ignoreInvalidURLs: z
897
+ .boolean()
898
+ .optional()
899
+ .describe('Whether to ignore invalid URLs in the input list'),
900
+ integration: z
901
+ .string()
902
+ .optional()
903
+ .describe('Integration identifier for the extraction process'),
904
+ agent: z
905
+ .object({
906
+ model: z.literal('FIRE-1').describe('AI model to use for extraction'),
907
+ })
908
+ .optional()
909
+ .describe('Agent to use for the extraction process'),
910
+ pollInterval: z
911
+ .number()
912
+ .optional()
913
+ .describe('Interval in milliseconds to poll for extraction status'),
914
+ timeout: z
915
+ .number()
916
+ .optional()
917
+ .describe('Timeout in milliseconds for the extraction operation'),
918
+ }),
919
+ ]);
920
+ // Define the base shared result schema for Firecrawl operations
921
+ const FirecrawlResultBaseSchema = z.object({
922
+ success: z.boolean().describe('Whether the operation succeeded'),
923
+ error: z.string().describe('Error message if operation failed'),
924
+ });
925
+ // Define result schema for Firecrawl operations
926
+ const FirecrawlResultSchema = z.discriminatedUnion('operation', [
927
+ // Scrape operation
928
+ FirecrawlResultBaseSchema.merge(FirecrawlDocumentSchema).extend({
929
+ operation: z.literal('scrape').describe('Scrape a single URL'),
930
+ }),
931
+ // Search operation
932
+ FirecrawlResultBaseSchema.extend({
933
+ operation: z
934
+ .literal('search')
935
+ .describe('Search the web and optionally scrape each result'),
936
+ web: z
937
+ .array(z.union([
938
+ z.object({
939
+ url: z.string().url().describe('Result URL'),
940
+ title: z.string().optional().describe('Result title'),
941
+ description: z.string().optional().describe('Result description'),
942
+ category: z.string().optional().describe('Result category'),
943
+ }),
944
+ FirecrawlDocumentSchema,
945
+ ]))
946
+ .optional()
947
+ .describe('Web search results'),
948
+ news: z
949
+ .array(z.union([
950
+ z.object({
951
+ title: z.string().optional().describe('Result title'),
952
+ url: z.string().url().optional().describe('Result URL'),
953
+ snippet: z.string().optional().describe('Result snippet'),
954
+ date: z.string().optional().describe('Result date'),
955
+ imageUrl: z.string().url().optional().describe('Result image URL'),
956
+ position: z.number().optional().describe('Result position'),
957
+ category: z.string().optional().describe('Result category'),
958
+ }),
959
+ FirecrawlDocumentSchema,
960
+ ]))
961
+ .optional()
962
+ .describe('News search results'),
963
+ images: z
964
+ .array(z.union([
965
+ z.object({
966
+ title: z.string().optional().describe('Result title'),
967
+ imageUrl: z.string().url().optional().describe('Result image URL'),
968
+ imageWidth: z
969
+ .number()
970
+ .optional()
971
+ .describe('Result image width in pixels'),
972
+ imageHeight: z
973
+ .number()
974
+ .optional()
975
+ .describe('Result image height in pixels'),
976
+ url: z.string().url().optional().describe('Result URL'),
977
+ position: z.number().optional().describe('Result position'),
978
+ }),
979
+ FirecrawlDocumentSchema,
980
+ ]))
981
+ .optional()
982
+ .describe('Image search results'),
983
+ other: z
984
+ .array(z.unknown())
985
+ .optional()
986
+ .describe('Unknown mystery search results'),
987
+ }),
988
+ // Map operation
989
+ FirecrawlResultBaseSchema.extend({
990
+ operation: z.literal('map').describe('Map a site to discover URLs'),
991
+ links: z
992
+ .array(z.object({
993
+ url: z.string().url().describe('Discovered URL'),
994
+ title: z.string().optional().describe('Page title'),
995
+ description: z.string().optional().describe('Page description'),
996
+ category: z.string().optional().describe('URL category'),
997
+ }))
998
+ .describe('Discovered links'),
999
+ }),
1000
+ // Crawl operation
1001
+ FirecrawlResultBaseSchema.extend({
1002
+ operation: z
1003
+ .literal('crawl')
1004
+ .describe('Recursively search through a urls subdomains, and gather the content'),
1005
+ status: z
1006
+ .enum(['scraping', 'completed', 'failed', 'cancelled'])
1007
+ .describe('Status of the crawl job'),
1008
+ total: z.number().describe('Total number of pages to crawl'),
1009
+ completed: z.number().describe('Number of pages crawled'),
1010
+ creditsUsed: z.number().optional().describe('Number of credits used'),
1011
+ expiresAt: z
1012
+ .string()
1013
+ .optional()
1014
+ .describe('Expiration time of the crawl job'),
1015
+ // next: z
1016
+ // .string()
1017
+ // .url()
1018
+ // .nullable()
1019
+ // .optional()
1020
+ // .describe('URL to fetch the next batch of crawl results'),
1021
+ data: z.array(FirecrawlDocumentSchema).describe('Crawled documents'),
1022
+ }),
1023
+ // Extract operation
1024
+ FirecrawlResultBaseSchema.extend({
1025
+ operation: z
1026
+ .literal('extract')
1027
+ .describe('Extract structured data from a URL'),
1028
+ id: z.string().optional().describe('Extraction job identifier'),
1029
+ status: z
1030
+ .enum(['processing', 'completed', 'failed', 'cancelled'])
1031
+ .optional()
1032
+ .describe('Status of the extraction job'),
1033
+ data: z.unknown().optional().describe('Extracted structured data'),
1034
+ warning: z.string().optional().describe('Warning message if any'),
1035
+ sources: z.record(z.unknown()).optional().describe('Extraction sources'),
1036
+ expiresAt: z
1037
+ .string()
1038
+ .optional()
1039
+ .describe('Expiration time of the extraction job'),
1040
+ }),
1041
+ ]);
1042
+ export class FirecrawlBubble extends ServiceBubble {
1043
+ static type = 'service';
1044
+ static service = 'firecrawl';
1045
+ static authType = 'apikey';
1046
+ static bubbleName = 'firecrawl';
1047
+ static schema = FirecrawlParamsSchema;
1048
+ static resultSchema = FirecrawlResultSchema;
1049
+ static shortDescription = 'Firecrawl API integration for web crawl operations.';
1050
+ static longDescription = `
1051
+ Firecrawl API integration for web crawling, scraping, searching, and data extraction.
1052
+
1053
+ Features:
1054
+ - Scrape content from any URL with customizable options.
1055
+ - Perform web searches and scrape results.
1056
+ - Map websites to discover URLs.
1057
+ - Crawl entire domains recursively.
1058
+ - Extract structured data using AI.
1059
+
1060
+ Use cases:
1061
+ - Add web knowledge to your RAG chatbots and AI assistants.
1062
+ - Extract and filter leads from websites to enrich your sales pipeline.
1063
+ - Monitor SERP rankings and optimize content strategy.
1064
+ - Build agentic research tools with deep web search capabilities.
1065
+ - Monitor pricing and track inventory across e-commerce sites.
1066
+ - Generate AI content based on website data and structure.
1067
+ - Track companies and extract financial insights from web data.
1068
+ - Monitor competitor websites and track changes in real-time.
1069
+ - Transfer web data seamlessly between platforms and systems.
1070
+ - Monitor websites, track uptime, and detect changes in real-time.
1071
+
1072
+ Security Features:
1073
+ - API key authentication (FIRECRAWL_API_KEY)
1074
+ - Secure credential injection at runtime
1075
+ `;
1076
+ static alias = 'firecrawl';
1077
+ constructor(params = {
1078
+ operation: 'scrape',
1079
+ }, context, instanceId) {
1080
+ super(params, context, instanceId);
1081
+ }
1082
+ async testCredential() {
1083
+ const apiKey = this.chooseCredential();
1084
+ if (!apiKey) {
1085
+ return false;
1086
+ }
1087
+ const firecrawl = new Firecrawl({ apiKey });
1088
+ try {
1089
+ const _ = await firecrawl.getConcurrency();
1090
+ if (_) {
1091
+ // suppress ts(6133)
1092
+ }
1093
+ return true;
1094
+ }
1095
+ catch (error) {
1096
+ console.error('Firecrawl credential test failed:', error);
1097
+ return false;
1098
+ }
1099
+ }
1100
+ chooseCredential() {
1101
+ const credentials = this.params.credentials;
1102
+ if (!credentials || typeof credentials !== 'object') {
1103
+ return undefined;
1104
+ }
1105
+ return credentials[CredentialType.FIRECRAWL_API_KEY];
1106
+ }
1107
+ async performAction(context) {
1108
+ void context;
1109
+ const { operation } = this.params;
1110
+ let result;
1111
+ switch (operation) {
1112
+ case 'scrape':
1113
+ result = (await this.handleScrape(this.params));
1114
+ break;
1115
+ case 'search':
1116
+ result = (await this.handleSearch(this.params));
1117
+ break;
1118
+ case 'map':
1119
+ result = (await this.handleMap(this.params));
1120
+ break;
1121
+ case 'crawl':
1122
+ result = (await this.handleCrawl(this.params));
1123
+ break;
1124
+ case 'extract':
1125
+ result = (await this.handleExtract(this.params));
1126
+ break;
1127
+ default:
1128
+ return {
1129
+ operation: operation,
1130
+ success: false,
1131
+ error: `Unsupported operation: ${operation}`,
1132
+ };
1133
+ }
1134
+ // Log token usage if operation was successful
1135
+ if (result.success && this.context?.logger) {
1136
+ const creditsUsed = this.calculateCreditsUsed(operation, result);
1137
+ if (creditsUsed > 0) {
1138
+ this.context?.logger.logTokenUsage({
1139
+ usage: creditsUsed,
1140
+ service: CredentialType.FIRECRAWL_API_KEY,
1141
+ unit: this.getUsageUnit(operation),
1142
+ subService: operation,
1143
+ }, `Firecrawl ${operation}: ${creditsUsed} credits used`, {
1144
+ bubbleName: 'firecrawl',
1145
+ variableId: this.context?.variableId,
1146
+ operationType: 'bubble_execution',
1147
+ });
1148
+ }
1149
+ }
1150
+ return result;
1151
+ }
1152
+ /**
1153
+ * Calculate credits used based on operation type and result
1154
+ */
1155
+ calculateCreditsUsed(operation, result) {
1156
+ switch (operation) {
1157
+ case 'scrape':
1158
+ // Scrape uses 1 credit per page
1159
+ return 1;
1160
+ case 'search': {
1161
+ // Search uses 2 credits per 10 results
1162
+ const searchResult = result;
1163
+ const webResults = searchResult.web?.length ?? 0;
1164
+ const newsResults = searchResult.news?.length ?? 0;
1165
+ const imageResults = searchResult.images?.length ?? 0;
1166
+ const otherResults = searchResult.other?.length ?? 0;
1167
+ const totalResults = webResults + newsResults + imageResults + otherResults;
1168
+ return Math.ceil(totalResults / 10) * 2;
1169
+ }
1170
+ case 'map': {
1171
+ // Map uses 1 credit per operation
1172
+ return 1;
1173
+ }
1174
+ case 'crawl': {
1175
+ // Crawl uses 1 credit per page crawled
1176
+ const crawlResult = result;
1177
+ return crawlResult.creditsUsed ?? crawlResult.data?.length ?? 0;
1178
+ }
1179
+ case 'extract': {
1180
+ // Extract uses credits based on URLs processed
1181
+ const extractResult = result;
1182
+ // Extract typically charges per URL, estimate 1 credit per URL if not provided
1183
+ const urlCount = this.params
1184
+ ?.urls?.length ?? 1;
1185
+ return extractResult.success ? urlCount : 0;
1186
+ }
1187
+ default:
1188
+ return 0;
1189
+ }
1190
+ }
1191
+ /**
1192
+ * Get the usage unit string for the operation
1193
+ */
1194
+ getUsageUnit(operation) {
1195
+ switch (operation) {
1196
+ case 'scrape':
1197
+ return 'per_result';
1198
+ case 'search':
1199
+ return 'per_10_results';
1200
+ case 'map':
1201
+ return 'per_result';
1202
+ case 'crawl':
1203
+ return 'per_result';
1204
+ case 'extract':
1205
+ return 'per_url';
1206
+ default:
1207
+ return 'per_result';
1208
+ }
1209
+ }
1210
+ async handleScrape(params) {
1211
+ const apiKey = this.chooseCredential();
1212
+ const { maxRetries, backoffFactor, url, formats, headers, includeTags, excludeTags, onlyMainContent, timeout, waitFor, mobile, parsers, actions, location, skipTlsVerification, removeBase64Images, fastMode, useMock, blockAds, proxy, maxAge, storeInCache, integration, } = params;
1213
+ if (!apiKey) {
1214
+ return {
1215
+ operation: 'scrape',
1216
+ success: false,
1217
+ error: 'FIRECRAWL_API_KEY is required',
1218
+ };
1219
+ }
1220
+ const firecrawl = new Firecrawl({
1221
+ apiKey,
1222
+ maxRetries,
1223
+ backoffFactor,
1224
+ // timeoutMs: timeout,
1225
+ });
1226
+ try {
1227
+ const response = await firecrawl.scrape(url, {
1228
+ formats,
1229
+ headers,
1230
+ includeTags,
1231
+ excludeTags,
1232
+ onlyMainContent,
1233
+ timeout,
1234
+ waitFor,
1235
+ mobile,
1236
+ parsers,
1237
+ actions,
1238
+ location,
1239
+ skipTlsVerification,
1240
+ removeBase64Images,
1241
+ fastMode,
1242
+ useMock,
1243
+ blockAds,
1244
+ proxy,
1245
+ maxAge,
1246
+ storeInCache,
1247
+ integration,
1248
+ });
1249
+ return {
1250
+ operation: 'scrape',
1251
+ success: true,
1252
+ error: '',
1253
+ ...response,
1254
+ };
1255
+ }
1256
+ catch (error) {
1257
+ return {
1258
+ operation: 'scrape',
1259
+ success: false,
1260
+ error: error instanceof Error ? error.message : `Unknown error occurred`,
1261
+ };
1262
+ }
1263
+ }
1264
+ async handleSearch(params) {
1265
+ const apiKey = this.chooseCredential();
1266
+ const { maxRetries, backoffFactor, query, sources, categories, limit, tbs, location, ignoreInvalidURLs, timeout, scrapeOptions, integration, } = params;
1267
+ if (!apiKey) {
1268
+ return {
1269
+ operation: 'search',
1270
+ success: false,
1271
+ error: 'FIRECRAWL_API_KEY is required',
1272
+ };
1273
+ }
1274
+ const firecrawl = new Firecrawl({
1275
+ apiKey,
1276
+ maxRetries,
1277
+ backoffFactor,
1278
+ // timeoutMs: timeout,
1279
+ });
1280
+ try {
1281
+ const response = await firecrawl.search(query, {
1282
+ sources,
1283
+ categories,
1284
+ limit,
1285
+ tbs,
1286
+ location,
1287
+ ignoreInvalidURLs,
1288
+ timeout,
1289
+ scrapeOptions,
1290
+ integration,
1291
+ });
1292
+ // Handle the response based on Firecrawl's actual API structure
1293
+ // The search API might return different structures, so handle both cases
1294
+ if (Array.isArray(response)) {
1295
+ return {
1296
+ operation: 'search',
1297
+ success: true,
1298
+ error: '',
1299
+ other: response,
1300
+ };
1301
+ }
1302
+ else {
1303
+ if ('data' in response && Array.isArray(response.data)) {
1304
+ const { data, ...rest } = response;
1305
+ return {
1306
+ operation: 'search',
1307
+ success: true,
1308
+ error: '',
1309
+ other: data,
1310
+ ...rest,
1311
+ };
1312
+ }
1313
+ else {
1314
+ return {
1315
+ operation: 'search',
1316
+ success: true,
1317
+ error: '',
1318
+ ...response,
1319
+ };
1320
+ }
1321
+ }
1322
+ }
1323
+ catch (error) {
1324
+ return {
1325
+ operation: 'search',
1326
+ success: false,
1327
+ error: error instanceof Error ? error.message : `Unknown error occurred`,
1328
+ };
1329
+ }
1330
+ }
1331
+ async handleMap(params) {
1332
+ const apiKey = this.chooseCredential();
1333
+ const { maxRetries, backoffFactor, url, search, sitemap, includeSubdomains, limit, timeout, integration, location, } = params;
1334
+ if (!apiKey) {
1335
+ return {
1336
+ operation: 'map',
1337
+ success: false,
1338
+ error: 'FIRECRAWL_API_KEY is required',
1339
+ links: [],
1340
+ };
1341
+ }
1342
+ const firecrawl = new Firecrawl({
1343
+ apiKey,
1344
+ maxRetries,
1345
+ backoffFactor,
1346
+ // timeoutMs: timeout,
1347
+ });
1348
+ try {
1349
+ const response = await firecrawl.map(url, {
1350
+ search,
1351
+ sitemap,
1352
+ includeSubdomains,
1353
+ limit,
1354
+ timeout,
1355
+ integration,
1356
+ location,
1357
+ });
1358
+ return {
1359
+ operation: 'map',
1360
+ success: true,
1361
+ error: '',
1362
+ ...response,
1363
+ };
1364
+ }
1365
+ catch (error) {
1366
+ return {
1367
+ operation: 'map',
1368
+ success: false,
1369
+ error: error instanceof Error ? error.message : `Unknown error occurred`,
1370
+ links: [],
1371
+ };
1372
+ }
1373
+ }
1374
+ async handleCrawl(params) {
1375
+ const apiKey = this.chooseCredential();
1376
+ const { maxRetries, backoffFactor, url, prompt, excludePaths, includePaths, maxDiscoveryDepth, sitemap, ignoreQueryParameters, limit, crawlEntireDomain, allowExternalLinks, allowSubdomains, delay, maxConcurrency, webhook, scrapeOptions, zeroDataRetention, integration, pollInterval, timeout, } = params;
1377
+ if (!apiKey) {
1378
+ return {
1379
+ operation: 'crawl',
1380
+ success: false,
1381
+ error: 'FIRECRAWL_API_KEY is required',
1382
+ status: 'failed',
1383
+ total: 0,
1384
+ completed: 0,
1385
+ data: [],
1386
+ };
1387
+ }
1388
+ const firecrawl = new Firecrawl({
1389
+ apiKey,
1390
+ maxRetries,
1391
+ backoffFactor,
1392
+ // timeoutMs: timeout,
1393
+ });
1394
+ try {
1395
+ const response = await firecrawl.crawl(url, {
1396
+ prompt,
1397
+ excludePaths,
1398
+ includePaths,
1399
+ maxDiscoveryDepth,
1400
+ sitemap,
1401
+ ignoreQueryParameters,
1402
+ limit,
1403
+ crawlEntireDomain,
1404
+ allowExternalLinks,
1405
+ allowSubdomains,
1406
+ delay,
1407
+ maxConcurrency,
1408
+ webhook,
1409
+ scrapeOptions,
1410
+ zeroDataRetention,
1411
+ integration,
1412
+ pollInterval,
1413
+ timeout,
1414
+ });
1415
+ return {
1416
+ operation: 'crawl',
1417
+ success: response.status === 'completed',
1418
+ error: response.status === 'completed' ? '' : `Crawl ${response.status}`,
1419
+ ...response,
1420
+ };
1421
+ }
1422
+ catch (error) {
1423
+ return {
1424
+ operation: 'crawl',
1425
+ success: false,
1426
+ error: error instanceof Error ? error.message : `Unknown error occurred`,
1427
+ status: 'failed',
1428
+ total: 0,
1429
+ completed: 0,
1430
+ data: [],
1431
+ };
1432
+ }
1433
+ }
1434
+ async handleExtract(params) {
1435
+ const apiKey = this.chooseCredential();
1436
+ const { maxRetries, backoffFactor, urls, prompt, schema, systemPrompt, allowExternalLinks, enableWebSearch, showSources, scrapeOptions, ignoreInvalidURLs, integration, agent, pollInterval, timeout, } = params;
1437
+ if (!apiKey) {
1438
+ return {
1439
+ operation: 'extract',
1440
+ success: false,
1441
+ error: 'FIRECRAWL_API_KEY is required',
1442
+ };
1443
+ }
1444
+ const firecrawl = new Firecrawl({
1445
+ apiKey,
1446
+ maxRetries,
1447
+ backoffFactor,
1448
+ // timeoutMs: timeout,
1449
+ });
1450
+ try {
1451
+ const { success: responseSuccess, error: responseError, ...response } = await firecrawl.extract({
1452
+ urls,
1453
+ prompt,
1454
+ schema,
1455
+ systemPrompt,
1456
+ allowExternalLinks,
1457
+ enableWebSearch,
1458
+ showSources,
1459
+ scrapeOptions,
1460
+ ignoreInvalidURLs,
1461
+ integration,
1462
+ agent,
1463
+ pollInterval,
1464
+ timeout,
1465
+ });
1466
+ const success = responseSuccess ?? response.status === 'completed';
1467
+ const error = responseError ??
1468
+ (success
1469
+ ? ''
1470
+ : response.status === undefined
1471
+ ? 'Unknown error occurred'
1472
+ : `Extraction ${response.status}`);
1473
+ return {
1474
+ operation: 'extract',
1475
+ success,
1476
+ error,
1477
+ ...response,
1478
+ };
1479
+ }
1480
+ catch (error) {
1481
+ return {
1482
+ operation: 'extract',
1483
+ success: false,
1484
+ error: error instanceof Error ? error.message : `Unknown error occurred`,
1485
+ };
1486
+ }
1487
+ }
1488
+ }
1489
+ //# sourceMappingURL=firecrawl.js.map