@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,303 @@
1
+ import { z } from 'zod';
2
+ import { WorkflowBubble } from '../../types/workflow-bubble-class.js';
3
+ import type { BubbleContext } from '../../types/bubble.js';
4
+ import { CredentialType } from '@bubblelab/shared-schemas';
5
+ declare const DatabaseAnalyzerParamsSchema: z.ZodObject<{
6
+ /**
7
+ * The data source service to analyze (currently supports 'postgresql')
8
+ */
9
+ dataSourceType: z.ZodEnum<["postgresql"]>;
10
+ /**
11
+ * Whether to ignore SSL certificate errors when connecting
12
+ */
13
+ ignoreSSLErrors: z.ZodDefault<z.ZodBoolean>;
14
+ /**
15
+ * Include additional metadata like enum values and constraints
16
+ */
17
+ includeMetadata: z.ZodDefault<z.ZodBoolean>;
18
+ /**
19
+ * Injected credentials from the system
20
+ */
21
+ credentials: z.ZodOptional<z.ZodRecord<z.ZodNativeEnum<typeof CredentialType>, z.ZodString>>;
22
+ /**
23
+ * Injected metadata from user credentials (database schema notes and rules)
24
+ */
25
+ injectedMetadata: z.ZodOptional<z.ZodObject<{
26
+ tables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>>>;
27
+ tableNotes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
28
+ rules: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
29
+ }, "strip", z.ZodTypeAny, {
30
+ tables?: Record<string, Record<string, string>> | undefined;
31
+ tableNotes?: Record<string, string> | undefined;
32
+ rules?: string[] | undefined;
33
+ }, {
34
+ tables?: Record<string, Record<string, string>> | undefined;
35
+ tableNotes?: Record<string, string> | undefined;
36
+ rules?: string[] | undefined;
37
+ }>>;
38
+ }, "strip", z.ZodTypeAny, {
39
+ dataSourceType: "postgresql";
40
+ ignoreSSLErrors: boolean;
41
+ includeMetadata: boolean;
42
+ credentials?: Partial<Record<CredentialType, string>> | undefined;
43
+ injectedMetadata?: {
44
+ tables?: Record<string, Record<string, string>> | undefined;
45
+ tableNotes?: Record<string, string> | undefined;
46
+ rules?: string[] | undefined;
47
+ } | undefined;
48
+ }, {
49
+ dataSourceType: "postgresql";
50
+ credentials?: Partial<Record<CredentialType, string>> | undefined;
51
+ ignoreSSLErrors?: boolean | undefined;
52
+ includeMetadata?: boolean | undefined;
53
+ injectedMetadata?: {
54
+ tables?: Record<string, Record<string, string>> | undefined;
55
+ tableNotes?: Record<string, string> | undefined;
56
+ rules?: string[] | undefined;
57
+ } | undefined;
58
+ }>;
59
+ declare const DatabaseAnalyzerResultSchema: z.ZodObject<{
60
+ success: z.ZodBoolean;
61
+ error: z.ZodString;
62
+ /**
63
+ * The analyzed database schema in structured format
64
+ */
65
+ databaseSchema: z.ZodOptional<z.ZodObject<{
66
+ /**
67
+ * Raw schema data as returned by the database
68
+ */
69
+ rawData: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>, "many">>;
70
+ /**
71
+ * Cleaned JSON string representation of the schema
72
+ */
73
+ cleanedJSON: z.ZodOptional<z.ZodString>;
74
+ /**
75
+ * Number of tables found
76
+ */
77
+ tableCount: z.ZodOptional<z.ZodNumber>;
78
+ /**
79
+ * List of table names
80
+ */
81
+ tableNames: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
82
+ }, "strip", z.ZodTypeAny, {
83
+ rawData?: Record<string, unknown>[] | undefined;
84
+ cleanedJSON?: string | undefined;
85
+ tableCount?: number | undefined;
86
+ tableNames?: string[] | undefined;
87
+ }, {
88
+ rawData?: Record<string, unknown>[] | undefined;
89
+ cleanedJSON?: string | undefined;
90
+ tableCount?: number | undefined;
91
+ tableNames?: string[] | undefined;
92
+ }>>;
93
+ /**
94
+ * Summary of the analysis operation
95
+ */
96
+ analysisSummary: z.ZodOptional<z.ZodObject<{
97
+ dataSourceType: z.ZodString;
98
+ connectionSuccessful: z.ZodBoolean;
99
+ analysisTimestamp: z.ZodDate;
100
+ }, "strip", z.ZodTypeAny, {
101
+ dataSourceType: string;
102
+ connectionSuccessful: boolean;
103
+ analysisTimestamp: Date;
104
+ }, {
105
+ dataSourceType: string;
106
+ connectionSuccessful: boolean;
107
+ analysisTimestamp: Date;
108
+ }>>;
109
+ }, "strip", z.ZodTypeAny, {
110
+ success: boolean;
111
+ error: string;
112
+ databaseSchema?: {
113
+ rawData?: Record<string, unknown>[] | undefined;
114
+ cleanedJSON?: string | undefined;
115
+ tableCount?: number | undefined;
116
+ tableNames?: string[] | undefined;
117
+ } | undefined;
118
+ analysisSummary?: {
119
+ dataSourceType: string;
120
+ connectionSuccessful: boolean;
121
+ analysisTimestamp: Date;
122
+ } | undefined;
123
+ }, {
124
+ success: boolean;
125
+ error: string;
126
+ databaseSchema?: {
127
+ rawData?: Record<string, unknown>[] | undefined;
128
+ cleanedJSON?: string | undefined;
129
+ tableCount?: number | undefined;
130
+ tableNames?: string[] | undefined;
131
+ } | undefined;
132
+ analysisSummary?: {
133
+ dataSourceType: string;
134
+ connectionSuccessful: boolean;
135
+ analysisTimestamp: Date;
136
+ } | undefined;
137
+ }>;
138
+ type DatabaseAnalyzerResult = z.output<typeof DatabaseAnalyzerResultSchema>;
139
+ type DatabaseAnalyzerParamsInput = z.input<typeof DatabaseAnalyzerParamsSchema>;
140
+ type DatabaseAnalyzerParams = z.output<typeof DatabaseAnalyzerParamsSchema>;
141
+ /**
142
+ * DatabaseAnalyzerWorkflowBubble - Analyzes database schema structure
143
+ *
144
+ * This workflow bubble simplifies database schema analysis by:
145
+ * 1. Connecting to the specified database
146
+ * 2. Querying the information schema to get table/column structure
147
+ * 3. Extracting metadata like enum values and constraints
148
+ * 4. Returning structured schema information ready for AI analysis
149
+ *
150
+ * Common use cases:
151
+ * - Data discovery and cataloging
152
+ * - Generating queries based on schema structure
153
+ * - Database documentation generation
154
+ * - AI-powered data analysis preparation
155
+ */
156
+ export declare class DatabaseAnalyzerWorkflowBubble extends WorkflowBubble<DatabaseAnalyzerParams, DatabaseAnalyzerResult> {
157
+ static readonly type: "workflow";
158
+ static readonly bubbleName = "database-analyzer";
159
+ static readonly schema: z.ZodObject<{
160
+ /**
161
+ * The data source service to analyze (currently supports 'postgresql')
162
+ */
163
+ dataSourceType: z.ZodEnum<["postgresql"]>;
164
+ /**
165
+ * Whether to ignore SSL certificate errors when connecting
166
+ */
167
+ ignoreSSLErrors: z.ZodDefault<z.ZodBoolean>;
168
+ /**
169
+ * Include additional metadata like enum values and constraints
170
+ */
171
+ includeMetadata: z.ZodDefault<z.ZodBoolean>;
172
+ /**
173
+ * Injected credentials from the system
174
+ */
175
+ credentials: z.ZodOptional<z.ZodRecord<z.ZodNativeEnum<typeof CredentialType>, z.ZodString>>;
176
+ /**
177
+ * Injected metadata from user credentials (database schema notes and rules)
178
+ */
179
+ injectedMetadata: z.ZodOptional<z.ZodObject<{
180
+ tables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>>>;
181
+ tableNotes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
182
+ rules: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
183
+ }, "strip", z.ZodTypeAny, {
184
+ tables?: Record<string, Record<string, string>> | undefined;
185
+ tableNotes?: Record<string, string> | undefined;
186
+ rules?: string[] | undefined;
187
+ }, {
188
+ tables?: Record<string, Record<string, string>> | undefined;
189
+ tableNotes?: Record<string, string> | undefined;
190
+ rules?: string[] | undefined;
191
+ }>>;
192
+ }, "strip", z.ZodTypeAny, {
193
+ dataSourceType: "postgresql";
194
+ ignoreSSLErrors: boolean;
195
+ includeMetadata: boolean;
196
+ credentials?: Partial<Record<CredentialType, string>> | undefined;
197
+ injectedMetadata?: {
198
+ tables?: Record<string, Record<string, string>> | undefined;
199
+ tableNotes?: Record<string, string> | undefined;
200
+ rules?: string[] | undefined;
201
+ } | undefined;
202
+ }, {
203
+ dataSourceType: "postgresql";
204
+ credentials?: Partial<Record<CredentialType, string>> | undefined;
205
+ ignoreSSLErrors?: boolean | undefined;
206
+ includeMetadata?: boolean | undefined;
207
+ injectedMetadata?: {
208
+ tables?: Record<string, Record<string, string>> | undefined;
209
+ tableNotes?: Record<string, string> | undefined;
210
+ rules?: string[] | undefined;
211
+ } | undefined;
212
+ }>;
213
+ static readonly resultSchema: z.ZodObject<{
214
+ success: z.ZodBoolean;
215
+ error: z.ZodString;
216
+ /**
217
+ * The analyzed database schema in structured format
218
+ */
219
+ databaseSchema: z.ZodOptional<z.ZodObject<{
220
+ /**
221
+ * Raw schema data as returned by the database
222
+ */
223
+ rawData: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>, "many">>;
224
+ /**
225
+ * Cleaned JSON string representation of the schema
226
+ */
227
+ cleanedJSON: z.ZodOptional<z.ZodString>;
228
+ /**
229
+ * Number of tables found
230
+ */
231
+ tableCount: z.ZodOptional<z.ZodNumber>;
232
+ /**
233
+ * List of table names
234
+ */
235
+ tableNames: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
236
+ }, "strip", z.ZodTypeAny, {
237
+ rawData?: Record<string, unknown>[] | undefined;
238
+ cleanedJSON?: string | undefined;
239
+ tableCount?: number | undefined;
240
+ tableNames?: string[] | undefined;
241
+ }, {
242
+ rawData?: Record<string, unknown>[] | undefined;
243
+ cleanedJSON?: string | undefined;
244
+ tableCount?: number | undefined;
245
+ tableNames?: string[] | undefined;
246
+ }>>;
247
+ /**
248
+ * Summary of the analysis operation
249
+ */
250
+ analysisSummary: z.ZodOptional<z.ZodObject<{
251
+ dataSourceType: z.ZodString;
252
+ connectionSuccessful: z.ZodBoolean;
253
+ analysisTimestamp: z.ZodDate;
254
+ }, "strip", z.ZodTypeAny, {
255
+ dataSourceType: string;
256
+ connectionSuccessful: boolean;
257
+ analysisTimestamp: Date;
258
+ }, {
259
+ dataSourceType: string;
260
+ connectionSuccessful: boolean;
261
+ analysisTimestamp: Date;
262
+ }>>;
263
+ }, "strip", z.ZodTypeAny, {
264
+ success: boolean;
265
+ error: string;
266
+ databaseSchema?: {
267
+ rawData?: Record<string, unknown>[] | undefined;
268
+ cleanedJSON?: string | undefined;
269
+ tableCount?: number | undefined;
270
+ tableNames?: string[] | undefined;
271
+ } | undefined;
272
+ analysisSummary?: {
273
+ dataSourceType: string;
274
+ connectionSuccessful: boolean;
275
+ analysisTimestamp: Date;
276
+ } | undefined;
277
+ }, {
278
+ success: boolean;
279
+ error: string;
280
+ databaseSchema?: {
281
+ rawData?: Record<string, unknown>[] | undefined;
282
+ cleanedJSON?: string | undefined;
283
+ tableCount?: number | undefined;
284
+ tableNames?: string[] | undefined;
285
+ } | undefined;
286
+ analysisSummary?: {
287
+ dataSourceType: string;
288
+ connectionSuccessful: boolean;
289
+ analysisTimestamp: Date;
290
+ } | undefined;
291
+ }>;
292
+ static readonly shortDescription = "Analyzes database schema structure and metadata";
293
+ static readonly longDescription = "Connects to a database and extracts comprehensive schema information including tables, columns, data types, constraints, and enum values. Perfect for AI-powered data analysis, query generation, and database documentation. Currently supports PostgreSQL with plans for additional database types.";
294
+ static readonly alias = "analyze-db";
295
+ constructor(params: DatabaseAnalyzerParamsInput, context?: BubbleContext);
296
+ protected performAction(_context?: BubbleContext): Promise<DatabaseAnalyzerResult>;
297
+ /**
298
+ * Builds the PostgreSQL schema query based on metadata requirements
299
+ */
300
+ private buildPostgreSQLSchemaQuery;
301
+ }
302
+ export {};
303
+ //# sourceMappingURL=database-analyzer.workflow.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"database-analyzer.workflow.d.ts","sourceRoot":"","sources":["../../../src/bubbles/workflow-bubble/database-analyzer.workflow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAoCyD;IAC5D,MAAM,CAAC,QAAQ,CAAC,gBAAgB,qDACoB;IACpD,MAAM,CAAC,QAAQ,CAAC,eAAe,2SAC2Q;IAC1S,MAAM,CAAC,QAAQ,CAAC,KAAK,gBAAgB;gBAEzB,MAAM,EAAE,2BAA2B,EAAE,OAAO,CAAC,EAAE,aAAa;cAIxD,aAAa,CAE3B,QAAQ,CAAC,EAAE,aAAa,GACvB,OAAO,CAAC,sBAAsB,CAAC;IA2LlC;;OAEG;IACH,OAAO,CAAC,0BAA0B;CA2CnC"}
@@ -0,0 +1,297 @@
1
+ import { z } from 'zod';
2
+ import { WorkflowBubble } from '../../types/workflow-bubble-class.js';
3
+ import { PostgreSQLBubble } from '../service-bubble/postgresql.js';
4
+ import { CredentialType } from '@bubblelab/shared-schemas';
5
+ // Parameter schema with user-friendly names and clear descriptions
6
+ const DatabaseAnalyzerParamsSchema = z.object({
7
+ /**
8
+ * The data source service to analyze (currently supports 'postgresql')
9
+ */
10
+ dataSourceType: z
11
+ .enum(['postgresql'])
12
+ .describe('Data source type to analyze'),
13
+ /**
14
+ * Whether to ignore SSL certificate errors when connecting
15
+ */
16
+ ignoreSSLErrors: z
17
+ .boolean()
18
+ .default(false)
19
+ .describe('Ignore SSL certificate errors'),
20
+ /**
21
+ * Include additional metadata like enum values and constraints
22
+ */
23
+ includeMetadata: z
24
+ .boolean()
25
+ .default(true)
26
+ .describe('Include enum values and column constraints'),
27
+ /**
28
+ * Injected credentials from the system
29
+ */
30
+ credentials: z
31
+ .record(z.nativeEnum(CredentialType), z.string())
32
+ .optional()
33
+ .describe('Object mapping credential types to values (injected at runtime)'),
34
+ /**
35
+ * Injected metadata from user credentials (database schema notes and rules)
36
+ */
37
+ injectedMetadata: z
38
+ .object({
39
+ tables: z.record(z.string(), z.record(z.string(), z.string())).optional(),
40
+ tableNotes: z.record(z.string(), z.string()).optional(),
41
+ rules: z.array(z.string()).optional(),
42
+ })
43
+ .optional()
44
+ .describe('Additional database context injected from user credentials metadata'),
45
+ });
46
+ // Result schema with structured database schema information
47
+ const DatabaseAnalyzerResultSchema = z.object({
48
+ success: z.boolean(),
49
+ error: z.string(),
50
+ /**
51
+ * The analyzed database schema in structured format
52
+ */
53
+ databaseSchema: z
54
+ .object({
55
+ /**
56
+ * Raw schema data as returned by the database
57
+ */
58
+ rawData: z.array(z.record(z.unknown())).optional(),
59
+ /**
60
+ * Cleaned JSON string representation of the schema
61
+ */
62
+ cleanedJSON: z.string().optional(),
63
+ /**
64
+ * Number of tables found
65
+ */
66
+ tableCount: z.number().optional(),
67
+ /**
68
+ * List of table names
69
+ */
70
+ tableNames: z.array(z.string()).optional(),
71
+ })
72
+ .optional(),
73
+ /**
74
+ * Summary of the analysis operation
75
+ */
76
+ analysisSummary: z
77
+ .object({
78
+ dataSourceType: z.string(),
79
+ connectionSuccessful: z.boolean(),
80
+ analysisTimestamp: z.date(),
81
+ })
82
+ .optional(),
83
+ });
84
+ /**
85
+ * DatabaseAnalyzerWorkflowBubble - Analyzes database schema structure
86
+ *
87
+ * This workflow bubble simplifies database schema analysis by:
88
+ * 1. Connecting to the specified database
89
+ * 2. Querying the information schema to get table/column structure
90
+ * 3. Extracting metadata like enum values and constraints
91
+ * 4. Returning structured schema information ready for AI analysis
92
+ *
93
+ * Common use cases:
94
+ * - Data discovery and cataloging
95
+ * - Generating queries based on schema structure
96
+ * - Database documentation generation
97
+ * - AI-powered data analysis preparation
98
+ */
99
+ export class DatabaseAnalyzerWorkflowBubble extends WorkflowBubble {
100
+ static type = 'workflow';
101
+ static bubbleName = 'database-analyzer';
102
+ static schema = DatabaseAnalyzerParamsSchema;
103
+ static resultSchema = DatabaseAnalyzerResultSchema;
104
+ static shortDescription = 'Analyzes database schema structure and metadata';
105
+ static longDescription = 'Connects to a database and extracts comprehensive schema information including tables, columns, data types, constraints, and enum values. Perfect for AI-powered data analysis, query generation, and database documentation. Currently supports PostgreSQL with plans for additional database types.';
106
+ static alias = 'analyze-db';
107
+ constructor(params, context) {
108
+ super(params, context);
109
+ }
110
+ async performAction(
111
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
112
+ _context) {
113
+ const { dataSourceType, ignoreSSLErrors, includeMetadata, credentials, injectedMetadata, } = this.params;
114
+ try {
115
+ console.log(`[DatabaseAnalyzer] Starting schema analysis for ${dataSourceType}`);
116
+ // Currently only PostgreSQL is supported
117
+ if (dataSourceType !== 'postgresql') {
118
+ return {
119
+ success: false,
120
+ error: `Unsupported data source type: ${dataSourceType}. Currently only PostgreSQL is supported.`,
121
+ };
122
+ }
123
+ // Build the schema query based on metadata requirements
124
+ const schemaQuery = this.buildPostgreSQLSchemaQuery(includeMetadata);
125
+ // Execute the schema analysis using PostgreSQL bubble
126
+ const postgresqlBubble = new PostgreSQLBubble({
127
+ query: schemaQuery,
128
+ ignoreSSL: ignoreSSLErrors,
129
+ allowedOperations: [
130
+ 'SELECT',
131
+ 'WITH',
132
+ 'EXPLAIN',
133
+ 'ANALYZE',
134
+ 'SHOW',
135
+ 'DESCRIBE',
136
+ 'DESC',
137
+ 'CREATE',
138
+ ], // Allow analytical operations
139
+ timeout: 30000, // 30 second timeout
140
+ maxRows: 1000, // Limit to prevent excessive data
141
+ ...(credentials && { credentials }),
142
+ }, this.context);
143
+ console.log('[DatabaseAnalyzer] Executing schema query...');
144
+ const schemaResult = await postgresqlBubble.action();
145
+ if (!schemaResult.success) {
146
+ return {
147
+ success: false,
148
+ error: `Failed to analyze database schema: ${schemaResult.error}`,
149
+ };
150
+ }
151
+ // Process the schema data
152
+ const rawData = schemaResult.data?.rows;
153
+ // Extract table names with schema formatting: public schema tables have no prefix, others have schema prefix
154
+ const tableNames = rawData
155
+ ? Array.from(new Set(rawData.map((row) => {
156
+ const tableSchema = row.table_schema;
157
+ const tableName = row.table_name;
158
+ return tableSchema === 'public'
159
+ ? tableName
160
+ : `${tableSchema}.${tableName}`;
161
+ })))
162
+ : [];
163
+ // Create compact schema format: {table: {column: type}}
164
+ let compactCleanedJSON = '';
165
+ if (rawData) {
166
+ const compactSchema = {};
167
+ rawData.forEach((row) => {
168
+ const tableSchema = row.table_schema;
169
+ const tableName = row.table_name;
170
+ const columnName = row.column_name;
171
+ const dataType = row.data_type;
172
+ // Format table name: public schema tables have no prefix, others have schema prefix
173
+ const formattedTableName = tableSchema === 'public'
174
+ ? tableName
175
+ : `${tableSchema}.${tableName}`;
176
+ if (!compactSchema[formattedTableName]) {
177
+ compactSchema[formattedTableName] = {};
178
+ }
179
+ compactSchema[formattedTableName][columnName] = dataType;
180
+ });
181
+ // Merge injected metadata if available
182
+ const enhancedSchema = { ...compactSchema };
183
+ if (injectedMetadata) {
184
+ console.log('[DatabaseAnalyzer] Injecting metadata into schema...');
185
+ // Merge table column notes
186
+ if (injectedMetadata.tables) {
187
+ for (const [tableName, columns] of Object.entries(injectedMetadata.tables)) {
188
+ if (enhancedSchema[tableName]) {
189
+ // Add column notes as metadata
190
+ for (const [columnName, note] of Object.entries(columns)) {
191
+ if (enhancedSchema[tableName][columnName]) {
192
+ // Append note to column type
193
+ enhancedSchema[tableName][columnName] =
194
+ `${enhancedSchema[tableName][columnName]} /* ${note} */`;
195
+ }
196
+ }
197
+ }
198
+ }
199
+ }
200
+ // Add metadata section with strict rules and table notes
201
+ enhancedSchema._metadata = {
202
+ critical_instructions: 'STRICTLY FOLLOW ALL RULES AND TABLE NOTES BELOW. These are mandatory requirements.',
203
+ ...(injectedMetadata.rules && {
204
+ rules: [
205
+ '🚨 CRITICAL: You must strictly adhere to ALL rules listed below:',
206
+ ...injectedMetadata.rules,
207
+ ],
208
+ }),
209
+ ...(injectedMetadata.tableNotes && {
210
+ tableNotes: [
211
+ '⚠️ IMPORTANT: Pay special attention to these table descriptions and usage notes:',
212
+ ...Object.entries(injectedMetadata.tableNotes).map(([table, note]) => `${table}: ${note}`),
213
+ ],
214
+ }),
215
+ source: 'database-analyzer-with-injected-context',
216
+ };
217
+ }
218
+ // Generate ultra-compact JSON (no whitespace)
219
+ compactCleanedJSON = JSON.stringify(enhancedSchema);
220
+ console.log(`[DatabaseAnalyzer] Schema analysis completed. Found ${tableNames.length} tables. ${injectedMetadata
221
+ ? `Injected metadata ${injectedMetadata.rules?.length} rules and ${injectedMetadata.tableNotes?.length} table notes`
222
+ : ''}`);
223
+ }
224
+ return {
225
+ success: true,
226
+ error: '',
227
+ databaseSchema: {
228
+ rawData,
229
+ cleanedJSON: compactCleanedJSON,
230
+ tableCount: tableNames.length,
231
+ tableNames,
232
+ },
233
+ analysisSummary: {
234
+ dataSourceType,
235
+ connectionSuccessful: true,
236
+ analysisTimestamp: new Date(),
237
+ },
238
+ };
239
+ }
240
+ catch (error) {
241
+ console.error('[DatabaseAnalyzer] Workflow execution failed:', error);
242
+ return {
243
+ success: false,
244
+ error: `Database analysis workflow failed: ${error instanceof Error ? error.message : 'Unknown error'}`,
245
+ analysisSummary: {
246
+ dataSourceType,
247
+ connectionSuccessful: false,
248
+ analysisTimestamp: new Date(),
249
+ },
250
+ };
251
+ }
252
+ }
253
+ /**
254
+ * Builds the PostgreSQL schema query based on metadata requirements
255
+ */
256
+ buildPostgreSQLSchemaQuery(includeMetadata) {
257
+ const baseQuery = `
258
+ SELECT
259
+ t.table_schema,
260
+ t.table_name,
261
+ c.column_name,
262
+ c.data_type,
263
+ c.is_nullable,
264
+ c.column_default,
265
+ c.ordinal_position`;
266
+ const metadataQuery = includeMetadata
267
+ ? `
268
+ ,
269
+ -- Include enum values for USER-DEFINED types
270
+ CASE
271
+ WHEN c.data_type = 'USER-DEFINED' THEN (
272
+ SELECT array_to_string(array_agg(e.enumlabel ORDER BY e.enumsortorder), ', ')
273
+ FROM pg_type pt
274
+ JOIN pg_enum e ON pt.oid = e.enumtypid
275
+ WHERE pt.typname = c.udt_name
276
+ )
277
+ ELSE NULL
278
+ END as enum_values,
279
+
280
+ -- Include character maximum length for string types
281
+ c.character_maximum_length,
282
+
283
+ -- Include numeric precision and scale
284
+ c.numeric_precision,
285
+ c.numeric_scale`
286
+ : '';
287
+ const fromClause = `
288
+ FROM information_schema.tables t
289
+ JOIN information_schema.columns c ON t.table_name = c.table_name
290
+ AND t.table_schema = c.table_schema
291
+ WHERE t.table_type = 'BASE TABLE'
292
+ AND t.table_schema NOT IN ('information_schema', 'pg_catalog', 'pg_toast')
293
+ ORDER BY t.table_schema, t.table_name, c.ordinal_position`;
294
+ return baseQuery + metadataQuery + fromClause;
295
+ }
296
+ }
297
+ //# sourceMappingURL=database-analyzer.workflow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"database-analyzer.workflow.js","sourceRoot":"","sources":["../../../src/bubbles/workflow-bubble/database-analyzer.workflow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAEnE,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE3D,mEAAmE;AACnE,MAAM,4BAA4B,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C;;OAEG;IACH,cAAc,EAAE,CAAC;SACd,IAAI,CAAC,CAAC,YAAY,CAAC,CAAC;SACpB,QAAQ,CAAC,6BAA6B,CAAC;IAE1C;;OAEG;IACH,eAAe,EAAE,CAAC;SACf,OAAO,EAAE;SACT,OAAO,CAAC,KAAK,CAAC;SACd,QAAQ,CAAC,+BAA+B,CAAC;IAE5C;;OAEG;IACH,eAAe,EAAE,CAAC;SACf,OAAO,EAAE;SACT,OAAO,CAAC,IAAI,CAAC;SACb,QAAQ,CAAC,4CAA4C,CAAC;IAEzD;;OAEG;IACH,WAAW,EAAE,CAAC;SACX,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC;SAChD,QAAQ,EAAE;SACV,QAAQ,CACP,iEAAiE,CAClE;IAE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