@bubblelab/bubble-core 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (275) hide show
  1. package/LICENSE.txt +202 -0
  2. package/dist/bubble-bundle.d.ts +2021 -0
  3. package/dist/bubble-factory.d.ts +161 -0
  4. package/dist/bubble-factory.d.ts.map +1 -0
  5. package/dist/bubble-factory.js +426 -0
  6. package/dist/bubble-factory.js.map +1 -0
  7. package/dist/bubble-flow/bubble-flow-class.d.ts +19 -0
  8. package/dist/bubble-flow/bubble-flow-class.d.ts.map +1 -0
  9. package/dist/bubble-flow/bubble-flow-class.js +23 -0
  10. package/dist/bubble-flow/bubble-flow-class.js.map +1 -0
  11. package/dist/bubble-flow/sample/data-analyst-flow.d.ts +15 -0
  12. package/dist/bubble-flow/sample/data-analyst-flow.d.ts.map +1 -0
  13. package/dist/bubble-flow/sample/data-analyst-flow.js +63 -0
  14. package/dist/bubble-flow/sample/data-analyst-flow.js.map +1 -0
  15. package/dist/bubble-flow/sample/error-ts.d.ts +23 -0
  16. package/dist/bubble-flow/sample/error-ts.d.ts.map +1 -0
  17. package/dist/bubble-flow/sample/error-ts.js +31 -0
  18. package/dist/bubble-flow/sample/error-ts.js.map +1 -0
  19. package/dist/bubble-flow/sample/sanitytest.d.ts +10 -0
  20. package/dist/bubble-flow/sample/sanitytest.d.ts.map +1 -0
  21. package/dist/bubble-flow/sample/sanitytest.js +13 -0
  22. package/dist/bubble-flow/sample/sanitytest.js.map +1 -0
  23. package/dist/bubble-flow/sample/simple-webhook-2.d.ts +19 -0
  24. package/dist/bubble-flow/sample/simple-webhook-2.d.ts.map +1 -0
  25. package/dist/bubble-flow/sample/simple-webhook-2.js +23 -0
  26. package/dist/bubble-flow/sample/simple-webhook-2.js.map +1 -0
  27. package/dist/bubble-flow/sample/simple-webhook.d.ts +10 -0
  28. package/dist/bubble-flow/sample/simple-webhook.d.ts.map +1 -0
  29. package/dist/bubble-flow/sample/simple-webhook.js +18 -0
  30. package/dist/bubble-flow/sample/simple-webhook.js.map +1 -0
  31. package/dist/bubble-flow/sample/simplified-data-analysis.flow.d.ts +29 -0
  32. package/dist/bubble-flow/sample/simplified-data-analysis.flow.d.ts.map +1 -0
  33. package/dist/bubble-flow/sample/simplified-data-analysis.flow.js +150 -0
  34. package/dist/bubble-flow/sample/simplified-data-analysis.flow.js.map +1 -0
  35. package/dist/bubble-flow/sample/slack-v0.1.d.ts +10 -0
  36. package/dist/bubble-flow/sample/slack-v0.1.d.ts.map +1 -0
  37. package/dist/bubble-flow/sample/slack-v0.1.js +59 -0
  38. package/dist/bubble-flow/sample/slack-v0.1.js.map +1 -0
  39. package/dist/bubble-flow/sample/slackagenttest.d.ts +10 -0
  40. package/dist/bubble-flow/sample/slackagenttest.d.ts.map +1 -0
  41. package/dist/bubble-flow/sample/slackagenttest.js +59 -0
  42. package/dist/bubble-flow/sample/slackagenttest.js.map +1 -0
  43. package/dist/bubble-trigger/index.d.ts +2 -0
  44. package/dist/bubble-trigger/index.d.ts.map +1 -0
  45. package/dist/bubble-trigger/index.js +2 -0
  46. package/dist/bubble-trigger/index.js.map +1 -0
  47. package/dist/bubble-trigger/types.d.ts +87 -0
  48. package/dist/bubble-trigger/types.d.ts.map +1 -0
  49. package/dist/bubble-trigger/types.js +14 -0
  50. package/dist/bubble-trigger/types.js.map +1 -0
  51. package/dist/bubbles/service-bubble/ai-agent.d.ts +428 -0
  52. package/dist/bubbles/service-bubble/ai-agent.d.ts.map +1 -0
  53. package/dist/bubbles/service-bubble/ai-agent.js +881 -0
  54. package/dist/bubbles/service-bubble/ai-agent.js.map +1 -0
  55. package/dist/bubbles/service-bubble/gmail.d.ts +3073 -0
  56. package/dist/bubbles/service-bubble/gmail.d.ts.map +1 -0
  57. package/dist/bubbles/service-bubble/gmail.js +908 -0
  58. package/dist/bubbles/service-bubble/gmail.js.map +1 -0
  59. package/dist/bubbles/service-bubble/google-calendar.d.ts +3377 -0
  60. package/dist/bubbles/service-bubble/google-calendar.d.ts.map +1 -0
  61. package/dist/bubbles/service-bubble/google-calendar.js +527 -0
  62. package/dist/bubbles/service-bubble/google-calendar.js.map +1 -0
  63. package/dist/bubbles/service-bubble/google-drive.d.ts +1152 -0
  64. package/dist/bubbles/service-bubble/google-drive.d.ts.map +1 -0
  65. package/dist/bubbles/service-bubble/google-drive.js +943 -0
  66. package/dist/bubbles/service-bubble/google-drive.js.map +1 -0
  67. package/dist/bubbles/service-bubble/google-sheets.d.ts +1811 -0
  68. package/dist/bubbles/service-bubble/google-sheets.d.ts.map +1 -0
  69. package/dist/bubbles/service-bubble/google-sheets.js +904 -0
  70. package/dist/bubbles/service-bubble/google-sheets.js.map +1 -0
  71. package/dist/bubbles/service-bubble/hello-world.d.ts +74 -0
  72. package/dist/bubbles/service-bubble/hello-world.d.ts.map +1 -0
  73. package/dist/bubbles/service-bubble/hello-world.js +67 -0
  74. package/dist/bubbles/service-bubble/hello-world.js.map +1 -0
  75. package/dist/bubbles/service-bubble/http.d.ts +134 -0
  76. package/dist/bubbles/service-bubble/http.d.ts.map +1 -0
  77. package/dist/bubbles/service-bubble/http.js +184 -0
  78. package/dist/bubbles/service-bubble/http.js.map +1 -0
  79. package/dist/bubbles/service-bubble/postgresql.d.ts +180 -0
  80. package/dist/bubbles/service-bubble/postgresql.d.ts.map +1 -0
  81. package/dist/bubbles/service-bubble/postgresql.js +448 -0
  82. package/dist/bubbles/service-bubble/postgresql.js.map +1 -0
  83. package/dist/bubbles/service-bubble/resend.d.ts +301 -0
  84. package/dist/bubbles/service-bubble/resend.d.ts.map +1 -0
  85. package/dist/bubbles/service-bubble/resend.js +253 -0
  86. package/dist/bubbles/service-bubble/resend.js.map +1 -0
  87. package/dist/bubbles/service-bubble/slack.d.ts +5869 -0
  88. package/dist/bubbles/service-bubble/slack.d.ts.map +1 -0
  89. package/dist/bubbles/service-bubble/slack.js +1536 -0
  90. package/dist/bubbles/service-bubble/slack.js.map +1 -0
  91. package/dist/bubbles/service-bubble/storage.d.ts +571 -0
  92. package/dist/bubbles/service-bubble/storage.d.ts.map +1 -0
  93. package/dist/bubbles/service-bubble/storage.js +504 -0
  94. package/dist/bubbles/service-bubble/storage.js.map +1 -0
  95. package/dist/bubbles/tool-bubble/bubbleflow-validation-tool.d.ts +308 -0
  96. package/dist/bubbles/tool-bubble/bubbleflow-validation-tool.d.ts.map +1 -0
  97. package/dist/bubbles/tool-bubble/bubbleflow-validation-tool.js +285 -0
  98. package/dist/bubbles/tool-bubble/bubbleflow-validation-tool.js.map +1 -0
  99. package/dist/bubbles/tool-bubble/chart-js-tool.d.ts +416 -0
  100. package/dist/bubbles/tool-bubble/chart-js-tool.d.ts.map +1 -0
  101. package/dist/bubbles/tool-bubble/chart-js-tool.js +570 -0
  102. package/dist/bubbles/tool-bubble/chart-js-tool.js.map +1 -0
  103. package/dist/bubbles/tool-bubble/get-bubble-details-tool.d.ts +99 -0
  104. package/dist/bubbles/tool-bubble/get-bubble-details-tool.d.ts.map +1 -0
  105. package/dist/bubbles/tool-bubble/get-bubble-details-tool.js +645 -0
  106. package/dist/bubbles/tool-bubble/get-bubble-details-tool.js.map +1 -0
  107. package/dist/bubbles/tool-bubble/list-bubbles-tool.d.ts +112 -0
  108. package/dist/bubbles/tool-bubble/list-bubbles-tool.d.ts.map +1 -0
  109. package/dist/bubbles/tool-bubble/list-bubbles-tool.js +82 -0
  110. package/dist/bubbles/tool-bubble/list-bubbles-tool.js.map +1 -0
  111. package/dist/bubbles/tool-bubble/reddit-scrape-tool.d.ts +413 -0
  112. package/dist/bubbles/tool-bubble/reddit-scrape-tool.d.ts.map +1 -0
  113. package/dist/bubbles/tool-bubble/reddit-scrape-tool.js +327 -0
  114. package/dist/bubbles/tool-bubble/reddit-scrape-tool.js.map +1 -0
  115. package/dist/bubbles/tool-bubble/research-agent-tool.d.ts +122 -0
  116. package/dist/bubbles/tool-bubble/research-agent-tool.d.ts.map +1 -0
  117. package/dist/bubbles/tool-bubble/research-agent-tool.js +343 -0
  118. package/dist/bubbles/tool-bubble/research-agent-tool.js.map +1 -0
  119. package/dist/bubbles/tool-bubble/sql-query-tool.d.ts +131 -0
  120. package/dist/bubbles/tool-bubble/sql-query-tool.d.ts.map +1 -0
  121. package/dist/bubbles/tool-bubble/sql-query-tool.js +147 -0
  122. package/dist/bubbles/tool-bubble/sql-query-tool.js.map +1 -0
  123. package/dist/bubbles/tool-bubble/tool-template.d.ts +257 -0
  124. package/dist/bubbles/tool-bubble/tool-template.d.ts.map +1 -0
  125. package/dist/bubbles/tool-bubble/tool-template.js +238 -0
  126. package/dist/bubbles/tool-bubble/tool-template.js.map +1 -0
  127. package/dist/bubbles/tool-bubble/virtual-file-editor-example.d.ts +8 -0
  128. package/dist/bubbles/tool-bubble/virtual-file-editor-example.d.ts.map +1 -0
  129. package/dist/bubbles/tool-bubble/virtual-file-editor-example.js +65 -0
  130. package/dist/bubbles/tool-bubble/virtual-file-editor-example.js.map +1 -0
  131. package/dist/bubbles/tool-bubble/virtual-file-editor.tool.d.ts +125 -0
  132. package/dist/bubbles/tool-bubble/virtual-file-editor.tool.d.ts.map +1 -0
  133. package/dist/bubbles/tool-bubble/virtual-file-editor.tool.js +169 -0
  134. package/dist/bubbles/tool-bubble/virtual-file-editor.tool.js.map +1 -0
  135. package/dist/bubbles/tool-bubble/web-crawl-tool.d.ts +218 -0
  136. package/dist/bubbles/tool-bubble/web-crawl-tool.d.ts.map +1 -0
  137. package/dist/bubbles/tool-bubble/web-crawl-tool.js +255 -0
  138. package/dist/bubbles/tool-bubble/web-crawl-tool.js.map +1 -0
  139. package/dist/bubbles/tool-bubble/web-extract-tool.d.ts +134 -0
  140. package/dist/bubbles/tool-bubble/web-extract-tool.d.ts.map +1 -0
  141. package/dist/bubbles/tool-bubble/web-extract-tool.js +175 -0
  142. package/dist/bubbles/tool-bubble/web-extract-tool.js.map +1 -0
  143. package/dist/bubbles/tool-bubble/web-scrape-tool.d.ts +228 -0
  144. package/dist/bubbles/tool-bubble/web-scrape-tool.d.ts.map +1 -0
  145. package/dist/bubbles/tool-bubble/web-scrape-tool.js +214 -0
  146. package/dist/bubbles/tool-bubble/web-scrape-tool.js.map +1 -0
  147. package/dist/bubbles/tool-bubble/web-search-tool.d.ts +134 -0
  148. package/dist/bubbles/tool-bubble/web-search-tool.d.ts.map +1 -0
  149. package/dist/bubbles/tool-bubble/web-search-tool.js +155 -0
  150. package/dist/bubbles/tool-bubble/web-search-tool.js.map +1 -0
  151. package/dist/bubbles/workflow-bubble/bubbleflow-generator.workflow.d.ts +114 -0
  152. package/dist/bubbles/workflow-bubble/bubbleflow-generator.workflow.d.ts.map +1 -0
  153. package/dist/bubbles/workflow-bubble/bubbleflow-generator.workflow.js +777 -0
  154. package/dist/bubbles/workflow-bubble/bubbleflow-generator.workflow.js.map +1 -0
  155. package/dist/bubbles/workflow-bubble/bubblscript-generateor.workflow.d.ts +97 -0
  156. package/dist/bubbles/workflow-bubble/bubblscript-generateor.workflow.d.ts.map +1 -0
  157. package/dist/bubbles/workflow-bubble/bubblscript-generateor.workflow.js +327 -0
  158. package/dist/bubbles/workflow-bubble/bubblscript-generateor.workflow.js.map +1 -0
  159. package/dist/bubbles/workflow-bubble/database-analyzer.workflow.d.ts +303 -0
  160. package/dist/bubbles/workflow-bubble/database-analyzer.workflow.d.ts.map +1 -0
  161. package/dist/bubbles/workflow-bubble/database-analyzer.workflow.js +297 -0
  162. package/dist/bubbles/workflow-bubble/database-analyzer.workflow.js.map +1 -0
  163. package/dist/bubbles/workflow-bubble/file-editor-agent.workflow.d.ts +157 -0
  164. package/dist/bubbles/workflow-bubble/file-editor-agent.workflow.d.ts.map +1 -0
  165. package/dist/bubbles/workflow-bubble/file-editor-agent.workflow.js +310 -0
  166. package/dist/bubbles/workflow-bubble/file-editor-agent.workflow.js.map +1 -0
  167. package/dist/bubbles/workflow-bubble/generate-document.workflow.d.ts +543 -0
  168. package/dist/bubbles/workflow-bubble/generate-document.workflow.d.ts.map +1 -0
  169. package/dist/bubbles/workflow-bubble/generate-document.workflow.js +628 -0
  170. package/dist/bubbles/workflow-bubble/generate-document.workflow.js.map +1 -0
  171. package/dist/bubbles/workflow-bubble/parse-document.workflow.d.ts +679 -0
  172. package/dist/bubbles/workflow-bubble/parse-document.workflow.d.ts.map +1 -0
  173. package/dist/bubbles/workflow-bubble/parse-document.workflow.js +604 -0
  174. package/dist/bubbles/workflow-bubble/parse-document.workflow.js.map +1 -0
  175. package/dist/bubbles/workflow-bubble/pdf-form-operations.workflow.d.ts +1011 -0
  176. package/dist/bubbles/workflow-bubble/pdf-form-operations.workflow.d.ts.map +1 -0
  177. package/dist/bubbles/workflow-bubble/pdf-form-operations.workflow.js +841 -0
  178. package/dist/bubbles/workflow-bubble/pdf-form-operations.workflow.js.map +1 -0
  179. package/dist/bubbles/workflow-bubble/pdf-ocr.workflow.d.ts +883 -0
  180. package/dist/bubbles/workflow-bubble/pdf-ocr.workflow.d.ts.map +1 -0
  181. package/dist/bubbles/workflow-bubble/pdf-ocr.workflow.js +781 -0
  182. package/dist/bubbles/workflow-bubble/pdf-ocr.workflow.js.map +1 -0
  183. package/dist/bubbles/workflow-bubble/slack-data-assistant.workflow.d.ts +300 -0
  184. package/dist/bubbles/workflow-bubble/slack-data-assistant.workflow.d.ts.map +1 -0
  185. package/dist/bubbles/workflow-bubble/slack-data-assistant.workflow.js +508 -0
  186. package/dist/bubbles/workflow-bubble/slack-data-assistant.workflow.js.map +1 -0
  187. package/dist/bubbles/workflow-bubble/slack-formatter-agent.d.ts +731 -0
  188. package/dist/bubbles/workflow-bubble/slack-formatter-agent.d.ts.map +1 -0
  189. package/dist/bubbles/workflow-bubble/slack-formatter-agent.js +690 -0
  190. package/dist/bubbles/workflow-bubble/slack-formatter-agent.js.map +1 -0
  191. package/dist/bubbles/workflow-bubble/slack-notifier.workflow.d.ts +401 -0
  192. package/dist/bubbles/workflow-bubble/slack-notifier.workflow.d.ts.map +1 -0
  193. package/dist/bubbles/workflow-bubble/slack-notifier.workflow.js +382 -0
  194. package/dist/bubbles/workflow-bubble/slack-notifier.workflow.js.map +1 -0
  195. package/dist/bubbles/workflow-bubble/workflow-template.d.ts +144 -0
  196. package/dist/bubbles/workflow-bubble/workflow-template.d.ts.map +1 -0
  197. package/dist/bubbles/workflow-bubble/workflow-template.js +124 -0
  198. package/dist/bubbles/workflow-bubble/workflow-template.js.map +1 -0
  199. package/dist/index.d.ts +46 -0
  200. package/dist/index.d.ts.map +1 -0
  201. package/dist/index.js +53 -0
  202. package/dist/index.js.map +1 -0
  203. package/dist/logging/BubbleLogger.d.ts +146 -0
  204. package/dist/logging/BubbleLogger.d.ts.map +1 -0
  205. package/dist/logging/BubbleLogger.js +472 -0
  206. package/dist/logging/BubbleLogger.js.map +1 -0
  207. package/dist/logging/StreamingBubbleLogger.d.ts +85 -0
  208. package/dist/logging/StreamingBubbleLogger.d.ts.map +1 -0
  209. package/dist/logging/StreamingBubbleLogger.js +340 -0
  210. package/dist/logging/StreamingBubbleLogger.js.map +1 -0
  211. package/dist/types/ai-models.d.ts +4 -0
  212. package/dist/types/ai-models.d.ts.map +1 -0
  213. package/dist/types/ai-models.js +14 -0
  214. package/dist/types/ai-models.js.map +1 -0
  215. package/dist/types/available-tools.d.ts +4 -0
  216. package/dist/types/available-tools.d.ts.map +1 -0
  217. package/dist/types/available-tools.js +19 -0
  218. package/dist/types/available-tools.js.map +1 -0
  219. package/dist/types/base-bubble-class.d.ts +47 -0
  220. package/dist/types/base-bubble-class.d.ts.map +1 -0
  221. package/dist/types/base-bubble-class.js +212 -0
  222. package/dist/types/base-bubble-class.js.map +1 -0
  223. package/dist/types/bubble-errors.d.ts +44 -0
  224. package/dist/types/bubble-errors.d.ts.map +1 -0
  225. package/dist/types/bubble-errors.js +51 -0
  226. package/dist/types/bubble-errors.js.map +1 -0
  227. package/dist/types/bubble.d.ts +73 -0
  228. package/dist/types/bubble.d.ts.map +1 -0
  229. package/dist/types/bubble.js +2 -0
  230. package/dist/types/bubble.js.map +1 -0
  231. package/dist/types/credentials.d.ts +6 -0
  232. package/dist/types/credentials.d.ts.map +1 -0
  233. package/dist/types/credentials.js +6 -0
  234. package/dist/types/credentials.js.map +1 -0
  235. package/dist/types/service-bubble-class.d.ts +31 -0
  236. package/dist/types/service-bubble-class.d.ts.map +1 -0
  237. package/dist/types/service-bubble-class.js +36 -0
  238. package/dist/types/service-bubble-class.js.map +1 -0
  239. package/dist/types/streaming-events.d.ts +18 -0
  240. package/dist/types/streaming-events.d.ts.map +1 -0
  241. package/dist/types/streaming-events.js +5 -0
  242. package/dist/types/streaming-events.js.map +1 -0
  243. package/dist/types/tool-bubble-class.d.ts +19 -0
  244. package/dist/types/tool-bubble-class.d.ts.map +1 -0
  245. package/dist/types/tool-bubble-class.js +48 -0
  246. package/dist/types/tool-bubble-class.js.map +1 -0
  247. package/dist/types/workflow-bubble-class.d.ts +25 -0
  248. package/dist/types/workflow-bubble-class.d.ts.map +1 -0
  249. package/dist/types/workflow-bubble-class.js +30 -0
  250. package/dist/types/workflow-bubble-class.js.map +1 -0
  251. package/dist/utils/bubbleflow-parser.d.ts +32 -0
  252. package/dist/utils/bubbleflow-parser.d.ts.map +1 -0
  253. package/dist/utils/bubbleflow-parser.js +332 -0
  254. package/dist/utils/bubbleflow-parser.js.map +1 -0
  255. package/dist/utils/bubbleflow-validation.d.ts +9 -0
  256. package/dist/utils/bubbleflow-validation.d.ts.map +1 -0
  257. package/dist/utils/bubbleflow-validation.js +116 -0
  258. package/dist/utils/bubbleflow-validation.js.map +1 -0
  259. package/dist/utils/json-parsing.d.ts +20 -0
  260. package/dist/utils/json-parsing.d.ts.map +1 -0
  261. package/dist/utils/json-parsing.js +394 -0
  262. package/dist/utils/json-parsing.js.map +1 -0
  263. package/dist/utils/mock-data-generator.d.ts +43 -0
  264. package/dist/utils/mock-data-generator.d.ts.map +1 -0
  265. package/dist/utils/mock-data-generator.js +312 -0
  266. package/dist/utils/mock-data-generator.js.map +1 -0
  267. package/dist/utils/param-helper.d.ts +2 -0
  268. package/dist/utils/param-helper.d.ts.map +1 -0
  269. package/dist/utils/param-helper.js +5 -0
  270. package/dist/utils/param-helper.js.map +1 -0
  271. package/dist/utils/source-bubble-parser.d.ts +31 -0
  272. package/dist/utils/source-bubble-parser.d.ts.map +1 -0
  273. package/dist/utils/source-bubble-parser.js +231 -0
  274. package/dist/utils/source-bubble-parser.js.map +1 -0
  275. package/package.json +63 -0
@@ -0,0 +1,161 @@
1
+ import { z } from 'zod';
2
+ import type { IBubble, BubbleContext } from './types/bubble.js';
3
+ import { CredentialType, type BubbleName, type BubbleNodeType } from '@bubblelab/shared-schemas';
4
+ type BubbleDependencySpec = {
5
+ name: BubbleName;
6
+ tools?: BubbleName[];
7
+ instances?: Array<{
8
+ variableName: string;
9
+ isAnonymous: boolean;
10
+ startLine?: number;
11
+ endLine?: number;
12
+ }>;
13
+ };
14
+ import type { LangGraphTool } from './types/tool-bubble-class.js';
15
+ export type BubbleClassWithMetadata<TResult extends object = object> = {
16
+ new (params: unknown, context?: BubbleContext): IBubble<{
17
+ success: boolean;
18
+ error: string;
19
+ } & TResult>;
20
+ readonly bubbleName: BubbleName;
21
+ readonly schema: z.ZodObject<z.ZodRawShape> | z.ZodDiscriminatedUnion<string, z.ZodObject<z.ZodRawShape>[]>;
22
+ readonly resultSchema?: z.ZodObject<z.ZodRawShape> | z.ZodDiscriminatedUnion<string, z.ZodObject<z.ZodRawShape>[]>;
23
+ readonly shortDescription: string;
24
+ readonly longDescription: string;
25
+ readonly alias?: string;
26
+ readonly type: BubbleNodeType;
27
+ readonly credentialOptions?: CredentialType[];
28
+ readonly bubbleDependencies?: BubbleName[];
29
+ toolAgent?: (credentials: Partial<Record<CredentialType, string>>, config?: Record<string, unknown>, context?: BubbleContext) => LangGraphTool;
30
+ };
31
+ export declare class BubbleFactory {
32
+ private registry;
33
+ private static dependenciesPopulated;
34
+ private static detailedDepsCache;
35
+ private detailedDeps;
36
+ constructor(autoRegisterDefaults?: boolean);
37
+ /**
38
+ * Register a bubble class with the factory
39
+ */
40
+ register(name: BubbleName, bubbleClass: BubbleClassWithMetadata<any>): void;
41
+ /**
42
+ * Get a bubble class from the registry
43
+ */
44
+ get(name: BubbleName): BubbleClassWithMetadata<any> | undefined;
45
+ /**
46
+ * Create a bubble instance
47
+ */
48
+ createBubble<T extends IBubble = IBubble>(name: BubbleName, params?: unknown, context?: BubbleContext): T;
49
+ getDetailedDependencies(name: BubbleName): BubbleDependencySpec[];
50
+ /**
51
+ * List all registered bubble names
52
+ */
53
+ list(): BubbleName[];
54
+ listBubblesForCodeGenerator(): BubbleName[];
55
+ registerDefaults(): Promise<void>;
56
+ /**
57
+ * Get all registered bubble classes
58
+ */
59
+ getAll(): BubbleClassWithMetadata[];
60
+ /**
61
+ * Get metadata for a bubble without instantiating it
62
+ */
63
+ getMetadata(name: BubbleName): {
64
+ bubbleDependenciesDetailed: BubbleDependencySpec[] | undefined;
65
+ name: BubbleName;
66
+ shortDescription: string;
67
+ longDescription: string;
68
+ alias: string | undefined;
69
+ credentialOptions: CredentialType[] | undefined;
70
+ bubbleDependencies: BubbleName[] | undefined;
71
+ schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, {
72
+ [x: string]: any;
73
+ }, {
74
+ [x: string]: any;
75
+ }> | z.ZodDiscriminatedUnion<string, z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, {
76
+ [x: string]: any;
77
+ }, {
78
+ [x: string]: any;
79
+ }>[]>;
80
+ resultSchema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, {
81
+ [x: string]: any;
82
+ }, {
83
+ [x: string]: any;
84
+ }> | z.ZodDiscriminatedUnion<string, z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, {
85
+ [x: string]: any;
86
+ }, {
87
+ [x: string]: any;
88
+ }>[]> | undefined;
89
+ type: BubbleNodeType;
90
+ params: z.ZodRawShape | undefined;
91
+ } | undefined;
92
+ /**
93
+ * Get all bubble metadata
94
+ */
95
+ getAllMetadata(): ({
96
+ bubbleDependenciesDetailed: BubbleDependencySpec[] | undefined;
97
+ name: BubbleName;
98
+ shortDescription: string;
99
+ longDescription: string;
100
+ alias: string | undefined;
101
+ credentialOptions: CredentialType[] | undefined;
102
+ bubbleDependencies: BubbleName[] | undefined;
103
+ schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, {
104
+ [x: string]: any;
105
+ }, {
106
+ [x: string]: any;
107
+ }> | z.ZodDiscriminatedUnion<string, z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, {
108
+ [x: string]: any;
109
+ }, {
110
+ [x: string]: any;
111
+ }>[]>;
112
+ resultSchema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, {
113
+ [x: string]: any;
114
+ }, {
115
+ [x: string]: any;
116
+ }> | z.ZodDiscriminatedUnion<string, z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, {
117
+ [x: string]: any;
118
+ }, {
119
+ [x: string]: any;
120
+ }>[]> | undefined;
121
+ type: BubbleNodeType;
122
+ params: z.ZodRawShape | undefined;
123
+ } | undefined)[];
124
+ /**
125
+ * Scan bubble source modules to infer direct dependencies between bubbles by
126
+ * inspecting ES module import statements, then attach the resulting
127
+ * `bubbleDependencies` array onto the corresponding registered classes.
128
+ *
129
+ * Notes:
130
+ * - Works in both dev (src) and build (dist) because it resolves paths
131
+ * relative to this module at runtime.
132
+ * - Only imports under ./bubbles/** that themselves define a bubble class are
133
+ * considered dependencies; all other imports are ignored.
134
+ */
135
+ private populateBubbleDependenciesFromSource;
136
+ private listModuleFilesRecursively;
137
+ private extractBubbleNamesFromContent;
138
+ /**
139
+ * Get credential to bubble name mapping from registered bubbles
140
+ * Provides type-safe mapping based on actual registered bubbles
141
+ */
142
+ getCredentialToBubbleMapping(): Partial<Record<CredentialType, BubbleName>>;
143
+ /**
144
+ * Get bubble name for a specific credential type
145
+ */
146
+ getBubbleNameForCredential(credentialType: CredentialType): BubbleName | undefined;
147
+ /**
148
+ * Check if a credential type is supported by any registered bubble
149
+ */
150
+ isCredentialSupported(credentialType: CredentialType): boolean;
151
+ /**
152
+ * Generate comprehensive BubbleFlow boilerplate template with all imports
153
+ * This template includes ALL available bubble classes and types
154
+ * Perfect for AI code generation and testing
155
+ */
156
+ generateBubbleFlowBoilerplate(options?: {
157
+ className?: string;
158
+ }): string;
159
+ }
160
+ export {};
161
+ //# sourceMappingURL=bubble-factory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bubble-factory.d.ts","sourceRoot":"","sources":["../src/bubble-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAChE,OAAO,EACL,cAAc,EACd,KAAK,UAAU,EACf,KAAK,cAAc,EAEpB,MAAM,2BAA2B,CAAC;AAEnC,KAAK,oBAAoB,GAAG;IAC1B,IAAI,EAAE,UAAU,CAAC;IACjB,KAAK,CAAC,EAAE,UAAU,EAAE,CAAC;IACrB,SAAS,CAAC,EAAE,KAAK,CAAC;QAChB,YAAY,EAAE,MAAM,CAAC;QACrB,WAAW,EAAE,OAAO,CAAC;QACrB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC,CAAC;CACJ,CAAC;AACF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAWlE,MAAM,MAAM,uBAAuB,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM,IAAI;IACrE,KACE,MAAM,EAAE,OAAO,EACf,OAAO,CAAC,EAAE,aAAa,GACtB,OAAO,CACR;QACE,OAAO,EAAE,OAAO,CAAC;QACjB,KAAK,EAAE,MAAM,CAAC;KACf,GAAG,OAAO,CACZ,CAAC;IACF,QAAQ,C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,IAAI;IAQ3E;;OAEG;IACH,GAAG,CAAC,IAAI,EAAE,UAAU,GAAG,uBAAuB,CAAC,GAAG,CAAC,GAAG,SAAS;IAI/D;;OAEG;IACH,YAAY,CAAC,CAAC,SAAS,OAAO,GAAG,OAAO,EACtC,IAAI,EAAE,UAAU,EAChB,MAAM,CAAC,EAAE,OAAO,EAChB,OAAO,CAAC,EAAE,aAAa,GACtB,CAAC;IASJ,uBAAuB,CAAC,IAAI,EAAE,UAAU,GAAG,oBAAoB,EAAE;IAIjE;;OAEG;IACH,IAAI,IAAI,UAAU,EAAE;IAKpB,2BAA2B,IAAI,UAAU,EAAE;IAmBrC,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC;IAoMvC;;OAEG;IACH,MAAM,IAAI,uBAAuB,EAAE;IAInC;;OAEG;IACH,WAAW,CAAC,IAAI,EAAE,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA4B5B;;OAEG;IACH,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAMd;;;;;;;;;;OAUG;YACW,oCAAoC;YAyGpC,0BAA0B;IAqBxC,OAAO,CAAC,6BAA6B;IAYrC;;;OAGG;IACH,4BAA4B,IAAI,OAAO,CAAC,MAAM,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC;IAwB3E;;OAEG;IACH,0BAA0B,CACxB,cAAc,EAAE,cAAc,GAC7B,UAAU,GAAG,SAAS;IAKzB;;OAEG;IACH,qBAAqB,CAAC,cAAc,EAAE,cAAc,GAAG,OAAO;IAI9D;;;;OAIG;IACH,6BAA6B,CAAC,OAAO,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM;CA8DxE"}
@@ -0,0 +1,426 @@
1
+ import { z } from 'zod';
2
+ import { CredentialType, BUBBLE_CREDENTIAL_OPTIONS, } from '@bubblelab/shared-schemas';
3
+ import { WebCrawlTool } from './bubbles/tool-bubble/web-crawl-tool.js';
4
+ import { promises as fs } from 'node:fs';
5
+ import path from 'node:path';
6
+ import { fileURLToPath } from 'node:url';
7
+ import { buildClassNameLookup as buildLookupForSource, parseBubbleInstancesFromSource, } from './utils/source-bubble-parser.js';
8
+ export class BubbleFactory {
9
+ registry = new Map();
10
+ static dependenciesPopulated = false;
11
+ static detailedDepsCache = new Map();
12
+ // Stores detailed dependencies inferred from source for each registered bubble
13
+ detailedDeps = new Map();
14
+ constructor(autoRegisterDefaults = false) {
15
+ if (autoRegisterDefaults) {
16
+ this.registerDefaults();
17
+ }
18
+ // Seed instance detailed deps from global cache if available
19
+ if (BubbleFactory.detailedDepsCache.size > 0) {
20
+ for (const [name, deps] of BubbleFactory.detailedDepsCache) {
21
+ this.detailedDeps.set(name, deps);
22
+ }
23
+ }
24
+ }
25
+ /**
26
+ * Register a bubble class with the factory
27
+ */
28
+ register(name, bubbleClass) {
29
+ if (this.registry.has(name)) {
30
+ // Silently skip if already registered - makes it idempotent
31
+ return;
32
+ }
33
+ this.registry.set(name, bubbleClass);
34
+ }
35
+ /**
36
+ * Get a bubble class from the registry
37
+ */
38
+ get(name) {
39
+ return this.registry.get(name);
40
+ }
41
+ /**
42
+ * Create a bubble instance
43
+ */
44
+ createBubble(name, params, context) {
45
+ const BubbleClass = this.registry.get(name);
46
+ if (!BubbleClass) {
47
+ throw new Error(`Bubble '${name}' not found in factory registry`);
48
+ }
49
+ // Always pass params, even if undefined
50
+ return new BubbleClass(params, context);
51
+ }
52
+ getDetailedDependencies(name) {
53
+ return this.detailedDeps.get(name) || [];
54
+ }
55
+ /**
56
+ * List all registered bubble names
57
+ */
58
+ list() {
59
+ return Array.from(this.registry.keys());
60
+ }
61
+ // Return a list of bubbles to be used in the BubbleFlow code generator
62
+ listBubblesForCodeGenerator() {
63
+ return [
64
+ 'postgresql',
65
+ 'ai-agent',
66
+ 'slack',
67
+ 'resend',
68
+ 'storage',
69
+ 'google-drive',
70
+ 'gmail',
71
+ 'google-sheets',
72
+ 'google-calendar',
73
+ 'pdf-form-operations',
74
+ 'generate-document-workflow',
75
+ 'slack-formatter-agent',
76
+ 'research-agent-tool',
77
+ 'reddit-scrape-tool',
78
+ ];
79
+ }
80
+ async registerDefaults() {
81
+ // Import and register all default bubbles
82
+ // This will be implemented in a separate file to avoid circular deps
83
+ // Register all default bubbles
84
+ const { HelloWorldBubble } = await import('./bubbles/service-bubble/hello-world.js');
85
+ const { AIAgentBubble } = await import('./bubbles/service-bubble/ai-agent.js');
86
+ const { PostgreSQLBubble } = await import('./bubbles/service-bubble/postgresql.js');
87
+ const { SlackBubble } = await import('./bubbles/service-bubble/slack.js');
88
+ const { ResendBubble } = await import('./bubbles/service-bubble/resend.js');
89
+ const { HttpBubble } = await import('./bubbles/service-bubble/http.js');
90
+ const { StorageBubble } = await import('./bubbles/service-bubble/storage.js');
91
+ const { GoogleDriveBubble } = await import('./bubbles/service-bubble/google-drive.js');
92
+ const { GmailBubble } = await import('./bubbles/service-bubble/gmail.js');
93
+ const { GoogleSheetsBubble } = await import('./bubbles/service-bubble/google-sheets.js');
94
+ const { GoogleCalendarBubble } = await import('./bubbles/service-bubble/google-calendar.js');
95
+ const { BubbleFlowGeneratorWorkflow } = await import('./bubbles/workflow-bubble/bubbleflow-generator.workflow.js');
96
+ const { DatabaseAnalyzerWorkflowBubble } = await import('./bubbles/workflow-bubble/database-analyzer.workflow.js');
97
+ const { SlackNotifierWorkflowBubble } = await import('./bubbles/workflow-bubble/slack-notifier.workflow.js');
98
+ const { SlackDataAssistantWorkflow } = await import('./bubbles/workflow-bubble/slack-data-assistant.workflow.js');
99
+ const { ListBubblesTool } = await import('./bubbles/tool-bubble/list-bubbles-tool.js');
100
+ const { GetBubbleDetailsTool } = await import('./bubbles/tool-bubble/get-bubble-details-tool.js');
101
+ const { SQLQueryTool } = await import('./bubbles/tool-bubble/sql-query-tool.js');
102
+ const { ChartJSTool } = await import('./bubbles/tool-bubble/chart-js-tool.js');
103
+ const { BubbleFlowValidationTool } = await import('./bubbles/tool-bubble/bubbleflow-validation-tool.js');
104
+ const { WebSearchTool } = await import('./bubbles/tool-bubble/web-search-tool.js');
105
+ const { WebScrapeTool } = await import('./bubbles/tool-bubble/web-scrape-tool.js');
106
+ const { WebExtractTool } = await import('./bubbles/tool-bubble/web-extract-tool.js');
107
+ const { ResearchAgentTool } = await import('./bubbles/tool-bubble/research-agent-tool.js');
108
+ const { RedditScrapeTool } = await import('./bubbles/tool-bubble/reddit-scrape-tool.js');
109
+ const { SlackFormatterAgentBubble } = await import('./bubbles/workflow-bubble/slack-formatter-agent.js');
110
+ const { PDFFormOperationsWorkflow } = await import('./bubbles/workflow-bubble/pdf-form-operations.workflow.js');
111
+ const { PDFOcrWorkflow } = await import('./bubbles/workflow-bubble/pdf-ocr.workflow.js');
112
+ const { GenerateDocumentWorkflow } = await import('./bubbles/workflow-bubble/generate-document.workflow.js');
113
+ const { ParseDocumentWorkflow } = await import('./bubbles/workflow-bubble/parse-document.workflow.js');
114
+ // Create the default factory instance
115
+ this.register('hello-world', HelloWorldBubble);
116
+ this.register('ai-agent', AIAgentBubble);
117
+ this.register('postgresql', PostgreSQLBubble);
118
+ this.register('slack', SlackBubble);
119
+ this.register('resend', ResendBubble);
120
+ this.register('http', HttpBubble);
121
+ this.register('storage', StorageBubble);
122
+ this.register('google-drive', GoogleDriveBubble);
123
+ this.register('gmail', GmailBubble);
124
+ this.register('google-sheets', GoogleSheetsBubble);
125
+ this.register('google-calendar', GoogleCalendarBubble);
126
+ this.register('bubbleflow-generator', BubbleFlowGeneratorWorkflow);
127
+ this.register('database-analyzer', DatabaseAnalyzerWorkflowBubble);
128
+ this.register('slack-notifier', SlackNotifierWorkflowBubble);
129
+ this.register('slack-data-assistant', SlackDataAssistantWorkflow);
130
+ this.register('slack-formatter-agent', SlackFormatterAgentBubble);
131
+ this.register('pdf-form-operations', PDFFormOperationsWorkflow);
132
+ this.register('pdf-ocr-workflow', PDFOcrWorkflow);
133
+ this.register('generate-document-workflow', GenerateDocumentWorkflow);
134
+ this.register('parse-document-workflow', ParseDocumentWorkflow);
135
+ this.register('get-bubble-details-tool', GetBubbleDetailsTool);
136
+ this.register('list-bubbles-tool', ListBubblesTool);
137
+ this.register('sql-query-tool', SQLQueryTool);
138
+ this.register('chart-js-tool', ChartJSTool);
139
+ this.register('bubbleflow-validation-tool', BubbleFlowValidationTool);
140
+ this.register('web-search-tool', WebSearchTool);
141
+ this.register('web-scrape-tool', WebScrapeTool);
142
+ this.register('web-extract-tool', WebExtractTool);
143
+ this.register('research-agent-tool', ResearchAgentTool);
144
+ this.register('reddit-scrape-tool', RedditScrapeTool);
145
+ this.register('web-crawl-tool', WebCrawlTool);
146
+ this.register('bubbleflow-code-generator', BubbleFlowGeneratorWorkflow);
147
+ // After all default bubbles are registered, auto-populate bubbleDependencies
148
+ if (!BubbleFactory.dependenciesPopulated) {
149
+ console.log('Populating bubble dependencies from source....');
150
+ await this.populateBubbleDependenciesFromSource();
151
+ BubbleFactory.dependenciesPopulated = true;
152
+ // Cache detailed dependencies globally for seeding future instances
153
+ BubbleFactory.detailedDepsCache = new Map(this.detailedDeps);
154
+ }
155
+ else {
156
+ console.log('Bubble dependencies already populated....');
157
+ // Seed this instance from the global cache if available
158
+ if (BubbleFactory.detailedDepsCache.size > 0) {
159
+ for (const [name, deps] of BubbleFactory.detailedDepsCache) {
160
+ this.detailedDeps.set(name, deps);
161
+ }
162
+ }
163
+ }
164
+ }
165
+ /**
166
+ * Get all registered bubble classes
167
+ */
168
+ getAll() {
169
+ return Array.from(this.registry.values());
170
+ }
171
+ /**
172
+ * Get metadata for a bubble without instantiating it
173
+ */
174
+ getMetadata(name) {
175
+ const BubbleClass = this.get(name);
176
+ if (!BubbleClass)
177
+ return undefined;
178
+ // Type guard to check if schema is a ZodObject
179
+ const schemaParams = BubbleClass.schema &&
180
+ typeof BubbleClass.schema === 'object' &&
181
+ 'shape' in BubbleClass.schema
182
+ ? BubbleClass.schema.shape
183
+ : undefined;
184
+ return {
185
+ bubbleDependenciesDetailed: this.detailedDeps.get(BubbleClass.bubbleName),
186
+ name: BubbleClass.bubbleName,
187
+ shortDescription: BubbleClass.shortDescription,
188
+ longDescription: BubbleClass.longDescription,
189
+ alias: BubbleClass.alias,
190
+ credentialOptions: BubbleClass.credentialOptions,
191
+ bubbleDependencies: BubbleClass.bubbleDependencies,
192
+ // Provide richer dependency details (ai-agent may include tools)
193
+ schema: BubbleClass.schema,
194
+ resultSchema: BubbleClass.resultSchema,
195
+ type: BubbleClass.type,
196
+ params: schemaParams,
197
+ };
198
+ }
199
+ /**
200
+ * Get all bubble metadata
201
+ */
202
+ getAllMetadata() {
203
+ return this.list()
204
+ .map((name) => this.getMetadata(name))
205
+ .filter(Boolean);
206
+ }
207
+ /**
208
+ * Scan bubble source modules to infer direct dependencies between bubbles by
209
+ * inspecting ES module import statements, then attach the resulting
210
+ * `bubbleDependencies` array onto the corresponding registered classes.
211
+ *
212
+ * Notes:
213
+ * - Works in both dev (src) and build (dist) because it resolves paths
214
+ * relative to this module at runtime.
215
+ * - Only imports under ./bubbles/** that themselves define a bubble class are
216
+ * considered dependencies; all other imports are ignored.
217
+ */
218
+ async populateBubbleDependenciesFromSource() {
219
+ try {
220
+ const currentFilePath = fileURLToPath(import.meta.url);
221
+ const baseDir = path.dirname(currentFilePath);
222
+ const bubblesDir = path.resolve(baseDir, './bubbles');
223
+ console.log('Bubbles directory:', bubblesDir);
224
+ // Gather all .js and .ts files under bubbles/**
225
+ const bubbleFiles = await this.listModuleFilesRecursively(bubblesDir);
226
+ // Build lookup once for all files
227
+ const lookup = buildLookupForSource(this.registry);
228
+ for (const filePath of bubbleFiles) {
229
+ const content = await fs.readFile(filePath, 'utf-8');
230
+ const ownerBubbleNames = this.extractBubbleNamesFromContent(content);
231
+ if (ownerBubbleNames.length === 0) {
232
+ continue;
233
+ }
234
+ // Parse instances used within this file
235
+ let instancesByDep = new Map();
236
+ try {
237
+ instancesByDep = parseBubbleInstancesFromSource(content, lookup, {
238
+ debug: false,
239
+ filePath,
240
+ });
241
+ }
242
+ catch {
243
+ // ignore parser failures for this file
244
+ }
245
+ // Collect ai-agent tools from instances directly (AST-derived)
246
+ const aiAgentInst = instancesByDep.get('ai-agent');
247
+ const aiTools = Array.from(new Set((aiAgentInst || [])
248
+ .flatMap((i) => i.tools || [])
249
+ .filter((t) => typeof t === 'string')));
250
+ for (const owner of ownerBubbleNames) {
251
+ const detailed = [];
252
+ for (const [depName, instList] of instancesByDep.entries()) {
253
+ if (depName === owner)
254
+ continue;
255
+ const spec = {
256
+ name: depName,
257
+ instances: instList.map((i) => ({
258
+ variableName: i.variableName,
259
+ isAnonymous: i.isAnonymous,
260
+ startLine: i.startLine,
261
+ endLine: i.endLine,
262
+ })),
263
+ };
264
+ if (depName === 'ai-agent' && aiTools.length > 0) {
265
+ spec.tools = aiTools;
266
+ }
267
+ detailed.push(spec);
268
+ }
269
+ // Persist results for this owner bubble
270
+ this.detailedDeps.set(owner, detailed);
271
+ // Maintain classic flat dependency list on the class
272
+ const klass = this.get(owner);
273
+ if (klass) {
274
+ try {
275
+ klass.bubbleDependencies = detailed.map((d) => d.name);
276
+ }
277
+ catch {
278
+ try {
279
+ Object.defineProperty(klass, 'bubbleDependencies', {
280
+ value: detailed.map((d) => d.name),
281
+ configurable: true,
282
+ });
283
+ }
284
+ catch {
285
+ // ignore
286
+ }
287
+ }
288
+ }
289
+ }
290
+ }
291
+ }
292
+ catch {
293
+ // Silently ignore issues in dependency scanning to avoid blocking runtime
294
+ }
295
+ }
296
+ async listModuleFilesRecursively(dir) {
297
+ const out = [];
298
+ const entries = await fs.readdir(dir, { withFileTypes: true });
299
+ for (const entry of entries) {
300
+ const full = path.join(dir, entry.name);
301
+ if (entry.isDirectory()) {
302
+ const nested = await this.listModuleFilesRecursively(full);
303
+ out.push(...nested);
304
+ }
305
+ else if (entry.isFile() &&
306
+ (full.endsWith('.ts') || full.endsWith('.js')) &&
307
+ !full.endsWith('.test.ts') &&
308
+ !full.endsWith('.d.ts')) {
309
+ out.push(full);
310
+ }
311
+ }
312
+ return out;
313
+ }
314
+ extractBubbleNamesFromContent(content) {
315
+ const names = [];
316
+ // Look for static bubbleName definitions in the class body
317
+ const nameRegex = /static\s+(?:readonly\s+)?bubbleName\s*(?::[^=]+)?=\s*['"]([^'"\n]+)['"]/g;
318
+ let match;
319
+ while ((match = nameRegex.exec(content)) !== null) {
320
+ names.push(match[1]);
321
+ }
322
+ return names;
323
+ }
324
+ /**
325
+ * Get credential to bubble name mapping from registered bubbles
326
+ * Provides type-safe mapping based on actual registered bubbles
327
+ */
328
+ getCredentialToBubbleMapping() {
329
+ const mapping = {};
330
+ for (const [bubbleName, credentialOptions] of Object.entries(BUBBLE_CREDENTIAL_OPTIONS)) {
331
+ // Get the bubble class to check its type
332
+ const BubbleClass = this.get(bubbleName);
333
+ // Only include service bubbles for credential validation
334
+ if (BubbleClass && BubbleClass.type === 'service') {
335
+ for (const credentialType of credentialOptions) {
336
+ // Only map if we haven't seen this credential type before
337
+ // This gives priority to the first service bubble for each credential
338
+ if (!mapping[credentialType]) {
339
+ mapping[credentialType] = bubbleName;
340
+ }
341
+ }
342
+ }
343
+ }
344
+ return mapping;
345
+ }
346
+ /**
347
+ * Get bubble name for a specific credential type
348
+ */
349
+ getBubbleNameForCredential(credentialType) {
350
+ const mapping = this.getCredentialToBubbleMapping();
351
+ return mapping[credentialType];
352
+ }
353
+ /**
354
+ * Check if a credential type is supported by any registered bubble
355
+ */
356
+ isCredentialSupported(credentialType) {
357
+ return this.getBubbleNameForCredential(credentialType) !== undefined;
358
+ }
359
+ /**
360
+ * Generate comprehensive BubbleFlow boilerplate template with all imports
361
+ * This template includes ALL available bubble classes and types
362
+ * Perfect for AI code generation and testing
363
+ */
364
+ generateBubbleFlowBoilerplate(options) {
365
+ const className = options?.className || 'GeneratedFlow';
366
+ return `
367
+ import {
368
+ // Base classes
369
+ BubbleFlow,
370
+ BaseBubble,
371
+ ServiceBubble,
372
+ WorkflowBubble,
373
+ ToolBubble,
374
+
375
+ // Service Bubbles
376
+ HelloWorldBubble,
377
+ AIAgentBubble,
378
+ PostgreSQLBubble,
379
+ SlackBubble,
380
+ ResendBubble,
381
+ StorageBubble,
382
+ GoogleDriveBubble,
383
+ GmailBubble,
384
+ SlackFormatterAgentBubble,
385
+
386
+ // Template Workflows
387
+ SlackDataAssistantWorkflow,
388
+ PDFFormOperationsWorkflow,
389
+
390
+ // Specialized Tool Bubbles
391
+ ResearchAgentTool,
392
+ RedditScrapeTool,
393
+
394
+ // Types and utilities
395
+ BubbleFactory,
396
+ type BubbleClassWithMetadata,
397
+ type BubbleContext,
398
+ type BubbleOperationResult,
399
+ type BubbleTriggerEvent,
400
+ type WebhookEvent,
401
+ } from '@bubblelab/bubble-core';
402
+
403
+ export interface Output {
404
+ // TODO: Add your output fields here
405
+ message: string;
406
+ }
407
+
408
+ // Define your custom input interface
409
+ export interface CustomWebhookPayload extends WebhookEvent {
410
+ // TODO: Add your custom payload fields here
411
+ input: string;
412
+ }
413
+
414
+ export class ${className} extends BubbleFlow<'webhook/http'> {
415
+ async handle(payload: CustomWebhookPayload): Promise<Output> {
416
+ // TODO: Implement your workflow logic here
417
+ const { input } = payload;
418
+
419
+ return {
420
+ message: \`Response from \${payload.path} (Request: \${payload.requestId})\`,
421
+ };
422
+ }
423
+ }`;
424
+ }
425
+ }
426
+ //# sourceMappingURL=bubble-factory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bubble-factory.js","sourceRoot":"","sources":["../src/bubble-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,cAAc,EAGd,yBAAyB,GAC1B,MAAM,2BAA2B,CAAC;AAanC,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AACvE,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CA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AAO,KAAK,CAAC;IACf,CAAC;IAED;;;OAGG;IACH,4BAA4B;QAC1B,MAAM,OAAO,GAAgD,EAAE,CAAC;QAEhE,KAAK,MAAM,CAAC,UAAU,EAAE,iBAAiB,CAAC,IAAI,MAAM,CAAC,OAAO,CAC1D,yBAAyB,CAC1B,EAAE,CAAC;YACF,yCAAyC;YACzC,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,UAAwB,CAAC,CAAC;YAEvD,yDAAyD;YACzD,IAAI,WAAW,IAAI,WAAW,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;gBAClD,KAAK,MAAM,cAAc,IAAI,iBAAiB,EAAE,CAAC;oBAC/C,0DAA0D;oBAC1D,sEAAsE;oBACtE,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,CAAC;wBAC7B,OAAO,CAAC,cAAc,CAAC,GAAG,UAAwB,CAAC;oBACrD,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;IAED;;OAEG;IACH,0BAA0B,CACxB,cAA8B;QAE9B,MAAM,OAAO,GAAG,IAAI,CAAC,4BAA4B,EAAE,CAAC;QACpD,OAAO,OAAO,CAAC,cAAc,CAAC,CAAC;IACjC,CAAC;IAED;;OAEG;IACH,qBAAqB,CAAC,cAA8B;QAClD,OAAO,IAAI,CAAC,0BAA0B,CAAC,cAAc,CAAC,KAAK,SAAS,CAAC;IACvE,CAAC;IAED;;;;OAIG;IACH,6BAA6B,CAAC,OAAgC;QAC5D,MAAM,SAAS,GAAG,OAAO,EAAE,SAAS,IAAI,eAAe,CAAC;QAExD,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eAgDI,SAAS;;;;;;;;;EAStB,CAAC;IACD,CAAC"}
@@ -0,0 +1,19 @@
1
+ import type { BubbleTriggerEventRegistry } from '../bubble-trigger/types.js';
2
+ import type { BubbleFlowOperationResult } from '../types/bubble.js';
3
+ import type { BubbleLogger } from '../logging/BubbleLogger.js';
4
+ export declare abstract class BubbleFlow<TEventType extends keyof BubbleTriggerEventRegistry> {
5
+ readonly name: string;
6
+ readonly description: string;
7
+ protected logger?: BubbleLogger;
8
+ constructor(name: string, description: string, logger?: BubbleLogger);
9
+ abstract handle(payload: BubbleTriggerEventRegistry[TEventType]): Promise<BubbleFlowOperationResult>;
10
+ /**
11
+ * Get the logger instance if available
12
+ */
13
+ getLogger(): BubbleLogger | undefined;
14
+ /**
15
+ * Set a logger for this flow instance
16
+ */
17
+ setLogger(logger: BubbleLogger): void;
18
+ }
19
+ //# sourceMappingURL=bubble-flow-class.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bubble-flow-class.d.ts","sourceRoot":"","sources":["../../src/bubble-flow/bubble-flow-class.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AAC7E,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE/D,8BAAsB,UAAU,CAC9B,UAAU,SAAS,MAAM,0BAA0B;IAEnD,SAAgB,IAAI,EAAE,MAAM,CAAC;IAC7B,SAAgB,WAAW,EAAE,MAAM,CAAC;IACpC,SAAS,CAAC,MAAM,CAAC,EAAE,YAAY,CAAC;gBAEpB,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,YAAY;IAMpE,QAAQ,CAAC,MAAM,CACb,OAAO,EAAE,0BAA0B,CAAC,UAAU,CAAC,GAC9C,OAAO,CAAC,yBAAyB,CAAC;IAErC;;OAEG;IACH,SAAS,IAAI,YAAY,GAAG,SAAS;IAIrC;;OAEG;IACH,SAAS,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI;CAGtC"}
@@ -0,0 +1,23 @@
1
+ export class BubbleFlow {
2
+ name;
3
+ description;
4
+ logger;
5
+ constructor(name, description, logger) {
6
+ this.name = name;
7
+ this.description = description;
8
+ this.logger = logger;
9
+ }
10
+ /**
11
+ * Get the logger instance if available
12
+ */
13
+ getLogger() {
14
+ return this.logger;
15
+ }
16
+ /**
17
+ * Set a logger for this flow instance
18
+ */
19
+ setLogger(logger) {
20
+ this.logger = logger;
21
+ }
22
+ }
23
+ //# sourceMappingURL=bubble-flow-class.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bubble-flow-class.js","sourceRoot":"","sources":["../../src/bubble-flow/bubble-flow-class.ts"],"names":[],"mappings":"AAIA,MAAM,OAAgB,UAAU;IAGd,IAAI,CAAS;IACb,WAAW,CAAS;IAC1B,MAAM,CAAgB;IAEhC,YAAY,IAAY,EAAE,WAAmB,EAAE,MAAqB;QAClE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAMD;;OAEG;IACH,SAAS;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED;;OAEG;IACH,SAAS,CAAC,MAAoB;QAC5B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;CACF"}