@bubblelab/bubble-core 0.1.250 → 0.1.251

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 (67) hide show
  1. package/dist/bubble-bundle.d.ts +130 -89
  2. package/dist/bubble-factory.d.ts.map +1 -1
  3. package/dist/bubble-factory.js +3 -0
  4. package/dist/bubble-factory.js.map +1 -1
  5. package/dist/bubbles/service-bubble/agi-inc.d.ts +20 -20
  6. package/dist/bubbles/service-bubble/ai-agent.d.ts +4 -4
  7. package/dist/bubbles/service-bubble/apify/apify.d.ts +4 -4
  8. package/dist/bubbles/service-bubble/ashby/ashby.d.ts +56 -56
  9. package/dist/bubbles/service-bubble/ashby/ashby.d.ts.map +1 -1
  10. package/dist/bubbles/service-bubble/ashby/ashby.js.map +1 -1
  11. package/dist/bubbles/service-bubble/ashby/ashby.schema.d.ts +385 -385
  12. package/dist/bubbles/service-bubble/ashby/ashby.schema.d.ts.map +1 -1
  13. package/dist/bubbles/service-bubble/ashby/ashby.schema.js +6 -2
  14. package/dist/bubbles/service-bubble/ashby/ashby.schema.js.map +1 -1
  15. package/dist/bubbles/service-bubble/assembled/assembled.d.ts +6 -6
  16. package/dist/bubbles/service-bubble/attio/attio.d.ts +2 -2
  17. package/dist/bubbles/service-bubble/browserbase/browserbase.d.ts +2 -2
  18. package/dist/bubbles/service-bubble/crustdata/crustdata.d.ts +78 -78
  19. package/dist/bubbles/service-bubble/firecrawl.d.ts +176 -176
  20. package/dist/bubbles/service-bubble/followupboss.d.ts +8 -8
  21. package/dist/bubbles/service-bubble/github.d.ts +60 -60
  22. package/dist/bubbles/service-bubble/gmail.d.ts +64 -64
  23. package/dist/bubbles/service-bubble/google-calendar.d.ts +6 -6
  24. package/dist/bubbles/service-bubble/google-drive.d.ts +8 -8
  25. package/dist/bubbles/service-bubble/hubspot/hubspot.d.ts +2 -2
  26. package/dist/bubbles/service-bubble/jira/jira.d.ts +38 -38
  27. package/dist/bubbles/service-bubble/notion/notion.d.ts +376 -376
  28. package/dist/bubbles/service-bubble/posthog/posthog.d.ts +2 -2
  29. package/dist/bubbles/service-bubble/sendsafely/sendsafely.d.ts +4 -4
  30. package/dist/bubbles/service-bubble/slab/slab.d.ts +16 -16
  31. package/dist/bubbles/service-bubble/slack/slack.d.ts +102 -102
  32. package/dist/bubbles/service-bubble/snowflake/index.d.ts +4 -0
  33. package/dist/bubbles/service-bubble/snowflake/index.d.ts.map +1 -0
  34. package/dist/bubbles/service-bubble/snowflake/index.js +4 -0
  35. package/dist/bubbles/service-bubble/snowflake/index.js.map +1 -0
  36. package/dist/bubbles/service-bubble/snowflake/snowflake.d.ts +354 -0
  37. package/dist/bubbles/service-bubble/snowflake/snowflake.d.ts.map +1 -0
  38. package/dist/bubbles/service-bubble/snowflake/snowflake.js +285 -0
  39. package/dist/bubbles/service-bubble/snowflake/snowflake.js.map +1 -0
  40. package/dist/bubbles/service-bubble/snowflake/snowflake.schema.d.ts +321 -0
  41. package/dist/bubbles/service-bubble/snowflake/snowflake.schema.d.ts.map +1 -0
  42. package/dist/bubbles/service-bubble/snowflake/snowflake.schema.js +198 -0
  43. package/dist/bubbles/service-bubble/snowflake/snowflake.schema.js.map +1 -0
  44. package/dist/bubbles/service-bubble/snowflake/snowflake.utils.d.ts +44 -0
  45. package/dist/bubbles/service-bubble/snowflake/snowflake.utils.d.ts.map +1 -0
  46. package/dist/bubbles/service-bubble/snowflake/snowflake.utils.js +97 -0
  47. package/dist/bubbles/service-bubble/snowflake/snowflake.utils.js.map +1 -0
  48. package/dist/bubbles/service-bubble/stripe/stripe.d.ts +14 -14
  49. package/dist/bubbles/service-bubble/xero/xero.d.ts +2 -2
  50. package/dist/bubbles/tool-bubble/amazon-shopping-tool/amazon-shopping-tool.d.ts +2 -2
  51. package/dist/bubbles/tool-bubble/app-rankings-tool.d.ts +8 -8
  52. package/dist/bubbles/tool-bubble/bubbleflow-validation-tool.d.ts +4 -4
  53. package/dist/bubbles/tool-bubble/company-enrichment-tool.d.ts +10 -10
  54. package/dist/bubbles/tool-bubble/linkedin-tool.d.ts +12 -12
  55. package/dist/bubbles/tool-bubble/people-search-tool.d.ts +34 -34
  56. package/dist/bubbles/tool-bubble/reddit-scrape-tool.d.ts +10 -10
  57. package/dist/bubbles/tool-bubble/research-agent-tool.d.ts +4 -4
  58. package/dist/bubbles/tool-bubble/yc-scraper-tool.d.ts +4 -4
  59. package/dist/bubbles/workflow-bubble/pdf-ocr.workflow.d.ts +16 -16
  60. package/dist/bubbles/workflow-bubble/slack-data-assistant.workflow.d.ts +2 -2
  61. package/dist/bubbles/workflow-bubble/slack-formatter-agent.d.ts +10 -10
  62. package/dist/bubbles.json +516 -2
  63. package/dist/index.d.ts +3 -1
  64. package/dist/index.d.ts.map +1 -1
  65. package/dist/index.js +1 -0
  66. package/dist/index.js.map +1 -1
  67. package/package.json +2 -2
@@ -0,0 +1,4 @@
1
+ export { SnowflakeBubble } from './snowflake.js';
2
+ export { SnowflakeParamsSchema, SnowflakeResultSchema, SnowflakeColumnSchema, type SnowflakeParams, type SnowflakeResult, type SnowflakeParamsInput, } from './snowflake.schema.js';
3
+ export { parseSnowflakeCredential, generateSnowflakeJWT, getSnowflakeBaseUrl, type SnowflakeCredentials, } from './snowflake.utils.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/bubbles/service-bubble/snowflake/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,oBAAoB,GAC1B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,wBAAwB,EACxB,oBAAoB,EACpB,mBAAmB,EACnB,KAAK,oBAAoB,GAC1B,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,4 @@
1
+ export { SnowflakeBubble } from './snowflake.js';
2
+ export { SnowflakeParamsSchema, SnowflakeResultSchema, SnowflakeColumnSchema, } from './snowflake.schema.js';
3
+ export { parseSnowflakeCredential, generateSnowflakeJWT, getSnowflakeBaseUrl, } from './snowflake.utils.js';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/bubbles/service-bubble/snowflake/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,GAItB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,wBAAwB,EACxB,oBAAoB,EACpB,mBAAmB,GAEpB,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,354 @@
1
+ import { ServiceBubble } from '../../../types/service-bubble-class.js';
2
+ import type { BubbleContext } from '../../../types/bubble.js';
3
+ import { CredentialType } from '@bubblelab/shared-schemas';
4
+ import { type SnowflakeParamsInput, type SnowflakeResult } from './snowflake.schema.js';
5
+ /**
6
+ * Snowflake Service Bubble
7
+ *
8
+ * Snowflake data warehouse integration using the SQL REST API with key-pair authentication.
9
+ *
10
+ * Features:
11
+ * - Execute arbitrary SQL statements
12
+ * - List databases, schemas, and tables
13
+ * - Describe table column definitions
14
+ * - Key-pair (RSA) JWT authentication — no token expiry
15
+ *
16
+ * Credential fields (multi-field):
17
+ * - account (required): Account identifier (ORGNAME-ACCOUNTNAME from URL)
18
+ * - username (required): Snowflake login username
19
+ * - privateKey (required): RSA private key in PEM format
20
+ * - privateKeyPassword (optional): Passphrase if key is encrypted
21
+ * - warehouse (optional): Default warehouse
22
+ * - database (optional): Default database
23
+ * - schema (optional): Default schema
24
+ * - role (optional): Default role
25
+ */
26
+ export declare class SnowflakeBubble<T extends SnowflakeParamsInput = SnowflakeParamsInput> extends ServiceBubble<T, Extract<SnowflakeResult, {
27
+ operation: T['operation'];
28
+ }>> {
29
+ static readonly type: "service";
30
+ static readonly service = "snowflake";
31
+ static readonly authType: "apikey";
32
+ static readonly bubbleName = "snowflake";
33
+ static readonly schema: import("zod").ZodDiscriminatedUnion<"operation", [import("zod").ZodObject<{
34
+ operation: import("zod").ZodLiteral<"execute_sql">;
35
+ statement: import("zod").ZodString;
36
+ database: import("zod").ZodOptional<import("zod").ZodString>;
37
+ schema: import("zod").ZodOptional<import("zod").ZodString>;
38
+ warehouse: import("zod").ZodOptional<import("zod").ZodString>;
39
+ role: import("zod").ZodOptional<import("zod").ZodString>;
40
+ timeout: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodNumber>>;
41
+ credentials: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodNativeEnum<typeof CredentialType>, import("zod").ZodString>>;
42
+ }, "strip", import("zod").ZodTypeAny, {
43
+ timeout: number;
44
+ operation: "execute_sql";
45
+ statement: string;
46
+ schema?: string | undefined;
47
+ credentials?: Partial<Record<CredentialType, string>> | undefined;
48
+ role?: string | undefined;
49
+ database?: string | undefined;
50
+ warehouse?: string | undefined;
51
+ }, {
52
+ operation: "execute_sql";
53
+ statement: string;
54
+ schema?: string | undefined;
55
+ credentials?: Partial<Record<CredentialType, string>> | undefined;
56
+ timeout?: number | undefined;
57
+ role?: string | undefined;
58
+ database?: string | undefined;
59
+ warehouse?: string | undefined;
60
+ }>, import("zod").ZodObject<{
61
+ operation: import("zod").ZodLiteral<"list_databases">;
62
+ credentials: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodNativeEnum<typeof CredentialType>, import("zod").ZodString>>;
63
+ }, "strip", import("zod").ZodTypeAny, {
64
+ operation: "list_databases";
65
+ credentials?: Partial<Record<CredentialType, string>> | undefined;
66
+ }, {
67
+ operation: "list_databases";
68
+ credentials?: Partial<Record<CredentialType, string>> | undefined;
69
+ }>, import("zod").ZodObject<{
70
+ operation: import("zod").ZodLiteral<"list_schemas">;
71
+ database: import("zod").ZodString;
72
+ credentials: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodNativeEnum<typeof CredentialType>, import("zod").ZodString>>;
73
+ }, "strip", import("zod").ZodTypeAny, {
74
+ operation: "list_schemas";
75
+ database: string;
76
+ credentials?: Partial<Record<CredentialType, string>> | undefined;
77
+ }, {
78
+ operation: "list_schemas";
79
+ database: string;
80
+ credentials?: Partial<Record<CredentialType, string>> | undefined;
81
+ }>, import("zod").ZodObject<{
82
+ operation: import("zod").ZodLiteral<"list_tables">;
83
+ database: import("zod").ZodString;
84
+ schema: import("zod").ZodString;
85
+ credentials: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodNativeEnum<typeof CredentialType>, import("zod").ZodString>>;
86
+ }, "strip", import("zod").ZodTypeAny, {
87
+ schema: string;
88
+ operation: "list_tables";
89
+ database: string;
90
+ credentials?: Partial<Record<CredentialType, string>> | undefined;
91
+ }, {
92
+ schema: string;
93
+ operation: "list_tables";
94
+ database: string;
95
+ credentials?: Partial<Record<CredentialType, string>> | undefined;
96
+ }>, import("zod").ZodObject<{
97
+ operation: import("zod").ZodLiteral<"describe_table">;
98
+ database: import("zod").ZodString;
99
+ schema: import("zod").ZodString;
100
+ table: import("zod").ZodString;
101
+ credentials: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodNativeEnum<typeof CredentialType>, import("zod").ZodString>>;
102
+ }, "strip", import("zod").ZodTypeAny, {
103
+ schema: string;
104
+ operation: "describe_table";
105
+ table: string;
106
+ database: string;
107
+ credentials?: Partial<Record<CredentialType, string>> | undefined;
108
+ }, {
109
+ schema: string;
110
+ operation: "describe_table";
111
+ table: string;
112
+ database: string;
113
+ credentials?: Partial<Record<CredentialType, string>> | undefined;
114
+ }>]>;
115
+ static readonly resultSchema: import("zod").ZodDiscriminatedUnion<"operation", [import("zod").ZodObject<{
116
+ operation: import("zod").ZodLiteral<"execute_sql">;
117
+ success: import("zod").ZodBoolean;
118
+ columns: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
119
+ name: import("zod").ZodString;
120
+ type: import("zod").ZodString;
121
+ nullable: import("zod").ZodOptional<import("zod").ZodBoolean>;
122
+ }, "strip", import("zod").ZodTypeAny, {
123
+ type: string;
124
+ name: string;
125
+ nullable?: boolean | undefined;
126
+ }, {
127
+ type: string;
128
+ name: string;
129
+ nullable?: boolean | undefined;
130
+ }>, "many">>;
131
+ rows: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodArray<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodNull]>, "many">, "many">>;
132
+ num_rows: import("zod").ZodOptional<import("zod").ZodNumber>;
133
+ statement_handle: import("zod").ZodOptional<import("zod").ZodString>;
134
+ error: import("zod").ZodString;
135
+ }, "strip", import("zod").ZodTypeAny, {
136
+ error: string;
137
+ success: boolean;
138
+ operation: "execute_sql";
139
+ rows?: (string | null)[][] | undefined;
140
+ columns?: {
141
+ type: string;
142
+ name: string;
143
+ nullable?: boolean | undefined;
144
+ }[] | undefined;
145
+ num_rows?: number | undefined;
146
+ statement_handle?: string | undefined;
147
+ }, {
148
+ error: string;
149
+ success: boolean;
150
+ operation: "execute_sql";
151
+ rows?: (string | null)[][] | undefined;
152
+ columns?: {
153
+ type: string;
154
+ name: string;
155
+ nullable?: boolean | undefined;
156
+ }[] | undefined;
157
+ num_rows?: number | undefined;
158
+ statement_handle?: string | undefined;
159
+ }>, import("zod").ZodObject<{
160
+ operation: import("zod").ZodLiteral<"list_databases">;
161
+ success: import("zod").ZodBoolean;
162
+ databases: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
163
+ name: import("zod").ZodString;
164
+ owner: import("zod").ZodOptional<import("zod").ZodString>;
165
+ created_on: import("zod").ZodOptional<import("zod").ZodString>;
166
+ }, "strip", import("zod").ZodTypeAny, {
167
+ name: string;
168
+ owner?: string | undefined;
169
+ created_on?: string | undefined;
170
+ }, {
171
+ name: string;
172
+ owner?: string | undefined;
173
+ created_on?: string | undefined;
174
+ }>, "many">>;
175
+ error: import("zod").ZodString;
176
+ }, "strip", import("zod").ZodTypeAny, {
177
+ error: string;
178
+ success: boolean;
179
+ operation: "list_databases";
180
+ databases?: {
181
+ name: string;
182
+ owner?: string | undefined;
183
+ created_on?: string | undefined;
184
+ }[] | undefined;
185
+ }, {
186
+ error: string;
187
+ success: boolean;
188
+ operation: "list_databases";
189
+ databases?: {
190
+ name: string;
191
+ owner?: string | undefined;
192
+ created_on?: string | undefined;
193
+ }[] | undefined;
194
+ }>, import("zod").ZodObject<{
195
+ operation: import("zod").ZodLiteral<"list_schemas">;
196
+ success: import("zod").ZodBoolean;
197
+ schemas: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
198
+ name: import("zod").ZodString;
199
+ database_name: import("zod").ZodOptional<import("zod").ZodString>;
200
+ owner: import("zod").ZodOptional<import("zod").ZodString>;
201
+ created_on: import("zod").ZodOptional<import("zod").ZodString>;
202
+ }, "strip", import("zod").ZodTypeAny, {
203
+ name: string;
204
+ owner?: string | undefined;
205
+ created_on?: string | undefined;
206
+ database_name?: string | undefined;
207
+ }, {
208
+ name: string;
209
+ owner?: string | undefined;
210
+ created_on?: string | undefined;
211
+ database_name?: string | undefined;
212
+ }>, "many">>;
213
+ error: import("zod").ZodString;
214
+ }, "strip", import("zod").ZodTypeAny, {
215
+ error: string;
216
+ success: boolean;
217
+ operation: "list_schemas";
218
+ schemas?: {
219
+ name: string;
220
+ owner?: string | undefined;
221
+ created_on?: string | undefined;
222
+ database_name?: string | undefined;
223
+ }[] | undefined;
224
+ }, {
225
+ error: string;
226
+ success: boolean;
227
+ operation: "list_schemas";
228
+ schemas?: {
229
+ name: string;
230
+ owner?: string | undefined;
231
+ created_on?: string | undefined;
232
+ database_name?: string | undefined;
233
+ }[] | undefined;
234
+ }>, import("zod").ZodObject<{
235
+ operation: import("zod").ZodLiteral<"list_tables">;
236
+ success: import("zod").ZodBoolean;
237
+ tables: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
238
+ name: import("zod").ZodString;
239
+ database_name: import("zod").ZodOptional<import("zod").ZodString>;
240
+ schema_name: import("zod").ZodOptional<import("zod").ZodString>;
241
+ kind: import("zod").ZodOptional<import("zod").ZodString>;
242
+ rows: import("zod").ZodOptional<import("zod").ZodNumber>;
243
+ created_on: import("zod").ZodOptional<import("zod").ZodString>;
244
+ }, "strip", import("zod").ZodTypeAny, {
245
+ name: string;
246
+ rows?: number | undefined;
247
+ created_on?: string | undefined;
248
+ database_name?: string | undefined;
249
+ schema_name?: string | undefined;
250
+ kind?: string | undefined;
251
+ }, {
252
+ name: string;
253
+ rows?: number | undefined;
254
+ created_on?: string | undefined;
255
+ database_name?: string | undefined;
256
+ schema_name?: string | undefined;
257
+ kind?: string | undefined;
258
+ }>, "many">>;
259
+ error: import("zod").ZodString;
260
+ }, "strip", import("zod").ZodTypeAny, {
261
+ error: string;
262
+ success: boolean;
263
+ operation: "list_tables";
264
+ tables?: {
265
+ name: string;
266
+ rows?: number | undefined;
267
+ created_on?: string | undefined;
268
+ database_name?: string | undefined;
269
+ schema_name?: string | undefined;
270
+ kind?: string | undefined;
271
+ }[] | undefined;
272
+ }, {
273
+ error: string;
274
+ success: boolean;
275
+ operation: "list_tables";
276
+ tables?: {
277
+ name: string;
278
+ rows?: number | undefined;
279
+ created_on?: string | undefined;
280
+ database_name?: string | undefined;
281
+ schema_name?: string | undefined;
282
+ kind?: string | undefined;
283
+ }[] | undefined;
284
+ }>, import("zod").ZodObject<{
285
+ operation: import("zod").ZodLiteral<"describe_table">;
286
+ success: import("zod").ZodBoolean;
287
+ columns: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
288
+ name: import("zod").ZodString;
289
+ type: import("zod").ZodString;
290
+ nullable: import("zod").ZodOptional<import("zod").ZodBoolean>;
291
+ default: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
292
+ primary_key: import("zod").ZodOptional<import("zod").ZodBoolean>;
293
+ comment: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
294
+ }, "strip", import("zod").ZodTypeAny, {
295
+ type: string;
296
+ name: string;
297
+ default?: string | null | undefined;
298
+ nullable?: boolean | undefined;
299
+ comment?: string | null | undefined;
300
+ primary_key?: boolean | undefined;
301
+ }, {
302
+ type: string;
303
+ name: string;
304
+ default?: string | null | undefined;
305
+ nullable?: boolean | undefined;
306
+ comment?: string | null | undefined;
307
+ primary_key?: boolean | undefined;
308
+ }>, "many">>;
309
+ error: import("zod").ZodString;
310
+ }, "strip", import("zod").ZodTypeAny, {
311
+ error: string;
312
+ success: boolean;
313
+ operation: "describe_table";
314
+ columns?: {
315
+ type: string;
316
+ name: string;
317
+ default?: string | null | undefined;
318
+ nullable?: boolean | undefined;
319
+ comment?: string | null | undefined;
320
+ primary_key?: boolean | undefined;
321
+ }[] | undefined;
322
+ }, {
323
+ error: string;
324
+ success: boolean;
325
+ operation: "describe_table";
326
+ columns?: {
327
+ type: string;
328
+ name: string;
329
+ default?: string | null | undefined;
330
+ nullable?: boolean | undefined;
331
+ comment?: string | null | undefined;
332
+ primary_key?: boolean | undefined;
333
+ }[] | undefined;
334
+ }>]>;
335
+ static readonly shortDescription = "Snowflake data warehouse integration for SQL queries and metadata";
336
+ static readonly longDescription = "\n Snowflake data warehouse integration using the SQL REST API with key-pair authentication.\n\n Features:\n - Execute arbitrary SQL statements against Snowflake\n - List databases, schemas, and tables\n - Describe table column definitions\n - Key-pair (RSA) JWT authentication \u2014 no token expiry, no refresh needed\n\n Use cases:\n - Run SQL queries to fetch data from Snowflake warehouses\n - Explore database metadata (databases, schemas, tables, columns)\n - Automate data pipeline operations\n - Build reports from Snowflake data\n ";
337
+ static readonly alias = "snowflake";
338
+ constructor(params?: T, context?: BubbleContext, instanceId?: string);
339
+ testCredential(): Promise<boolean>;
340
+ protected chooseCredential(): string | undefined;
341
+ /**
342
+ * Execute a SQL statement via the Snowflake SQL API.
343
+ */
344
+ private executeStatement;
345
+ protected performAction(context?: BubbleContext): Promise<Extract<SnowflakeResult, {
346
+ operation: T['operation'];
347
+ }>>;
348
+ private executeSql;
349
+ private listDatabases;
350
+ private listSchemas;
351
+ private listTables;
352
+ private describeTable;
353
+ }
354
+ //# sourceMappingURL=snowflake.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snowflake.d.ts","sourceRoot":"","sources":["../../../../src/bubbles/service-bubble/snowflake/snowflake.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AACvE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAIL,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACrB,MAAM,uBAAuB,CAAC;AAS/B;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,eAAe,CAC1B,CAAC,SAAS,oBAAoB,GAAG,oBAAoB,CACrD,SAAQ,aAAa,CACrB,CAAC,EACD,OAAO,CAAC,eAAe,EAAE;IAAE,SAAS,EAAE,CAAC,CAAC,WAAW,CAAC,CAAA;CAAE,CAAC,CACxD;IACC,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAG,SAAS,CAAU;IAC1C,MAAM,CAAC,QAAQ,CAAC,OAAO,eAAe;IACtC,MAAM,CAAC,QAAQ,CAAC,QAAQ,EAAG,QAAQ,CAAU;IAC7C,MAAM,CAAC,QAAQ,CAAC,UAAU,eAAe;IACzC,MAAM,CAAC,QAAQ,CAAC,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAAyB;IAC/C,MAAM,CAAC,QAAQ,CAAC,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAAyB;IACrD,MAAM,CAAC,QAAQ,CAAC,gBAAgB,uEACsC;IACtE,MAAM,CAAC,QAAQ,CAAC,eAAe,qkBAc7B;IACF,MAAM,CAAC,QAAQ,CAAC,KAAK,eAAe;gBAGlC,MAAM,GAAE,CAEF,EACN,OAAO,CAAC,EAAE,aAAa,EACvB,UAAU,CAAC,EAAE,MAAM;IAKR,cAAc,IAAI,OAAO,CAAC,OAAO,CAAC;IAoC/C,SAAS,CAAC,gBAAgB,IAAI,MAAM,GAAG,SAAS;IAYhD;;OAEG;YACW,gBAAgB;cAkFd,aAAa,CAC3B,OAAO,CAAC,EAAE,aAAa,GACtB,OAAO,CAAC,OAAO,CAAC,eAAe,EAAE;QAAE,SAAS,EAAE,CAAC,CAAC,WAAW,CAAC,CAAA;KAAE,CAAC,CAAC;YAiErD,UAAU;YA2BV,aAAa;YAoBb,WAAW;YAyBX,UAAU;YA8BV,aAAa;CA8B5B"}
@@ -0,0 +1,285 @@
1
+ import { ServiceBubble } from '../../../types/service-bubble-class.js';
2
+ import { CredentialType } from '@bubblelab/shared-schemas';
3
+ import { SnowflakeParamsSchema, SnowflakeResultSchema, } from './snowflake.schema.js';
4
+ import { parseSnowflakeCredential, generateSnowflakeJWT, getSnowflakeBaseUrl, getCellByName, } from './snowflake.utils.js';
5
+ /**
6
+ * Snowflake Service Bubble
7
+ *
8
+ * Snowflake data warehouse integration using the SQL REST API with key-pair authentication.
9
+ *
10
+ * Features:
11
+ * - Execute arbitrary SQL statements
12
+ * - List databases, schemas, and tables
13
+ * - Describe table column definitions
14
+ * - Key-pair (RSA) JWT authentication — no token expiry
15
+ *
16
+ * Credential fields (multi-field):
17
+ * - account (required): Account identifier (ORGNAME-ACCOUNTNAME from URL)
18
+ * - username (required): Snowflake login username
19
+ * - privateKey (required): RSA private key in PEM format
20
+ * - privateKeyPassword (optional): Passphrase if key is encrypted
21
+ * - warehouse (optional): Default warehouse
22
+ * - database (optional): Default database
23
+ * - schema (optional): Default schema
24
+ * - role (optional): Default role
25
+ */
26
+ export class SnowflakeBubble extends ServiceBubble {
27
+ static type = 'service';
28
+ static service = 'snowflake';
29
+ static authType = 'apikey';
30
+ static bubbleName = 'snowflake';
31
+ static schema = SnowflakeParamsSchema;
32
+ static resultSchema = SnowflakeResultSchema;
33
+ static shortDescription = 'Snowflake data warehouse integration for SQL queries and metadata';
34
+ static longDescription = `
35
+ Snowflake data warehouse integration using the SQL REST API with key-pair authentication.
36
+
37
+ Features:
38
+ - Execute arbitrary SQL statements against Snowflake
39
+ - List databases, schemas, and tables
40
+ - Describe table column definitions
41
+ - Key-pair (RSA) JWT authentication — no token expiry, no refresh needed
42
+
43
+ Use cases:
44
+ - Run SQL queries to fetch data from Snowflake warehouses
45
+ - Explore database metadata (databases, schemas, tables, columns)
46
+ - Automate data pipeline operations
47
+ - Build reports from Snowflake data
48
+ `;
49
+ static alias = 'snowflake';
50
+ constructor(params = {
51
+ operation: 'list_databases',
52
+ }, context, instanceId) {
53
+ super(params, context, instanceId);
54
+ }
55
+ async testCredential() {
56
+ const credential = this.chooseCredential();
57
+ if (!credential) {
58
+ throw new Error('Snowflake credentials are required');
59
+ }
60
+ const creds = parseSnowflakeCredential(credential);
61
+ const jwt = generateSnowflakeJWT(creds);
62
+ const baseUrl = getSnowflakeBaseUrl(creds.account);
63
+ // Test by running SELECT CURRENT_USER()
64
+ const response = await fetch(`${baseUrl}/api/v2/statements`, {
65
+ method: 'POST',
66
+ headers: {
67
+ Authorization: `Bearer ${jwt}`,
68
+ 'Content-Type': 'application/json',
69
+ Accept: 'application/json',
70
+ 'X-Snowflake-Authorization-Token-Type': 'KEYPAIR_JWT',
71
+ },
72
+ body: JSON.stringify({
73
+ statement: 'SELECT CURRENT_USER()',
74
+ timeout: 30,
75
+ ...(creds.warehouse && { warehouse: creds.warehouse }),
76
+ ...(creds.role && { role: creds.role }),
77
+ }),
78
+ });
79
+ if (!response.ok) {
80
+ const text = await response.text();
81
+ throw new Error(`Snowflake credential validation failed (${response.status}): ${text}`);
82
+ }
83
+ return true;
84
+ }
85
+ chooseCredential() {
86
+ const { credentials } = this.params;
87
+ if (!credentials || typeof credentials !== 'object') {
88
+ return undefined;
89
+ }
90
+ return credentials[CredentialType.SNOWFLAKE_CRED];
91
+ }
92
+ /**
93
+ * Execute a SQL statement via the Snowflake SQL API.
94
+ */
95
+ async executeStatement(creds, statement, options) {
96
+ const jwt = generateSnowflakeJWT(creds);
97
+ const baseUrl = getSnowflakeBaseUrl(creds.account);
98
+ const body = {
99
+ statement,
100
+ timeout: options?.timeout ?? 60,
101
+ };
102
+ // Apply context: explicit params > credential defaults
103
+ const database = options?.database ?? creds.database;
104
+ const schema = options?.schema ?? creds.schema;
105
+ const warehouse = options?.warehouse ?? creds.warehouse;
106
+ const role = options?.role ?? creds.role;
107
+ if (database)
108
+ body.database = database;
109
+ if (schema)
110
+ body.schema = schema;
111
+ if (warehouse)
112
+ body.warehouse = warehouse;
113
+ if (role)
114
+ body.role = role;
115
+ const response = await fetch(`${baseUrl}/api/v2/statements`, {
116
+ method: 'POST',
117
+ headers: {
118
+ Authorization: `Bearer ${jwt}`,
119
+ 'Content-Type': 'application/json',
120
+ Accept: 'application/json',
121
+ 'X-Snowflake-Authorization-Token-Type': 'KEYPAIR_JWT',
122
+ },
123
+ body: JSON.stringify(body),
124
+ });
125
+ if (!response.ok) {
126
+ const errorText = await response.text();
127
+ let errorMessage;
128
+ try {
129
+ const errorJson = JSON.parse(errorText);
130
+ errorMessage =
131
+ errorJson.message || errorJson.error || `HTTP ${response.status}`;
132
+ }
133
+ catch {
134
+ errorMessage = errorText || `HTTP ${response.status}`;
135
+ }
136
+ throw new Error(`Snowflake API error (${response.status}): ${errorMessage}`);
137
+ }
138
+ const result = await response.json();
139
+ // Handle async execution (202 status)
140
+ if (response.status === 202) {
141
+ throw new Error('Query is still executing asynchronously. Increase the timeout or use a simpler query.');
142
+ }
143
+ return {
144
+ resultSetMetaData: result.resultSetMetaData || {
145
+ numRows: 0,
146
+ rowType: [],
147
+ },
148
+ data: result.data || [],
149
+ statementHandle: result.statementHandle || '',
150
+ };
151
+ }
152
+ async performAction(context) {
153
+ void context;
154
+ const { operation } = this.params;
155
+ try {
156
+ const credential = this.chooseCredential();
157
+ if (!credential) {
158
+ throw new Error('Snowflake credentials are required');
159
+ }
160
+ const creds = parseSnowflakeCredential(credential);
161
+ const result = await (async () => {
162
+ const parsedParams = this.params;
163
+ switch (operation) {
164
+ case 'execute_sql':
165
+ return await this.executeSql(creds, parsedParams);
166
+ case 'list_databases':
167
+ return await this.listDatabases(creds);
168
+ case 'list_schemas':
169
+ return await this.listSchemas(creds, parsedParams);
170
+ case 'list_tables':
171
+ return await this.listTables(creds, parsedParams);
172
+ case 'describe_table':
173
+ return await this.describeTable(creds, parsedParams);
174
+ default:
175
+ throw new Error(`Unsupported operation: ${operation}`);
176
+ }
177
+ })();
178
+ return result;
179
+ }
180
+ catch (error) {
181
+ return {
182
+ operation,
183
+ success: false,
184
+ error: error instanceof Error ? error.message : 'Unknown error occurred',
185
+ };
186
+ }
187
+ }
188
+ async executeSql(creds, params) {
189
+ const result = await this.executeStatement(creds, params.statement, {
190
+ database: params.database,
191
+ schema: params.schema,
192
+ warehouse: params.warehouse,
193
+ role: params.role,
194
+ timeout: params.timeout,
195
+ });
196
+ return {
197
+ operation: 'execute_sql',
198
+ success: true,
199
+ columns: result.resultSetMetaData.rowType.map((col) => ({
200
+ name: col.name,
201
+ type: col.type,
202
+ nullable: col.nullable,
203
+ })),
204
+ rows: result.data,
205
+ num_rows: result.resultSetMetaData.numRows,
206
+ statement_handle: result.statementHandle,
207
+ error: '',
208
+ };
209
+ }
210
+ async listDatabases(creds) {
211
+ const result = await this.executeStatement(creds, 'SHOW DATABASES');
212
+ const rowType = result.resultSetMetaData.rowType;
213
+ const databases = result.data.map((row) => ({
214
+ name: getCellByName(row, rowType, 'name') ?? '',
215
+ owner: getCellByName(row, rowType, 'owner'),
216
+ created_on: getCellByName(row, rowType, 'created_on'),
217
+ }));
218
+ return {
219
+ operation: 'list_databases',
220
+ success: true,
221
+ databases,
222
+ error: '',
223
+ };
224
+ }
225
+ async listSchemas(creds, params) {
226
+ const result = await this.executeStatement(creds, `SHOW SCHEMAS IN DATABASE "${params.database}"`);
227
+ const rowType = result.resultSetMetaData.rowType;
228
+ const schemas = result.data.map((row) => ({
229
+ name: getCellByName(row, rowType, 'name') ?? '',
230
+ database_name: getCellByName(row, rowType, 'database_name'),
231
+ owner: getCellByName(row, rowType, 'owner'),
232
+ created_on: getCellByName(row, rowType, 'created_on'),
233
+ }));
234
+ return {
235
+ operation: 'list_schemas',
236
+ success: true,
237
+ schemas,
238
+ error: '',
239
+ };
240
+ }
241
+ async listTables(creds, params) {
242
+ const result = await this.executeStatement(creds, `SHOW TABLES IN SCHEMA "${params.database}"."${params.schema}"`);
243
+ const rowType = result.resultSetMetaData.rowType;
244
+ const tables = result.data.map((row) => {
245
+ const rowsStr = getCellByName(row, rowType, 'rows');
246
+ return {
247
+ name: getCellByName(row, rowType, 'name') ?? '',
248
+ database_name: getCellByName(row, rowType, 'database_name'),
249
+ schema_name: getCellByName(row, rowType, 'schema_name'),
250
+ kind: getCellByName(row, rowType, 'kind'),
251
+ rows: rowsStr ? parseInt(rowsStr, 10) : undefined,
252
+ created_on: getCellByName(row, rowType, 'created_on'),
253
+ };
254
+ });
255
+ return {
256
+ operation: 'list_tables',
257
+ success: true,
258
+ tables,
259
+ error: '',
260
+ };
261
+ }
262
+ async describeTable(creds, params) {
263
+ const result = await this.executeStatement(creds, `DESCRIBE TABLE "${params.database}"."${params.schema}"."${params.table}"`);
264
+ const rowType = result.resultSetMetaData.rowType;
265
+ const columns = result.data.map((row) => {
266
+ const nullableStr = getCellByName(row, rowType, 'null?');
267
+ const pkStr = getCellByName(row, rowType, 'primary key');
268
+ return {
269
+ name: getCellByName(row, rowType, 'name') ?? '',
270
+ type: getCellByName(row, rowType, 'type') ?? '',
271
+ nullable: nullableStr ? nullableStr.toUpperCase() === 'Y' : undefined,
272
+ default: getCellByName(row, rowType, 'default') ?? null,
273
+ primary_key: pkStr ? pkStr.toUpperCase() === 'Y' : undefined,
274
+ comment: getCellByName(row, rowType, 'comment') ?? null,
275
+ };
276
+ });
277
+ return {
278
+ operation: 'describe_table',
279
+ success: true,
280
+ columns,
281
+ error: '',
282
+ };
283
+ }
284
+ }
285
+ //# sourceMappingURL=snowflake.js.map