@squadbase/connectors 0.0.13 → 0.0.15
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.
- package/dist/chunk-4K4NERCT.js +212 -0
- package/dist/index.js +306 -287
- package/dist/sdk.d.ts +343 -3
- package/dist/sdk.js +668 -11
- package/package.json +3 -2
- package/dist/chunk-E5AVUXWJ.js +0 -93
package/dist/index.js
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ParameterDefinition,
|
|
3
3
|
parameters,
|
|
4
|
-
parameters2
|
|
5
|
-
|
|
4
|
+
parameters2,
|
|
5
|
+
parameters3,
|
|
6
|
+
parameters4,
|
|
7
|
+
parameters5,
|
|
8
|
+
parameters6
|
|
9
|
+
} from "./chunk-4K4NERCT.js";
|
|
6
10
|
|
|
7
11
|
// src/connector-setup.ts
|
|
8
12
|
var ConnectorSetup = class {
|
|
@@ -150,7 +154,7 @@ var snowflakeSetup = new ConnectorSetup({
|
|
|
150
154
|
#### \u30B9\u30C6\u30C3\u30D71: \u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u9078\u629E
|
|
151
155
|
1. \`SHOW DATABASES\` \u3092\u5B9F\u884C\u3057\u3066\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u4E00\u89A7\u3092\u53D6\u5F97\u3059\u308B
|
|
152
156
|
2. \u7D50\u679C\u306B\u5FDC\u3058\u3066\u5206\u5C90:
|
|
153
|
-
- **\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u304C2\u3064\u4EE5\u4E0A**: \`askUserQuestion\`\uFF08multiSelect: true\uFF09\u3067\u30E6\u30FC\u30B6\u30FC\u306B\u63D0\u793A\u3057\u3001\u4F7F\u7528\u3059\u308B\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u3092\u9078\u629E\u3055\u305B\u308B
|
|
157
|
+
- **\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u304C2\u3064\u4EE5\u4E0A**: \`askUserQuestion\`\uFF08multiSelect: true\uFF09\u3067\u30E6\u30FC\u30B6\u30FC\u306B\u63D0\u793A\u3057\u3001\u4F7F\u7528\u3059\u308B\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u3092\u9078\u629E\u3055\u305B\u308B\u3002**\u53D6\u5F97\u3057\u305F\u5168\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u3092\u9078\u629E\u80A2\u306B\u542B\u3081\u308B\u3053\u3068\u3002\u4EFB\u610F\u306B\u30D5\u30A3\u30EB\u30BF\u3084\u7701\u7565\u3092\u3057\u3066\u306F\u306A\u3089\u306A\u3044**
|
|
154
158
|
- **\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u304C1\u3064\u3060\u3051**: askUserQuestion \u306F\u4F7F\u308F\u305A\u81EA\u52D5\u63A1\u7528\u3002\u300C\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9 X \u3092\u81EA\u52D5\u9078\u629E\u3057\u307E\u3057\u305F\u300D\u30681\u6587\u3060\u3051\u66F8\u304F
|
|
155
159
|
|
|
156
160
|
#### \u30B9\u30C6\u30C3\u30D72: \u30B9\u30AD\u30FC\u30DE\u9078\u629E\uFF08\u30C6\u30FC\u30D6\u30EB\u7BC4\u56F2\u306E\u6307\u5B9A\u3092\u542B\u3080\uFF09
|
|
@@ -160,12 +164,13 @@ var snowflakeSetup = new ConnectorSetup({
|
|
|
160
164
|
- \`{schema}\uFF08\u5168\u30C6\u30FC\u30D6\u30EB\uFF09\` \u2014 description: "{database}.{schema} \u5185\u306E\u5168\u30C6\u30FC\u30D6\u30EB\u3092\u4F7F\u7528"
|
|
161
165
|
- \`{schema}\uFF08\u7279\u5B9A\u30C6\u30FC\u30D6\u30EB\u3092\u9078\u629E\uFF09\` \u2014 description: "{database}.{schema} \u5185\u306E\u7279\u5B9A\u30C6\u30FC\u30D6\u30EB\u306E\u307F\u4F7F\u7528"
|
|
162
166
|
- \u30B9\u30AD\u30FC\u30DE\u304C1\u3064\u3060\u3051\u306E\u5834\u5408\u3082\u3001\u300C\u5168\u30C6\u30FC\u30D6\u30EB\u300D\u3068\u300C\u7279\u5B9A\u30C6\u30FC\u30D6\u30EB\u3092\u9078\u629E\u300D\u306E2\u3064\u306E\u9078\u629E\u80A2\u3092\u63D0\u793A\u3059\u308B\u3053\u3068
|
|
167
|
+
- **INFORMATION_SCHEMA \u4EE5\u5916\u306E\u5168\u30B9\u30AD\u30FC\u30DE\u3092\u9078\u629E\u80A2\u306B\u542B\u3081\u308B\u3053\u3068\u3002\u4EFB\u610F\u306B\u30D5\u30A3\u30EB\u30BF\u3084\u7701\u7565\u3092\u3057\u3066\u306F\u306A\u3089\u306A\u3044**
|
|
163
168
|
|
|
164
169
|
#### \u30B9\u30C6\u30C3\u30D73: \u30C6\u30FC\u30D6\u30EB\u9078\u629E\uFF08\u300C\u7279\u5B9A\u30C6\u30FC\u30D6\u30EB\u3092\u9078\u629E\u300D\u304C\u9078\u3070\u308C\u305F\u30B9\u30AD\u30FC\u30DE\u306E\u307F\uFF09
|
|
165
170
|
6. \u300C\u5168\u30C6\u30FC\u30D6\u30EB\u300D\u304C\u9078\u3070\u308C\u305F\u30B9\u30AD\u30FC\u30DE\u306F\u30C6\u30FC\u30D6\u30EB\u9078\u629E\u3092\u30B9\u30AD\u30C3\u30D7\u3057\u3001\u5168\u30C6\u30FC\u30D6\u30EB\u3092\u5BFE\u8C61\u3068\u3059\u308B
|
|
166
171
|
7. \u300C\u7279\u5B9A\u30C6\u30FC\u30D6\u30EB\u3092\u9078\u629E\u300D\u304C\u9078\u3070\u308C\u305F\u30B9\u30AD\u30FC\u30DE\u306B\u5BFE\u3057\u3066\u306E\u307F \`SHOW TABLES IN SCHEMA {database}.{schema}\` \u3092\u5B9F\u884C\u3057\u3066\u30C6\u30FC\u30D6\u30EB\u4E00\u89A7\u3092\u53D6\u5F97\u3059\u308B
|
|
167
172
|
8. \u7D50\u679C\u306B\u5FDC\u3058\u3066\u5206\u5C90:
|
|
168
|
-
- **\u30C6\u30FC\u30D6\u30EB\u304C2\u3064\u4EE5\u4E0A**: \`askUserQuestion\`\uFF08multiSelect: true\uFF09\u3067\u30E6\u30FC\u30B6\u30FC\u306B\u63D0\u793A\u3057\u3001\u4F7F\u7528\u3059\u308B\u30C6\u30FC\u30D6\u30EB\u3092\u9078\u629E\u3055\u305B\u308B\u3002description \u306B\u306F\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u540D.\u30B9\u30AD\u30FC\u30DE\u540D\u3092\u8A18\u8F09\u3059\u308B
|
|
173
|
+
- **\u30C6\u30FC\u30D6\u30EB\u304C2\u3064\u4EE5\u4E0A**: \`askUserQuestion\`\uFF08multiSelect: true\uFF09\u3067\u30E6\u30FC\u30B6\u30FC\u306B\u63D0\u793A\u3057\u3001\u4F7F\u7528\u3059\u308B\u30C6\u30FC\u30D6\u30EB\u3092\u9078\u629E\u3055\u305B\u308B\u3002description \u306B\u306F\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u540D.\u30B9\u30AD\u30FC\u30DE\u540D\u3092\u8A18\u8F09\u3059\u308B\u3002**\u53D6\u5F97\u3057\u305F\u5168\u30C6\u30FC\u30D6\u30EB\u3092\u9078\u629E\u80A2\u306B\u542B\u3081\u308B\u3053\u3068\u3002\u4EFB\u610F\u306B\u30D5\u30A3\u30EB\u30BF\u3084\u7701\u7565\u3092\u3057\u3066\u306F\u306A\u3089\u306A\u3044**
|
|
169
174
|
- **\u30C6\u30FC\u30D6\u30EB\u304C1\u3064\u3060\u3051**: askUserQuestion \u306F\u4F7F\u308F\u305A\u81EA\u52D5\u63A1\u7528
|
|
170
175
|
|
|
171
176
|
#### \u30B9\u30C6\u30C3\u30D74: \u4FDD\u5B58
|
|
@@ -191,7 +196,7 @@ Follow these steps to set up the Snowflake connection.
|
|
|
191
196
|
#### Step 1: Database Selection
|
|
192
197
|
1. Run \`SHOW DATABASES\` to get the list of databases
|
|
193
198
|
2. Branch based on results:
|
|
194
|
-
- **2 or more databases**: Present them to the user via \`askUserQuestion\` (multiSelect: true) and let them select which databases to use
|
|
199
|
+
- **2 or more databases**: Present them to the user via \`askUserQuestion\` (multiSelect: true) and let them select which databases to use. **Include ALL databases from the query results as options. Do NOT filter or omit any databases**
|
|
195
200
|
- **Exactly 1 database**: Do NOT call askUserQuestion. Auto-select it. Just write "Auto-selected database X" in one sentence
|
|
196
201
|
|
|
197
202
|
#### Step 2: Schema Selection (including table scope)
|
|
@@ -201,12 +206,13 @@ Follow these steps to set up the Snowflake connection.
|
|
|
201
206
|
- \`{schema} (all tables)\` \u2014 description: "Use all tables in {database}.{schema}"
|
|
202
207
|
- \`{schema} (select specific tables)\` \u2014 description: "Use only specific tables in {database}.{schema}"
|
|
203
208
|
- Even if there is only 1 schema, present both "all tables" and "select specific tables" options
|
|
209
|
+
- **Include ALL schemas except INFORMATION_SCHEMA as options. Do NOT filter or omit any schemas**
|
|
204
210
|
|
|
205
211
|
#### Step 3: Table Selection (only for schemas where "select specific tables" was chosen)
|
|
206
212
|
6. For schemas where "all tables" was chosen, skip table selection and include all tables
|
|
207
213
|
7. For schemas where "select specific tables" was chosen, run \`SHOW TABLES IN SCHEMA {database}.{schema}\` to get the table list
|
|
208
214
|
8. Branch based on results:
|
|
209
|
-
- **2 or more tables**: Present them to the user via \`askUserQuestion\` (multiSelect: true) and let them select which tables to use. Include database.schema in the description
|
|
215
|
+
- **2 or more tables**: Present them to the user via \`askUserQuestion\` (multiSelect: true) and let them select which tables to use. Include database.schema in the description. **Include ALL tables from the query results as options. Do NOT filter or omit any tables**
|
|
210
216
|
- **Exactly 1 table**: Do NOT call askUserQuestion. Auto-select it
|
|
211
217
|
|
|
212
218
|
#### Step 4: Save
|
|
@@ -226,11 +232,11 @@ Follow these steps to set up the Snowflake connection.
|
|
|
226
232
|
});
|
|
227
233
|
|
|
228
234
|
// src/connectors/snowflake/parameters.ts
|
|
229
|
-
var
|
|
235
|
+
var parameters7 = {
|
|
230
236
|
account: new ParameterDefinition({
|
|
231
237
|
slug: "account",
|
|
232
238
|
name: "Snowflake Account",
|
|
233
|
-
description: "The Snowflake account identifier (e.g., xy12345
|
|
239
|
+
description: "The Snowflake account identifier in ORGNAME-ACCOUNTNAME format (e.g., myorg-xy12345).",
|
|
234
240
|
envVarBaseKey: "SNOWFLAKE_ACCOUNT",
|
|
235
241
|
type: "text",
|
|
236
242
|
secret: false,
|
|
@@ -342,15 +348,15 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
342
348
|
try {
|
|
343
349
|
const snowflake = (await import("snowflake-sdk")).default;
|
|
344
350
|
snowflake.configure({ logLevel: "ERROR" });
|
|
345
|
-
const account =
|
|
346
|
-
const user =
|
|
347
|
-
const role =
|
|
348
|
-
const warehouse =
|
|
349
|
-
const privateKeyBase64 =
|
|
351
|
+
const account = parameters7.account.getValue(connection);
|
|
352
|
+
const user = parameters7.user.getValue(connection);
|
|
353
|
+
const role = parameters7.role.getValue(connection);
|
|
354
|
+
const warehouse = parameters7.warehouse.getValue(connection);
|
|
355
|
+
const privateKeyBase64 = parameters7.privateKeyBase64.getValue(connection);
|
|
350
356
|
const privateKeyPem = Buffer.from(privateKeyBase64, "base64").toString(
|
|
351
357
|
"utf-8"
|
|
352
358
|
);
|
|
353
|
-
const privateKeyPass =
|
|
359
|
+
const privateKeyPass = parameters7.privateKeyPassphrase.tryGetValue(connection);
|
|
354
360
|
const privateKey = decryptPrivateKey(privateKeyPem, privateKeyPass ?? void 0);
|
|
355
361
|
const conn = snowflake.createConnection({
|
|
356
362
|
account,
|
|
@@ -415,7 +421,7 @@ var snowflakeConnector = new ConnectorPlugin({
|
|
|
415
421
|
name: "Snowflake",
|
|
416
422
|
description: "Connect to Snowflake for cloud data warehousing and analytics.",
|
|
417
423
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/6oyVtAcP3pMlXaOrts9unk/b7a9dc25d15c388b66e983041b855447/snowflake.svg",
|
|
418
|
-
parameters:
|
|
424
|
+
parameters: parameters7,
|
|
419
425
|
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
420
426
|
setup: snowflakeSetup,
|
|
421
427
|
systemPrompt: `## Snowflake SQL Notes
|
|
@@ -432,16 +438,16 @@ var snowflakeConnector = new ConnectorPlugin({
|
|
|
432
438
|
const snowflake = (await import("snowflake-sdk")).default;
|
|
433
439
|
snowflake.configure({ logLevel: "ERROR" });
|
|
434
440
|
const privateKeyPem = Buffer.from(
|
|
435
|
-
params[
|
|
441
|
+
params[parameters7.privateKeyBase64.slug],
|
|
436
442
|
"base64"
|
|
437
443
|
).toString("utf-8");
|
|
438
|
-
const privateKeyPass = params[
|
|
444
|
+
const privateKeyPass = params[parameters7.privateKeyPassphrase.slug] || void 0;
|
|
439
445
|
const privateKey = decryptPrivateKey(privateKeyPem, privateKeyPass);
|
|
440
446
|
const conn = snowflake.createConnection({
|
|
441
|
-
account: params[
|
|
442
|
-
username: params[
|
|
443
|
-
role: params[
|
|
444
|
-
warehouse: params[
|
|
447
|
+
account: params[parameters7.account.slug],
|
|
448
|
+
username: params[parameters7.user.slug],
|
|
449
|
+
role: params[parameters7.role.slug],
|
|
450
|
+
warehouse: params[parameters7.warehouse.slug],
|
|
445
451
|
authenticator: "SNOWFLAKE_JWT",
|
|
446
452
|
privateKey
|
|
447
453
|
});
|
|
@@ -473,16 +479,16 @@ var snowflakeConnector = new ConnectorPlugin({
|
|
|
473
479
|
const snowflake = (await import("snowflake-sdk")).default;
|
|
474
480
|
snowflake.configure({ logLevel: "ERROR" });
|
|
475
481
|
const privateKeyPem = Buffer.from(
|
|
476
|
-
params[
|
|
482
|
+
params[parameters7.privateKeyBase64.slug],
|
|
477
483
|
"base64"
|
|
478
484
|
).toString("utf-8");
|
|
479
|
-
const privateKeyPass = params[
|
|
485
|
+
const privateKeyPass = params[parameters7.privateKeyPassphrase.slug] || void 0;
|
|
480
486
|
const privateKey = decryptPrivateKey(privateKeyPem, privateKeyPass);
|
|
481
487
|
const conn = snowflake.createConnection({
|
|
482
|
-
account: params[
|
|
483
|
-
username: params[
|
|
484
|
-
role: params[
|
|
485
|
-
warehouse: params[
|
|
488
|
+
account: params[parameters7.account.slug],
|
|
489
|
+
username: params[parameters7.user.slug],
|
|
490
|
+
role: params[parameters7.role.slug],
|
|
491
|
+
warehouse: params[parameters7.warehouse.slug],
|
|
486
492
|
authenticator: "SNOWFLAKE_JWT",
|
|
487
493
|
privateKey
|
|
488
494
|
});
|
|
@@ -511,11 +517,11 @@ var snowflakeConnector = new ConnectorPlugin({
|
|
|
511
517
|
});
|
|
512
518
|
|
|
513
519
|
// src/connectors/snowflake-pat/parameters.ts
|
|
514
|
-
var
|
|
520
|
+
var parameters8 = {
|
|
515
521
|
account: new ParameterDefinition({
|
|
516
522
|
slug: "account",
|
|
517
523
|
name: "Snowflake Account",
|
|
518
|
-
description: "The Snowflake account identifier (e.g., xy12345
|
|
524
|
+
description: "The Snowflake account identifier in ORGNAME-ACCOUNTNAME format (e.g., myorg-xy12345).",
|
|
519
525
|
envVarBaseKey: "SNOWFLAKE_ACCOUNT",
|
|
520
526
|
type: "text",
|
|
521
527
|
secret: false,
|
|
@@ -605,11 +611,11 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
605
611
|
try {
|
|
606
612
|
const snowflake = (await import("snowflake-sdk")).default;
|
|
607
613
|
snowflake.configure({ logLevel: "ERROR" });
|
|
608
|
-
const account =
|
|
609
|
-
const user =
|
|
610
|
-
const role =
|
|
611
|
-
const warehouse =
|
|
612
|
-
const password =
|
|
614
|
+
const account = parameters8.account.getValue(connection);
|
|
615
|
+
const user = parameters8.user.getValue(connection);
|
|
616
|
+
const role = parameters8.role.getValue(connection);
|
|
617
|
+
const warehouse = parameters8.warehouse.getValue(connection);
|
|
618
|
+
const password = parameters8.pat.getValue(connection);
|
|
613
619
|
const conn = snowflake.createConnection({
|
|
614
620
|
account,
|
|
615
621
|
username: user,
|
|
@@ -672,7 +678,7 @@ var snowflakePatConnector = new ConnectorPlugin({
|
|
|
672
678
|
name: "Snowflake (PAT)",
|
|
673
679
|
description: "Connect to Snowflake using a Personal Access Token (PAT).",
|
|
674
680
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/6oyVtAcP3pMlXaOrts9unk/b7a9dc25d15c388b66e983041b855447/snowflake.svg",
|
|
675
|
-
parameters:
|
|
681
|
+
parameters: parameters8,
|
|
676
682
|
releaseFlag: { dev1: true, dev2: false, prod: false },
|
|
677
683
|
setup: snowflakeSetup,
|
|
678
684
|
systemPrompt: `## Snowflake SQL Notes
|
|
@@ -689,11 +695,11 @@ var snowflakePatConnector = new ConnectorPlugin({
|
|
|
689
695
|
const snowflake = (await import("snowflake-sdk")).default;
|
|
690
696
|
snowflake.configure({ logLevel: "ERROR" });
|
|
691
697
|
const conn = snowflake.createConnection({
|
|
692
|
-
account: params[
|
|
693
|
-
username: params[
|
|
694
|
-
role: params[
|
|
695
|
-
warehouse: params[
|
|
696
|
-
password: params[
|
|
698
|
+
account: params[parameters8.account.slug],
|
|
699
|
+
username: params[parameters8.user.slug],
|
|
700
|
+
role: params[parameters8.role.slug],
|
|
701
|
+
warehouse: params[parameters8.warehouse.slug],
|
|
702
|
+
password: params[parameters8.pat.slug]
|
|
697
703
|
});
|
|
698
704
|
await new Promise((resolve, reject) => {
|
|
699
705
|
conn.connect((err) => {
|
|
@@ -728,11 +734,11 @@ var snowflakePatConnector = new ConnectorPlugin({
|
|
|
728
734
|
const snowflake = (await import("snowflake-sdk")).default;
|
|
729
735
|
snowflake.configure({ logLevel: "ERROR" });
|
|
730
736
|
const conn = snowflake.createConnection({
|
|
731
|
-
account: params[
|
|
732
|
-
username: params[
|
|
733
|
-
role: params[
|
|
734
|
-
warehouse: params[
|
|
735
|
-
password: params[
|
|
737
|
+
account: params[parameters8.account.slug],
|
|
738
|
+
username: params[parameters8.user.slug],
|
|
739
|
+
role: params[parameters8.role.slug],
|
|
740
|
+
warehouse: params[parameters8.warehouse.slug],
|
|
741
|
+
password: params[parameters8.pat.slug]
|
|
736
742
|
});
|
|
737
743
|
await new Promise((resolve, reject) => {
|
|
738
744
|
conn.connect((err) => {
|
|
@@ -764,7 +770,7 @@ var snowflakePatConnector = new ConnectorPlugin({
|
|
|
764
770
|
});
|
|
765
771
|
|
|
766
772
|
// src/connectors/postgresql/parameters.ts
|
|
767
|
-
var
|
|
773
|
+
var parameters9 = {
|
|
768
774
|
connectionUrl: new ParameterDefinition({
|
|
769
775
|
slug: "connection-url",
|
|
770
776
|
name: "PostgreSQL Connection URL",
|
|
@@ -821,7 +827,7 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
821
827
|
let connectionUrl;
|
|
822
828
|
try {
|
|
823
829
|
const { Pool } = await import("pg");
|
|
824
|
-
connectionUrl =
|
|
830
|
+
connectionUrl = parameters9.connectionUrl.getValue(connection);
|
|
825
831
|
const pool = new Pool({
|
|
826
832
|
connectionString: connectionUrl,
|
|
827
833
|
ssl: { rejectUnauthorized: false },
|
|
@@ -859,7 +865,7 @@ var postgresqlConnector = new ConnectorPlugin({
|
|
|
859
865
|
name: "PostgreSQL",
|
|
860
866
|
description: "Connect to PostgreSQL databases for relational data storage and querying.",
|
|
861
867
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/42AHi2uqteUn65MyqdN6V7/a0f68f12af6aac96bbcda5980f43de07/elephant.png",
|
|
862
|
-
parameters:
|
|
868
|
+
parameters: parameters9,
|
|
863
869
|
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
864
870
|
systemPrompt: `## PostgreSQL SQL Notes
|
|
865
871
|
- Schema exploration:
|
|
@@ -870,7 +876,7 @@ var postgresqlConnector = new ConnectorPlugin({
|
|
|
870
876
|
async checkConnection(params, _config) {
|
|
871
877
|
const { Pool } = await import("pg");
|
|
872
878
|
const pool = new Pool({
|
|
873
|
-
connectionString: params[
|
|
879
|
+
connectionString: params[parameters9.connectionUrl.slug],
|
|
874
880
|
ssl: { rejectUnauthorized: false },
|
|
875
881
|
connectionTimeoutMillis: 1e4
|
|
876
882
|
});
|
|
@@ -887,7 +893,7 @@ var postgresqlConnector = new ConnectorPlugin({
|
|
|
887
893
|
const { Pool } = await import("pg");
|
|
888
894
|
const { text, values } = buildPositionalParams(sql, namedParams);
|
|
889
895
|
const pool = new Pool({
|
|
890
|
-
connectionString: params[
|
|
896
|
+
connectionString: params[parameters9.connectionUrl.slug],
|
|
891
897
|
ssl: { rejectUnauthorized: false },
|
|
892
898
|
connectionTimeoutMillis: 1e4,
|
|
893
899
|
statement_timeout: 6e4
|
|
@@ -902,7 +908,7 @@ var postgresqlConnector = new ConnectorPlugin({
|
|
|
902
908
|
});
|
|
903
909
|
|
|
904
910
|
// src/connectors/mysql/parameters.ts
|
|
905
|
-
var
|
|
911
|
+
var parameters10 = {
|
|
906
912
|
connectionUrl: new ParameterDefinition({
|
|
907
913
|
slug: "connection-url",
|
|
908
914
|
name: "MySQL Connection URL",
|
|
@@ -959,7 +965,7 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
959
965
|
let connectionUrl;
|
|
960
966
|
try {
|
|
961
967
|
const mysql = await import("mysql2/promise");
|
|
962
|
-
connectionUrl =
|
|
968
|
+
connectionUrl = parameters10.connectionUrl.getValue(connection);
|
|
963
969
|
const pool = mysql.createPool({
|
|
964
970
|
uri: connectionUrl,
|
|
965
971
|
connectTimeout: CONNECT_TIMEOUT_MS2
|
|
@@ -999,7 +1005,7 @@ var mysqlConnector = new ConnectorPlugin({
|
|
|
999
1005
|
name: "MySQL",
|
|
1000
1006
|
description: "Connect to MySQL databases for relational data storage and querying.",
|
|
1001
1007
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/6ghPFeGgl7uBs5NHH1a4L/512c9433beec5b595caa41f04921c1f9/logo-mysql-170x115.png",
|
|
1002
|
-
parameters:
|
|
1008
|
+
parameters: parameters10,
|
|
1003
1009
|
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
1004
1010
|
systemPrompt: `## MySQL SQL Notes
|
|
1005
1011
|
- Schema exploration:
|
|
@@ -1010,7 +1016,7 @@ var mysqlConnector = new ConnectorPlugin({
|
|
|
1010
1016
|
async checkConnection(params, _config) {
|
|
1011
1017
|
const mysql = await import("mysql2/promise");
|
|
1012
1018
|
const pool = mysql.createPool({
|
|
1013
|
-
uri: params[
|
|
1019
|
+
uri: params[parameters10.connectionUrl.slug],
|
|
1014
1020
|
connectTimeout: 1e4
|
|
1015
1021
|
});
|
|
1016
1022
|
try {
|
|
@@ -1026,7 +1032,7 @@ var mysqlConnector = new ConnectorPlugin({
|
|
|
1026
1032
|
const mysql = await import("mysql2/promise");
|
|
1027
1033
|
const { text, values } = buildQuestionmarkParams(sql, namedParams);
|
|
1028
1034
|
const pool = mysql.createPool({
|
|
1029
|
-
uri: params[
|
|
1035
|
+
uri: params[parameters10.connectionUrl.slug],
|
|
1030
1036
|
connectTimeout: 1e4
|
|
1031
1037
|
});
|
|
1032
1038
|
try {
|
|
@@ -1047,7 +1053,7 @@ var mysqlConnector = new ConnectorPlugin({
|
|
|
1047
1053
|
import { z as z5 } from "zod";
|
|
1048
1054
|
|
|
1049
1055
|
// src/connectors/bigquery/parameters.ts
|
|
1050
|
-
var
|
|
1056
|
+
var parameters11 = {
|
|
1051
1057
|
serviceAccountKeyJsonBase64: new ParameterDefinition({
|
|
1052
1058
|
slug: "service-account-key-json-base64",
|
|
1053
1059
|
name: "Google Cloud Service Account JSON",
|
|
@@ -1104,7 +1110,7 @@ var listProjectsTool = new ConnectorTool({
|
|
|
1104
1110
|
};
|
|
1105
1111
|
}
|
|
1106
1112
|
try {
|
|
1107
|
-
const serviceAccountJsonBase64 =
|
|
1113
|
+
const serviceAccountJsonBase64 = parameters11.serviceAccountKeyJsonBase64.getValue(connection);
|
|
1108
1114
|
const credentials = JSON.parse(
|
|
1109
1115
|
Buffer.from(serviceAccountJsonBase64, "base64").toString("utf-8")
|
|
1110
1116
|
);
|
|
@@ -1142,19 +1148,21 @@ var bigquerySetup = new ConnectorSetup({
|
|
|
1142
1148
|
1. \`${listProjectsToolName}\` \u3092\u547C\u3073\u51FA\u3057\u3066\u3001\u30B5\u30FC\u30D3\u30B9\u30A2\u30AB\u30A6\u30F3\u30C8\u304C\u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u306AGCP\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u4E00\u89A7\u3092\u53D6\u5F97\u3059\u308B
|
|
1143
1149
|
2. \`updateConnectionParameters\` \u3092\u547C\u3073\u51FA\u3059:
|
|
1144
1150
|
- \`parameterSlug\`: \`"project-id"\`
|
|
1145
|
-
- \`options\`: \u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u4E00\u89A7\u3002\u5404 option \u306E \`label\` \u306F \`\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u540D (id: \u30D7\u30ED\u30B8\u30A7\u30AF\u30C8ID)\` \u306E\u5F62\u5F0F\u3001\`value\` \u306F\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8ID
|
|
1151
|
+
- \`options\`: \u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u4E00\u89A7 + \u30D1\u30D6\u30EA\u30C3\u30AF\u30C7\u30FC\u30BF\u306E\u56FA\u5B9A\u9078\u629E\u80A2\u3002\u5404 option \u306E \`label\` \u306F \`\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u540D (id: \u30D7\u30ED\u30B8\u30A7\u30AF\u30C8ID)\` \u306E\u5F62\u5F0F\u3001\`value\` \u306F\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8ID\u3002**\u672B\u5C3E\u306B\u5FC5\u305A** \`{ value: "bigquery-public-data", label: "Public Data (id: bigquery-public-data)" }\` \u3092\u8FFD\u52A0\u3059\u308B\u3053\u3068
|
|
1146
1152
|
3. \u30E6\u30FC\u30B6\u30FC\u304C\u9078\u629E\u3057\u305F\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306E \`label\` \u304C\u30E1\u30C3\u30BB\u30FC\u30B8\u3068\u3057\u3066\u5C4A\u304F\u306E\u3067\u3001\u30B9\u30C6\u30C3\u30D72\u306B\u9032\u3080
|
|
1147
1153
|
|
|
1148
1154
|
#### \u30B9\u30C6\u30C3\u30D72: \u30C7\u30FC\u30BF\u30BB\u30C3\u30C8\u9078\u629E
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1155
|
+
- **\`bigquery-public-data\` \u304C\u9078\u629E\u3055\u308C\u305F\u5834\u5408**: \`INFORMATION_SCHEMA.SCHEMATA\` \u306F\u5B9F\u884C\u3057\u306A\u3044\u3002\`askUserQuestion\`\uFF08allowFreeText: true, options \u306A\u3057\uFF09\u3067\u30E6\u30FC\u30B6\u30FC\u306B\u30C7\u30FC\u30BF\u30BB\u30C3\u30C8\u540D\u3092\u76F4\u63A5\u5165\u529B\u3055\u305B\u308B
|
|
1156
|
+
- **\u305D\u308C\u4EE5\u5916\u306E\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8**:
|
|
1157
|
+
1. \`SELECT schema_name FROM INFORMATION_SCHEMA.SCHEMATA\` \u3092\u5B9F\u884C\u3057\u3066\u30C7\u30FC\u30BF\u30BB\u30C3\u30C8\u4E00\u89A7\u3092\u53D6\u5F97\u3059\u308B
|
|
1158
|
+
2. \u7D50\u679C\u306B\u5FDC\u3058\u3066\u5206\u5C90:
|
|
1159
|
+
- **\u30C7\u30FC\u30BF\u30BB\u30C3\u30C8\u304C2\u3064\u4EE5\u4E0A**: \`askUserQuestion\`\uFF08multiSelect: true\uFF09\u3067\u30E6\u30FC\u30B6\u30FC\u306B\u63D0\u793A\u3057\u3001\u4F7F\u7528\u3059\u308B\u30C7\u30FC\u30BF\u30BB\u30C3\u30C8\u3092\u9078\u629E\u3055\u305B\u308B\u3002**\u53D6\u5F97\u3057\u305F\u5168\u30C7\u30FC\u30BF\u30BB\u30C3\u30C8\u3092\u9078\u629E\u80A2\u306B\u542B\u3081\u308B\u3053\u3068\u3002\u4EFB\u610F\u306B\u30D5\u30A3\u30EB\u30BF\u3084\u7701\u7565\u3092\u3057\u3066\u306F\u306A\u3089\u306A\u3044**
|
|
1160
|
+
- **\u30C7\u30FC\u30BF\u30BB\u30C3\u30C8\u304C1\u3064\u3060\u3051**: askUserQuestion \u306F\u4F7F\u308F\u305A\u81EA\u52D5\u63A1\u7528\u3002\u300C\u30C7\u30FC\u30BF\u30BB\u30C3\u30C8 X \u3092\u81EA\u52D5\u9078\u629E\u3057\u307E\u3057\u305F\u300D\u30681\u6587\u3060\u3051\u66F8\u304F
|
|
1153
1161
|
|
|
1154
1162
|
#### \u30B9\u30C6\u30C3\u30D73: \u30C6\u30FC\u30D6\u30EB\u9078\u629E
|
|
1155
1163
|
3. \u9078\u629E\u3055\u308C\u305F\u30C7\u30FC\u30BF\u30BB\u30C3\u30C8\u306B\u5BFE\u3057\u3066 \`SELECT table_name FROM \\\`{project}.{dataset}.INFORMATION_SCHEMA.TABLES\\\`\` \u3092\u5B9F\u884C\u3057\u3066\u30C6\u30FC\u30D6\u30EB\u4E00\u89A7\u3092\u53D6\u5F97\u3059\u308B\uFF08\u8907\u6570\u30C7\u30FC\u30BF\u30BB\u30C3\u30C8\u306E\u5834\u5408\u306F UNION ALL \u3067\u4E00\u62EC\u53D6\u5F97\uFF09
|
|
1156
1164
|
4. \u7D50\u679C\u306B\u5FDC\u3058\u3066\u5206\u5C90:
|
|
1157
|
-
- **\u30C6\u30FC\u30D6\u30EB\u304C2\u3064\u4EE5\u4E0A**: \`askUserQuestion\`\uFF08multiSelect: true\uFF09\u3067\u30E6\u30FC\u30B6\u30FC\u306B\u63D0\u793A\u3057\u3001\u4F7F\u7528\u3059\u308B\u30C6\u30FC\u30D6\u30EB\u3092\u9078\u629E\u3055\u305B\u308B\u3002description \u306B\u306F\u30C7\u30FC\u30BF\u30BB\u30C3\u30C8\u540D\u3092\u8A18\u8F09\u3059\u308B
|
|
1165
|
+
- **\u30C6\u30FC\u30D6\u30EB\u304C2\u3064\u4EE5\u4E0A**: \`askUserQuestion\`\uFF08multiSelect: true\uFF09\u3067\u30E6\u30FC\u30B6\u30FC\u306B\u63D0\u793A\u3057\u3001\u4F7F\u7528\u3059\u308B\u30C6\u30FC\u30D6\u30EB\u3092\u9078\u629E\u3055\u305B\u308B\u3002description \u306B\u306F\u30C7\u30FC\u30BF\u30BB\u30C3\u30C8\u540D\u3092\u8A18\u8F09\u3059\u308B\u3002**\u53D6\u5F97\u3057\u305F\u5168\u30C6\u30FC\u30D6\u30EB\u3092\u9078\u629E\u80A2\u306B\u542B\u3081\u308B\u3053\u3068\u3002\u4EFB\u610F\u306B\u30D5\u30A3\u30EB\u30BF\u3084\u7701\u7565\u3092\u3057\u3066\u306F\u306A\u3089\u306A\u3044**
|
|
1158
1166
|
- **\u30C6\u30FC\u30D6\u30EB\u304C1\u3064\u3060\u3051**: askUserQuestion \u306F\u4F7F\u308F\u305A\u81EA\u52D5\u63A1\u7528
|
|
1159
1167
|
|
|
1160
1168
|
#### \u30B9\u30C6\u30C3\u30D74: \u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u5B8C\u4E86
|
|
@@ -1179,19 +1187,21 @@ Follow these steps to set up the BigQuery connection.
|
|
|
1179
1187
|
1. Call \`${listProjectsToolName}\` to get the list of GCP projects accessible with the service account credentials
|
|
1180
1188
|
2. Call \`updateConnectionParameters\`:
|
|
1181
1189
|
- \`parameterSlug\`: \`"project-id"\`
|
|
1182
|
-
- \`options\`: The project list. Each option's \`label\` should be \`Project Name (id: project-id)\`, \`value\` should be the project ID
|
|
1190
|
+
- \`options\`: The project list + a fixed public data option. Each option's \`label\` should be \`Project Name (id: project-id)\`, \`value\` should be the project ID. **Always append** \`{ value: "bigquery-public-data", label: "Public Data (id: bigquery-public-data)" }\` at the end
|
|
1183
1191
|
3. The \`label\` of the user's selected project will arrive as a message. Proceed to Step 2
|
|
1184
1192
|
|
|
1185
1193
|
#### Step 2: Dataset Selection
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1194
|
+
- **If \`bigquery-public-data\` was selected**: Do NOT run \`INFORMATION_SCHEMA.SCHEMATA\`. Use \`askUserQuestion\` (allowFreeText: true, no options) to ask the user to type the dataset name directly
|
|
1195
|
+
- **Otherwise**:
|
|
1196
|
+
1. Run \`SELECT schema_name FROM INFORMATION_SCHEMA.SCHEMATA\` to get the list of datasets
|
|
1197
|
+
2. Branch based on results:
|
|
1198
|
+
- **2 or more datasets**: Present them to the user via \`askUserQuestion\` (multiSelect: true) and let them select which datasets to use. **Include ALL datasets from the query results as options. Do NOT filter or omit any datasets**
|
|
1199
|
+
- **Exactly 1 dataset**: Do NOT call askUserQuestion. Auto-select it. Just write "Auto-selected dataset X" in one sentence
|
|
1190
1200
|
|
|
1191
1201
|
#### Step 3: Table Selection
|
|
1192
1202
|
3. For the selected dataset(s), run \`SELECT table_name FROM \\\`{project}.{dataset}.INFORMATION_SCHEMA.TABLES\\\`\` to get the table list (use UNION ALL for multiple datasets)
|
|
1193
1203
|
4. Branch based on results:
|
|
1194
|
-
- **2 or more tables**: Present them to the user via \`askUserQuestion\` (multiSelect: true) and let them select which tables to use. Include the dataset name in the description
|
|
1204
|
+
- **2 or more tables**: Present them to the user via \`askUserQuestion\` (multiSelect: true) and let them select which tables to use. Include the dataset name in the description. **Include ALL tables from the query results as options. Do NOT filter or omit any tables**
|
|
1195
1205
|
- **Exactly 1 table**: Do NOT call askUserQuestion. Auto-select it
|
|
1196
1206
|
|
|
1197
1207
|
#### Step 4: Complete Setup
|
|
@@ -1252,8 +1262,8 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
1252
1262
|
);
|
|
1253
1263
|
try {
|
|
1254
1264
|
const { BigQuery } = await import("@google-cloud/bigquery");
|
|
1255
|
-
const projectId =
|
|
1256
|
-
const serviceAccountJsonBase64 =
|
|
1265
|
+
const projectId = parameters11.projectId.getValue(connection);
|
|
1266
|
+
const serviceAccountJsonBase64 = parameters11.serviceAccountKeyJsonBase64.getValue(connection);
|
|
1257
1267
|
const credentials = JSON.parse(
|
|
1258
1268
|
Buffer.from(serviceAccountJsonBase64, "base64").toString("utf-8")
|
|
1259
1269
|
);
|
|
@@ -1283,7 +1293,7 @@ var bigqueryConnector = new ConnectorPlugin({
|
|
|
1283
1293
|
name: "BigQuery",
|
|
1284
1294
|
description: "Connect to Google BigQuery for data warehouse and analytics.",
|
|
1285
1295
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/6nlehQyOmdbktG5hOYkYMr/6ca559140d5ddc7dadc5eac88858a563/bigquery.svg",
|
|
1286
|
-
parameters:
|
|
1296
|
+
parameters: parameters11,
|
|
1287
1297
|
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
1288
1298
|
setup: bigquerySetup,
|
|
1289
1299
|
systemPrompt: `## BigQuery SQL Notes
|
|
@@ -1297,10 +1307,10 @@ var bigqueryConnector = new ConnectorPlugin({
|
|
|
1297
1307
|
async checkConnection(params, _config) {
|
|
1298
1308
|
const { BigQuery } = await import("@google-cloud/bigquery");
|
|
1299
1309
|
const credentials = JSON.parse(
|
|
1300
|
-
Buffer.from(params[
|
|
1310
|
+
Buffer.from(params[parameters11.serviceAccountKeyJsonBase64.slug], "base64").toString("utf-8")
|
|
1301
1311
|
);
|
|
1302
1312
|
const bq = new BigQuery({
|
|
1303
|
-
projectId: params[
|
|
1313
|
+
projectId: params[parameters11.projectId.slug],
|
|
1304
1314
|
credentials
|
|
1305
1315
|
});
|
|
1306
1316
|
try {
|
|
@@ -1315,10 +1325,10 @@ var bigqueryConnector = new ConnectorPlugin({
|
|
|
1315
1325
|
const { BigQuery } = await import("@google-cloud/bigquery");
|
|
1316
1326
|
const resolvedSql = replaceLiteralParams(sql, namedParams);
|
|
1317
1327
|
const credentials = JSON.parse(
|
|
1318
|
-
Buffer.from(params[
|
|
1328
|
+
Buffer.from(params[parameters11.serviceAccountKeyJsonBase64.slug], "base64").toString("utf-8")
|
|
1319
1329
|
);
|
|
1320
1330
|
const bq = new BigQuery({
|
|
1321
|
-
projectId: params[
|
|
1331
|
+
projectId: params[parameters11.projectId.slug],
|
|
1322
1332
|
credentials
|
|
1323
1333
|
});
|
|
1324
1334
|
const [job] = await bq.createQueryJob({ query: resolvedSql });
|
|
@@ -1447,19 +1457,21 @@ var bigquerySetup2 = new ConnectorSetup({
|
|
|
1447
1457
|
1. \`${listProjectsToolName2}\` \u3092\u547C\u3073\u51FA\u3057\u3066\u3001OAuth\u3067\u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u306AGCP\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u4E00\u89A7\u3092\u53D6\u5F97\u3059\u308B
|
|
1448
1458
|
2. \`updateConnectionParameters\` \u3092\u547C\u3073\u51FA\u3059:
|
|
1449
1459
|
- \`parameterSlug\`: \`"project-id"\`
|
|
1450
|
-
- \`options\`: \u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u4E00\u89A7\u3002\u5404 option \u306E \`label\` \u306F \`\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u540D (id: \u30D7\u30ED\u30B8\u30A7\u30AF\u30C8ID)\` \u306E\u5F62\u5F0F\u3001\`value\` \u306F\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8ID
|
|
1460
|
+
- \`options\`: \u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u4E00\u89A7 + \u30D1\u30D6\u30EA\u30C3\u30AF\u30C7\u30FC\u30BF\u306E\u56FA\u5B9A\u9078\u629E\u80A2\u3002\u5404 option \u306E \`label\` \u306F \`\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u540D (id: \u30D7\u30ED\u30B8\u30A7\u30AF\u30C8ID)\` \u306E\u5F62\u5F0F\u3001\`value\` \u306F\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8ID\u3002**\u672B\u5C3E\u306B\u5FC5\u305A** \`{ value: "bigquery-public-data", label: "Public Data (id: bigquery-public-data)" }\` \u3092\u8FFD\u52A0\u3059\u308B\u3053\u3068
|
|
1451
1461
|
3. \u30E6\u30FC\u30B6\u30FC\u304C\u9078\u629E\u3057\u305F\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306E \`label\` \u304C\u30E1\u30C3\u30BB\u30FC\u30B8\u3068\u3057\u3066\u5C4A\u304F\u306E\u3067\u3001\u30B9\u30C6\u30C3\u30D72\u306B\u9032\u3080
|
|
1452
1462
|
|
|
1453
1463
|
#### \u30B9\u30C6\u30C3\u30D72: \u30C7\u30FC\u30BF\u30BB\u30C3\u30C8\u9078\u629E
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1464
|
+
- **\`bigquery-public-data\` \u304C\u9078\u629E\u3055\u308C\u305F\u5834\u5408**: \`INFORMATION_SCHEMA.SCHEMATA\` \u306F\u5B9F\u884C\u3057\u306A\u3044\u3002\`askUserQuestion\`\uFF08allowFreeText: true, options \u306A\u3057\uFF09\u3067\u30E6\u30FC\u30B6\u30FC\u306B\u30C7\u30FC\u30BF\u30BB\u30C3\u30C8\u540D\u3092\u76F4\u63A5\u5165\u529B\u3055\u305B\u308B
|
|
1465
|
+
- **\u305D\u308C\u4EE5\u5916\u306E\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8**:
|
|
1466
|
+
1. \`SELECT schema_name FROM INFORMATION_SCHEMA.SCHEMATA\` \u3092\u5B9F\u884C\u3057\u3066\u30C7\u30FC\u30BF\u30BB\u30C3\u30C8\u4E00\u89A7\u3092\u53D6\u5F97\u3059\u308B
|
|
1467
|
+
2. \u7D50\u679C\u306B\u5FDC\u3058\u3066\u5206\u5C90:
|
|
1468
|
+
- **\u30C7\u30FC\u30BF\u30BB\u30C3\u30C8\u304C2\u3064\u4EE5\u4E0A**: \`askUserQuestion\`\uFF08multiSelect: true\uFF09\u3067\u30E6\u30FC\u30B6\u30FC\u306B\u63D0\u793A\u3057\u3001\u4F7F\u7528\u3059\u308B\u30C7\u30FC\u30BF\u30BB\u30C3\u30C8\u3092\u9078\u629E\u3055\u305B\u308B\u3002**\u53D6\u5F97\u3057\u305F\u5168\u30C7\u30FC\u30BF\u30BB\u30C3\u30C8\u3092\u9078\u629E\u80A2\u306B\u542B\u3081\u308B\u3053\u3068\u3002\u4EFB\u610F\u306B\u30D5\u30A3\u30EB\u30BF\u3084\u7701\u7565\u3092\u3057\u3066\u306F\u306A\u3089\u306A\u3044**
|
|
1469
|
+
- **\u30C7\u30FC\u30BF\u30BB\u30C3\u30C8\u304C1\u3064\u3060\u3051**: askUserQuestion \u306F\u4F7F\u308F\u305A\u81EA\u52D5\u63A1\u7528\u3002\u300C\u30C7\u30FC\u30BF\u30BB\u30C3\u30C8 X \u3092\u81EA\u52D5\u9078\u629E\u3057\u307E\u3057\u305F\u300D\u30681\u6587\u3060\u3051\u66F8\u304F
|
|
1458
1470
|
|
|
1459
1471
|
#### \u30B9\u30C6\u30C3\u30D73: \u30C6\u30FC\u30D6\u30EB\u9078\u629E
|
|
1460
1472
|
3. \u9078\u629E\u3055\u308C\u305F\u30C7\u30FC\u30BF\u30BB\u30C3\u30C8\u306B\u5BFE\u3057\u3066 \`SELECT table_name FROM \\\`{project}.{dataset}.INFORMATION_SCHEMA.TABLES\\\`\` \u3092\u5B9F\u884C\u3057\u3066\u30C6\u30FC\u30D6\u30EB\u4E00\u89A7\u3092\u53D6\u5F97\u3059\u308B\uFF08\u8907\u6570\u30C7\u30FC\u30BF\u30BB\u30C3\u30C8\u306E\u5834\u5408\u306F UNION ALL \u3067\u4E00\u62EC\u53D6\u5F97\uFF09
|
|
1461
1473
|
4. \u7D50\u679C\u306B\u5FDC\u3058\u3066\u5206\u5C90:
|
|
1462
|
-
- **\u30C6\u30FC\u30D6\u30EB\u304C2\u3064\u4EE5\u4E0A**: \`askUserQuestion\`\uFF08multiSelect: true\uFF09\u3067\u30E6\u30FC\u30B6\u30FC\u306B\u63D0\u793A\u3057\u3001\u4F7F\u7528\u3059\u308B\u30C6\u30FC\u30D6\u30EB\u3092\u9078\u629E\u3055\u305B\u308B\u3002description \u306B\u306F\u30C7\u30FC\u30BF\u30BB\u30C3\u30C8\u540D\u3092\u8A18\u8F09\u3059\u308B
|
|
1474
|
+
- **\u30C6\u30FC\u30D6\u30EB\u304C2\u3064\u4EE5\u4E0A**: \`askUserQuestion\`\uFF08multiSelect: true\uFF09\u3067\u30E6\u30FC\u30B6\u30FC\u306B\u63D0\u793A\u3057\u3001\u4F7F\u7528\u3059\u308B\u30C6\u30FC\u30D6\u30EB\u3092\u9078\u629E\u3055\u305B\u308B\u3002description \u306B\u306F\u30C7\u30FC\u30BF\u30BB\u30C3\u30C8\u540D\u3092\u8A18\u8F09\u3059\u308B\u3002**\u53D6\u5F97\u3057\u305F\u5168\u30C6\u30FC\u30D6\u30EB\u3092\u9078\u629E\u80A2\u306B\u542B\u3081\u308B\u3053\u3068\u3002\u4EFB\u610F\u306B\u30D5\u30A3\u30EB\u30BF\u3084\u7701\u7565\u3092\u3057\u3066\u306F\u306A\u3089\u306A\u3044**
|
|
1463
1475
|
- **\u30C6\u30FC\u30D6\u30EB\u304C1\u3064\u3060\u3051**: askUserQuestion \u306F\u4F7F\u308F\u305A\u81EA\u52D5\u63A1\u7528
|
|
1464
1476
|
|
|
1465
1477
|
#### \u30B9\u30C6\u30C3\u30D74: \u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u5B8C\u4E86
|
|
@@ -1484,19 +1496,21 @@ Follow these steps to set up the BigQuery connection.
|
|
|
1484
1496
|
1. Call \`${listProjectsToolName2}\` to get the list of GCP projects accessible with the OAuth credentials
|
|
1485
1497
|
2. Call \`updateConnectionParameters\`:
|
|
1486
1498
|
- \`parameterSlug\`: \`"project-id"\`
|
|
1487
|
-
- \`options\`: The project list. Each option's \`label\` should be \`Project Name (id: project-id)\`, \`value\` should be the project ID
|
|
1499
|
+
- \`options\`: The project list + a fixed public data option. Each option's \`label\` should be \`Project Name (id: project-id)\`, \`value\` should be the project ID. **Always append** \`{ value: "bigquery-public-data", label: "Public Data (id: bigquery-public-data)" }\` at the end
|
|
1488
1500
|
3. The \`label\` of the user's selected project will arrive as a message. Proceed to Step 2
|
|
1489
1501
|
|
|
1490
1502
|
#### Step 2: Dataset Selection
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1503
|
+
- **If \`bigquery-public-data\` was selected**: Do NOT run \`INFORMATION_SCHEMA.SCHEMATA\`. Use \`askUserQuestion\` (allowFreeText: true, no options) to ask the user to type the dataset name directly
|
|
1504
|
+
- **Otherwise**:
|
|
1505
|
+
1. Run \`SELECT schema_name FROM INFORMATION_SCHEMA.SCHEMATA\` to get the list of datasets
|
|
1506
|
+
2. Branch based on results:
|
|
1507
|
+
- **2 or more datasets**: Present them to the user via \`askUserQuestion\` (multiSelect: true) and let them select which datasets to use. **Include ALL datasets from the query results as options. Do NOT filter or omit any datasets**
|
|
1508
|
+
- **Exactly 1 dataset**: Do NOT call askUserQuestion. Auto-select it. Just write "Auto-selected dataset X" in one sentence
|
|
1495
1509
|
|
|
1496
1510
|
#### Step 3: Table Selection
|
|
1497
1511
|
3. For the selected dataset(s), run \`SELECT table_name FROM \\\`{project}.{dataset}.INFORMATION_SCHEMA.TABLES\\\`\` to get the table list (use UNION ALL for multiple datasets)
|
|
1498
1512
|
4. Branch based on results:
|
|
1499
|
-
- **2 or more tables**: Present them to the user via \`askUserQuestion\` (multiSelect: true) and let them select which tables to use. Include the dataset name in the description
|
|
1513
|
+
- **2 or more tables**: Present them to the user via \`askUserQuestion\` (multiSelect: true) and let them select which tables to use. Include the dataset name in the description. **Include ALL tables from the query results as options. Do NOT filter or omit any tables**
|
|
1500
1514
|
- **Exactly 1 table**: Do NOT call askUserQuestion. Auto-select it
|
|
1501
1515
|
|
|
1502
1516
|
#### Step 4: Complete Setup
|
|
@@ -1514,7 +1528,7 @@ Follow these steps to set up the BigQuery connection.
|
|
|
1514
1528
|
});
|
|
1515
1529
|
|
|
1516
1530
|
// src/connectors/bigquery-oauth/parameters.ts
|
|
1517
|
-
var
|
|
1531
|
+
var parameters12 = {
|
|
1518
1532
|
projectId: new ParameterDefinition({
|
|
1519
1533
|
slug: "project-id",
|
|
1520
1534
|
name: "Google Cloud Project ID",
|
|
@@ -1608,7 +1622,7 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
1608
1622
|
error: `Connection ${connectionId} not found`
|
|
1609
1623
|
};
|
|
1610
1624
|
}
|
|
1611
|
-
const gcpProjectId =
|
|
1625
|
+
const gcpProjectId = parameters12.projectId.getValue(connection);
|
|
1612
1626
|
console.log(
|
|
1613
1627
|
`[connector-query] bigquery-oauth/${connection.name}: ${sql}`
|
|
1614
1628
|
);
|
|
@@ -1675,7 +1689,7 @@ var bigqueryOauthConnector = new ConnectorPlugin({
|
|
|
1675
1689
|
name: "BigQuery (OAuth)",
|
|
1676
1690
|
description: "Connect to Google BigQuery for data warehouse and analytics using OAuth.",
|
|
1677
1691
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/6nlehQyOmdbktG5hOYkYMr/6ca559140d5ddc7dadc5eac88858a563/bigquery.svg",
|
|
1678
|
-
parameters:
|
|
1692
|
+
parameters: parameters12,
|
|
1679
1693
|
releaseFlag: { dev1: true, dev2: false, prod: false },
|
|
1680
1694
|
setup: bigquerySetup2,
|
|
1681
1695
|
proxyPolicy: {
|
|
@@ -1694,7 +1708,7 @@ var bigqueryOauthConnector = new ConnectorPlugin({
|
|
|
1694
1708
|
tools: tools6,
|
|
1695
1709
|
async checkConnection(params, config) {
|
|
1696
1710
|
const { proxyFetch } = config;
|
|
1697
|
-
const projectId = params[
|
|
1711
|
+
const projectId = params[parameters12.projectId.slug];
|
|
1698
1712
|
const url = `https://bigquery.googleapis.com/bigquery/v2/projects/${projectId}/queries`;
|
|
1699
1713
|
try {
|
|
1700
1714
|
const res = await proxyFetch(url, {
|
|
@@ -1713,7 +1727,7 @@ var bigqueryOauthConnector = new ConnectorPlugin({
|
|
|
1713
1727
|
},
|
|
1714
1728
|
async query(params, sql, namedParams, context) {
|
|
1715
1729
|
const { proxyFetch } = context;
|
|
1716
|
-
const projectId = params[
|
|
1730
|
+
const projectId = params[parameters12.projectId.slug];
|
|
1717
1731
|
const resolvedSql = replaceLiteralParams(sql, namedParams);
|
|
1718
1732
|
const url = `https://bigquery.googleapis.com/bigquery/v2/projects/${projectId}/queries`;
|
|
1719
1733
|
const res = await proxyFetch(url, {
|
|
@@ -1731,7 +1745,7 @@ var bigqueryOauthConnector = new ConnectorPlugin({
|
|
|
1731
1745
|
});
|
|
1732
1746
|
|
|
1733
1747
|
// src/connectors/aws-athena/parameters.ts
|
|
1734
|
-
var
|
|
1748
|
+
var parameters13 = {
|
|
1735
1749
|
awsAccessKeyId: new ParameterDefinition({
|
|
1736
1750
|
slug: "aws-access-key-id",
|
|
1737
1751
|
name: "AWS Access Key ID",
|
|
@@ -1828,8 +1842,8 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
1828
1842
|
GetQueryExecutionCommand,
|
|
1829
1843
|
GetQueryResultsCommand
|
|
1830
1844
|
} = await import("@aws-sdk/client-athena");
|
|
1831
|
-
const workgroup =
|
|
1832
|
-
const outputLocation =
|
|
1845
|
+
const workgroup = parameters13.workgroup.tryGetValue(connection);
|
|
1846
|
+
const outputLocation = parameters13.outputLocation.tryGetValue(connection);
|
|
1833
1847
|
if (!workgroup && !outputLocation) {
|
|
1834
1848
|
return {
|
|
1835
1849
|
success: false,
|
|
@@ -1837,10 +1851,10 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
1837
1851
|
};
|
|
1838
1852
|
}
|
|
1839
1853
|
const client = new AthenaClient({
|
|
1840
|
-
region:
|
|
1854
|
+
region: parameters13.awsRegion.getValue(connection),
|
|
1841
1855
|
credentials: {
|
|
1842
|
-
accessKeyId:
|
|
1843
|
-
secretAccessKey:
|
|
1856
|
+
accessKeyId: parameters13.awsAccessKeyId.getValue(connection),
|
|
1857
|
+
secretAccessKey: parameters13.awsSecretAccessKey.getValue(connection)
|
|
1844
1858
|
}
|
|
1845
1859
|
});
|
|
1846
1860
|
const startParams = { QueryString: sql };
|
|
@@ -1904,7 +1918,7 @@ var awsAthenaConnector = new ConnectorPlugin({
|
|
|
1904
1918
|
name: "AWS Athena",
|
|
1905
1919
|
description: "Connect to AWS Athena for serverless SQL queries on S3 data.",
|
|
1906
1920
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/5x0vIHtUHfJJMZUv4RFOYZ/5059bac389f0169542f39cdb4b387d2c/Athena.svg",
|
|
1907
|
-
parameters:
|
|
1921
|
+
parameters: parameters13,
|
|
1908
1922
|
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
1909
1923
|
systemPrompt: `## AWS Athena SQL Notes
|
|
1910
1924
|
- Uses Presto/Trino based SQL syntax
|
|
@@ -1922,8 +1936,8 @@ var awsAthenaConnector = new ConnectorPlugin({
|
|
|
1922
1936
|
StartQueryExecutionCommand,
|
|
1923
1937
|
GetQueryExecutionCommand
|
|
1924
1938
|
} = await import("@aws-sdk/client-athena");
|
|
1925
|
-
const workgroup = params[
|
|
1926
|
-
const outputLocation = params[
|
|
1939
|
+
const workgroup = params[parameters13.workgroup.slug];
|
|
1940
|
+
const outputLocation = params[parameters13.outputLocation.slug];
|
|
1927
1941
|
if (!workgroup && !outputLocation) {
|
|
1928
1942
|
return {
|
|
1929
1943
|
success: false,
|
|
@@ -1931,10 +1945,10 @@ var awsAthenaConnector = new ConnectorPlugin({
|
|
|
1931
1945
|
};
|
|
1932
1946
|
}
|
|
1933
1947
|
const client = new AthenaClient({
|
|
1934
|
-
region: params[
|
|
1948
|
+
region: params[parameters13.awsRegion.slug],
|
|
1935
1949
|
credentials: {
|
|
1936
|
-
accessKeyId: params[
|
|
1937
|
-
secretAccessKey: params[
|
|
1950
|
+
accessKeyId: params[parameters13.awsAccessKeyId.slug],
|
|
1951
|
+
secretAccessKey: params[parameters13.awsSecretAccessKey.slug]
|
|
1938
1952
|
}
|
|
1939
1953
|
});
|
|
1940
1954
|
const startParams = { QueryString: "SELECT 1" };
|
|
@@ -1979,16 +1993,16 @@ var awsAthenaConnector = new ConnectorPlugin({
|
|
|
1979
1993
|
GetQueryResultsCommand
|
|
1980
1994
|
} = await import("@aws-sdk/client-athena");
|
|
1981
1995
|
const resolvedSql = replaceLiteralParams(sql, namedParams);
|
|
1982
|
-
const workgroup = params[
|
|
1983
|
-
const outputLocation = params[
|
|
1996
|
+
const workgroup = params[parameters13.workgroup.slug];
|
|
1997
|
+
const outputLocation = params[parameters13.outputLocation.slug];
|
|
1984
1998
|
if (!workgroup && !outputLocation) {
|
|
1985
1999
|
throw new Error("Either workgroup or output-location is required");
|
|
1986
2000
|
}
|
|
1987
2001
|
const client = new AthenaClient({
|
|
1988
|
-
region: params[
|
|
2002
|
+
region: params[parameters13.awsRegion.slug],
|
|
1989
2003
|
credentials: {
|
|
1990
|
-
accessKeyId: params[
|
|
1991
|
-
secretAccessKey: params[
|
|
2004
|
+
accessKeyId: params[parameters13.awsAccessKeyId.slug],
|
|
2005
|
+
secretAccessKey: params[parameters13.awsSecretAccessKey.slug]
|
|
1992
2006
|
}
|
|
1993
2007
|
});
|
|
1994
2008
|
const startParams = { QueryString: resolvedSql };
|
|
@@ -2033,7 +2047,7 @@ var awsAthenaConnector = new ConnectorPlugin({
|
|
|
2033
2047
|
});
|
|
2034
2048
|
|
|
2035
2049
|
// src/connectors/redshift/parameters.ts
|
|
2036
|
-
var
|
|
2050
|
+
var parameters14 = {
|
|
2037
2051
|
awsAccessKeyId: new ParameterDefinition({
|
|
2038
2052
|
slug: "aws-access-key-id",
|
|
2039
2053
|
name: "AWS Access Key ID",
|
|
@@ -2159,14 +2173,14 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
2159
2173
|
DescribeStatementCommand,
|
|
2160
2174
|
GetStatementResultCommand
|
|
2161
2175
|
} = await import("@aws-sdk/client-redshift-data");
|
|
2162
|
-
const awsAccessKeyId =
|
|
2163
|
-
const awsSecretAccessKey =
|
|
2164
|
-
const awsRegion =
|
|
2165
|
-
const database =
|
|
2166
|
-
const clusterIdentifier =
|
|
2167
|
-
const workgroupName =
|
|
2168
|
-
const secretArn =
|
|
2169
|
-
const dbUser =
|
|
2176
|
+
const awsAccessKeyId = parameters14.awsAccessKeyId.getValue(connection);
|
|
2177
|
+
const awsSecretAccessKey = parameters14.awsSecretAccessKey.getValue(connection);
|
|
2178
|
+
const awsRegion = parameters14.awsRegion.getValue(connection);
|
|
2179
|
+
const database = parameters14.database.getValue(connection);
|
|
2180
|
+
const clusterIdentifier = parameters14.clusterIdentifier.tryGetValue(connection);
|
|
2181
|
+
const workgroupName = parameters14.workgroupName.tryGetValue(connection);
|
|
2182
|
+
const secretArn = parameters14.secretArn.tryGetValue(connection);
|
|
2183
|
+
const dbUser = parameters14.dbUser.tryGetValue(connection);
|
|
2170
2184
|
if (!clusterIdentifier && !workgroupName) {
|
|
2171
2185
|
return {
|
|
2172
2186
|
success: false,
|
|
@@ -2237,7 +2251,7 @@ var redshiftConnector = new ConnectorPlugin({
|
|
|
2237
2251
|
name: "Redshift",
|
|
2238
2252
|
description: "Connect to Amazon Redshift for data warehouse analytics.",
|
|
2239
2253
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/AEwW2psmrnZ7htTVsgA9t/a637e31707c5d760be73ce1d8ec75580/aws-redshift-logo.svg",
|
|
2240
|
-
parameters:
|
|
2254
|
+
parameters: parameters14,
|
|
2241
2255
|
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
2242
2256
|
systemPrompt: `## Redshift SQL Notes
|
|
2243
2257
|
- Uses PostgreSQL based SQL syntax
|
|
@@ -2255,10 +2269,10 @@ var redshiftConnector = new ConnectorPlugin({
|
|
|
2255
2269
|
ExecuteStatementCommand,
|
|
2256
2270
|
DescribeStatementCommand
|
|
2257
2271
|
} = await import("@aws-sdk/client-redshift-data");
|
|
2258
|
-
const clusterIdentifier = params[
|
|
2259
|
-
const workgroupName = params[
|
|
2260
|
-
const secretArn = params[
|
|
2261
|
-
const dbUser = params[
|
|
2272
|
+
const clusterIdentifier = params[parameters14.clusterIdentifier.slug];
|
|
2273
|
+
const workgroupName = params[parameters14.workgroupName.slug];
|
|
2274
|
+
const secretArn = params[parameters14.secretArn.slug];
|
|
2275
|
+
const dbUser = params[parameters14.dbUser.slug];
|
|
2262
2276
|
if (!clusterIdentifier && !workgroupName) {
|
|
2263
2277
|
return {
|
|
2264
2278
|
success: false,
|
|
@@ -2266,15 +2280,15 @@ var redshiftConnector = new ConnectorPlugin({
|
|
|
2266
2280
|
};
|
|
2267
2281
|
}
|
|
2268
2282
|
const client = new RedshiftDataClient({
|
|
2269
|
-
region: params[
|
|
2283
|
+
region: params[parameters14.awsRegion.slug],
|
|
2270
2284
|
credentials: {
|
|
2271
|
-
accessKeyId: params[
|
|
2272
|
-
secretAccessKey: params[
|
|
2285
|
+
accessKeyId: params[parameters14.awsAccessKeyId.slug],
|
|
2286
|
+
secretAccessKey: params[parameters14.awsSecretAccessKey.slug]
|
|
2273
2287
|
}
|
|
2274
2288
|
});
|
|
2275
2289
|
const { Id: statementId } = await client.send(
|
|
2276
2290
|
new ExecuteStatementCommand({
|
|
2277
|
-
Database: params[
|
|
2291
|
+
Database: params[parameters14.database.slug],
|
|
2278
2292
|
Sql: "SELECT 1",
|
|
2279
2293
|
...clusterIdentifier && { ClusterIdentifier: clusterIdentifier },
|
|
2280
2294
|
...workgroupName && { WorkgroupName: workgroupName },
|
|
@@ -2315,23 +2329,23 @@ var redshiftConnector = new ConnectorPlugin({
|
|
|
2315
2329
|
GetStatementResultCommand
|
|
2316
2330
|
} = await import("@aws-sdk/client-redshift-data");
|
|
2317
2331
|
const resolvedSql = replaceLiteralParams(sql, namedParams);
|
|
2318
|
-
const clusterIdentifier = params[
|
|
2319
|
-
const workgroupName = params[
|
|
2320
|
-
const secretArn = params[
|
|
2321
|
-
const dbUser = params[
|
|
2332
|
+
const clusterIdentifier = params[parameters14.clusterIdentifier.slug];
|
|
2333
|
+
const workgroupName = params[parameters14.workgroupName.slug];
|
|
2334
|
+
const secretArn = params[parameters14.secretArn.slug];
|
|
2335
|
+
const dbUser = params[parameters14.dbUser.slug];
|
|
2322
2336
|
if (!clusterIdentifier && !workgroupName) {
|
|
2323
2337
|
throw new Error("Either cluster-identifier or workgroup-name is required");
|
|
2324
2338
|
}
|
|
2325
2339
|
const client = new RedshiftDataClient({
|
|
2326
|
-
region: params[
|
|
2340
|
+
region: params[parameters14.awsRegion.slug],
|
|
2327
2341
|
credentials: {
|
|
2328
|
-
accessKeyId: params[
|
|
2329
|
-
secretAccessKey: params[
|
|
2342
|
+
accessKeyId: params[parameters14.awsAccessKeyId.slug],
|
|
2343
|
+
secretAccessKey: params[parameters14.awsSecretAccessKey.slug]
|
|
2330
2344
|
}
|
|
2331
2345
|
});
|
|
2332
2346
|
const { Id: statementId } = await client.send(
|
|
2333
2347
|
new ExecuteStatementCommand({
|
|
2334
|
-
Database: params[
|
|
2348
|
+
Database: params[parameters14.database.slug],
|
|
2335
2349
|
Sql: resolvedSql,
|
|
2336
2350
|
...clusterIdentifier && { ClusterIdentifier: clusterIdentifier },
|
|
2337
2351
|
...workgroupName && { WorkgroupName: workgroupName },
|
|
@@ -2369,7 +2383,7 @@ var redshiftConnector = new ConnectorPlugin({
|
|
|
2369
2383
|
});
|
|
2370
2384
|
|
|
2371
2385
|
// src/connectors/databricks/parameters.ts
|
|
2372
|
-
var
|
|
2386
|
+
var parameters15 = {
|
|
2373
2387
|
host: new ParameterDefinition({
|
|
2374
2388
|
slug: "host",
|
|
2375
2389
|
name: "Databricks Workspace Host",
|
|
@@ -2441,9 +2455,9 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
2441
2455
|
);
|
|
2442
2456
|
try {
|
|
2443
2457
|
const { DBSQLClient } = await import("@databricks/sql");
|
|
2444
|
-
const host =
|
|
2445
|
-
const token =
|
|
2446
|
-
const httpPath =
|
|
2458
|
+
const host = parameters15.host.getValue(connection);
|
|
2459
|
+
const token = parameters15.token.getValue(connection);
|
|
2460
|
+
const httpPath = parameters15.httpPath.getValue(connection);
|
|
2447
2461
|
const client = new DBSQLClient();
|
|
2448
2462
|
await client.connect({ host, path: httpPath, token });
|
|
2449
2463
|
let session;
|
|
@@ -2484,7 +2498,7 @@ var databricksConnector = new ConnectorPlugin({
|
|
|
2484
2498
|
name: "Databricks",
|
|
2485
2499
|
description: "Connect to Databricks for data lakehouse and SQL analytics.",
|
|
2486
2500
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/6QgcrfpQOKg18P7DdgKerd/af55bf0d871339049824dd167b97a29f/databricks-icon.svg",
|
|
2487
|
-
parameters:
|
|
2501
|
+
parameters: parameters15,
|
|
2488
2502
|
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
2489
2503
|
systemPrompt: `## Databricks SQL Notes
|
|
2490
2504
|
- Uses Spark SQL / Databricks SQL syntax
|
|
@@ -2499,9 +2513,9 @@ var databricksConnector = new ConnectorPlugin({
|
|
|
2499
2513
|
const { DBSQLClient } = await import("@databricks/sql");
|
|
2500
2514
|
const client = new DBSQLClient();
|
|
2501
2515
|
await client.connect({
|
|
2502
|
-
host: params[
|
|
2503
|
-
path: params[
|
|
2504
|
-
token: params[
|
|
2516
|
+
host: params[parameters15.host.slug],
|
|
2517
|
+
path: params[parameters15.httpPath.slug],
|
|
2518
|
+
token: params[parameters15.token.slug]
|
|
2505
2519
|
});
|
|
2506
2520
|
let session;
|
|
2507
2521
|
let operation;
|
|
@@ -2528,9 +2542,9 @@ var databricksConnector = new ConnectorPlugin({
|
|
|
2528
2542
|
const resolvedSql = replaceLiteralParams(sql, namedParams);
|
|
2529
2543
|
const client = new DBSQLClient();
|
|
2530
2544
|
await client.connect({
|
|
2531
|
-
host: params[
|
|
2532
|
-
path: params[
|
|
2533
|
-
token: params[
|
|
2545
|
+
host: params[parameters15.host.slug],
|
|
2546
|
+
path: params[parameters15.httpPath.slug],
|
|
2547
|
+
token: params[parameters15.token.slug]
|
|
2534
2548
|
});
|
|
2535
2549
|
let session;
|
|
2536
2550
|
let operation;
|
|
@@ -2552,28 +2566,6 @@ var databricksConnector = new ConnectorPlugin({
|
|
|
2552
2566
|
}
|
|
2553
2567
|
});
|
|
2554
2568
|
|
|
2555
|
-
// src/connectors/airtable/parameters.ts
|
|
2556
|
-
var parameters12 = {
|
|
2557
|
-
baseId: new ParameterDefinition({
|
|
2558
|
-
slug: "base-id",
|
|
2559
|
-
name: "Airtable Base ID",
|
|
2560
|
-
description: "The Airtable Base ID (e.g., appXXXXXXXXXXXXXX).",
|
|
2561
|
-
envVarBaseKey: "AIRTABLE_BASE_ID",
|
|
2562
|
-
type: "text",
|
|
2563
|
-
secret: false,
|
|
2564
|
-
required: true
|
|
2565
|
-
}),
|
|
2566
|
-
apiKey: new ParameterDefinition({
|
|
2567
|
-
slug: "api-key",
|
|
2568
|
-
name: "Airtable API Key",
|
|
2569
|
-
description: "The Airtable API key or Personal Access Token for authentication. Required scopes: schema.bases:read, data.records:read.",
|
|
2570
|
-
envVarBaseKey: "AIRTABLE_API_KEY",
|
|
2571
|
-
type: "text",
|
|
2572
|
-
secret: true,
|
|
2573
|
-
required: true
|
|
2574
|
-
})
|
|
2575
|
-
};
|
|
2576
|
-
|
|
2577
2569
|
// src/connectors/airtable/tools/request.ts
|
|
2578
2570
|
import { z as z12 } from "zod";
|
|
2579
2571
|
var BASE_URL = "https://api.airtable.com/v0/";
|
|
@@ -2610,8 +2602,8 @@ Authentication is handled automatically using the API Key.
|
|
|
2610
2602
|
}
|
|
2611
2603
|
console.log(`[connector-request] airtable/${connection.name}: ${method} ${path}`);
|
|
2612
2604
|
try {
|
|
2613
|
-
const apiKey =
|
|
2614
|
-
const baseId =
|
|
2605
|
+
const apiKey = parameters.apiKey.getValue(connection);
|
|
2606
|
+
const baseId = parameters.baseId.getValue(connection);
|
|
2615
2607
|
const resolvedPath = path.replace(/\{baseId\}/g, baseId);
|
|
2616
2608
|
const url = `${BASE_URL}${resolvedPath}`;
|
|
2617
2609
|
const controller = new AbortController();
|
|
@@ -2653,7 +2645,7 @@ var airtableConnector = new ConnectorPlugin({
|
|
|
2653
2645
|
name: "Airtable",
|
|
2654
2646
|
description: "Connect to Airtable for spreadsheet-database hybrid data management.",
|
|
2655
2647
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/19JUphfOZjyjTK6Zg4NGCf/8c56227b088cada52d3a2d9385a3be97/airtable.svg",
|
|
2656
|
-
parameters
|
|
2648
|
+
parameters,
|
|
2657
2649
|
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
2658
2650
|
systemPrompt: `## Airtable API
|
|
2659
2651
|
- Call the Airtable REST API using the authenticated request tool
|
|
@@ -2672,32 +2664,39 @@ var airtableConnector = new ConnectorPlugin({
|
|
|
2672
2664
|
- Body: { "records": [{ "fields": { "Name": "value", ... } }] }
|
|
2673
2665
|
|
|
2674
2666
|
### Pagination
|
|
2675
|
-
- If the response contains an offset, fetch the next page by appending ?offset={offset} to the next request
|
|
2667
|
+
- If the response contains an offset, fetch the next page by appending ?offset={offset} to the next request
|
|
2668
|
+
|
|
2669
|
+
## Airtable SDK (TypeScript handler)
|
|
2670
|
+
Non-SQL connectors like Airtable can also be used via the SDK in TypeScript handlers:
|
|
2671
|
+
|
|
2672
|
+
\`\`\`ts
|
|
2673
|
+
import { connection } from "@squadbase/vite-server/connectors/airtable";
|
|
2674
|
+
|
|
2675
|
+
const airtable = connection("<connectionId>");
|
|
2676
|
+
|
|
2677
|
+
// Authenticated fetch (returns standard Response)
|
|
2678
|
+
const res = await airtable.request("meta/bases/{baseId}/tables");
|
|
2679
|
+
const data = await res.json();
|
|
2680
|
+
|
|
2681
|
+
// Convenience methods
|
|
2682
|
+
const { tables } = await airtable.listTables();
|
|
2683
|
+
const { records, offset } = await airtable.listRecords("Tasks", {
|
|
2684
|
+
filterByFormula: '{Status} = "Done"',
|
|
2685
|
+
fields: ["Name", "Status"],
|
|
2686
|
+
maxRecords: 100,
|
|
2687
|
+
sort: [{ field: "Name", direction: "asc" }],
|
|
2688
|
+
});
|
|
2689
|
+
const record = await airtable.getRecord("Tasks", "recXXXXXX");
|
|
2690
|
+
await airtable.createRecords("Tasks", [
|
|
2691
|
+
{ fields: { Name: "New task", Status: "Todo" } },
|
|
2692
|
+
]);
|
|
2693
|
+
await airtable.updateRecords("Tasks", [
|
|
2694
|
+
{ id: "recXXXXXX", fields: { Status: "Done" } },
|
|
2695
|
+
]);
|
|
2696
|
+
\`\`\``,
|
|
2676
2697
|
tools: tools10
|
|
2677
2698
|
});
|
|
2678
2699
|
|
|
2679
|
-
// src/connectors/google-analytics/parameters.ts
|
|
2680
|
-
var parameters13 = {
|
|
2681
|
-
serviceAccountKeyJsonBase64: new ParameterDefinition({
|
|
2682
|
-
slug: "service-account-key-json-base64",
|
|
2683
|
-
name: "Google Cloud Service Account JSON",
|
|
2684
|
-
description: "The service account JSON key used to authenticate with Google Cloud Platform. Ensure that the service account has the necessary permissions to access Google Analytics.",
|
|
2685
|
-
envVarBaseKey: "GA_SERVICE_ACCOUNT_JSON_BASE64",
|
|
2686
|
-
type: "base64EncodedJson",
|
|
2687
|
-
secret: true,
|
|
2688
|
-
required: true
|
|
2689
|
-
}),
|
|
2690
|
-
propertyId: new ParameterDefinition({
|
|
2691
|
-
slug: "property-id",
|
|
2692
|
-
name: "Google Analytics Property ID",
|
|
2693
|
-
description: "The Google Analytics 4 property ID (e.g., 123456789).",
|
|
2694
|
-
envVarBaseKey: "GA_PROPERTY_ID",
|
|
2695
|
-
type: "text",
|
|
2696
|
-
secret: false,
|
|
2697
|
-
required: true
|
|
2698
|
-
})
|
|
2699
|
-
};
|
|
2700
|
-
|
|
2701
2700
|
// src/connectors/google-analytics/tools/request.ts
|
|
2702
2701
|
import { z as z13 } from "zod";
|
|
2703
2702
|
var BASE_URL2 = "https://analyticsdata.googleapis.com/v1beta/";
|
|
@@ -2735,8 +2734,8 @@ Authentication is handled automatically using a service account.
|
|
|
2735
2734
|
console.log(`[connector-request] google-analytics/${connection.name}: ${method} ${path}`);
|
|
2736
2735
|
try {
|
|
2737
2736
|
const { GoogleAuth } = await import("google-auth-library");
|
|
2738
|
-
const keyJsonBase64 =
|
|
2739
|
-
const propertyId =
|
|
2737
|
+
const keyJsonBase64 = parameters2.serviceAccountKeyJsonBase64.getValue(connection);
|
|
2738
|
+
const propertyId = parameters2.propertyId.getValue(connection);
|
|
2740
2739
|
const credentials = JSON.parse(
|
|
2741
2740
|
Buffer.from(keyJsonBase64, "base64").toString("utf-8")
|
|
2742
2741
|
);
|
|
@@ -2789,7 +2788,7 @@ var googleAnalyticsConnector = new ConnectorPlugin({
|
|
|
2789
2788
|
name: "Google Analytics",
|
|
2790
2789
|
description: "Connect to Google Analytics for web analytics and reporting.",
|
|
2791
2790
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/7fs0ipzxuD9mACDzBATtxX/3c53ed90d15c96483e4f78cb29dab5e9/google-analytics.svg",
|
|
2792
|
-
parameters:
|
|
2791
|
+
parameters: parameters2,
|
|
2793
2792
|
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
2794
2793
|
systemPrompt: `## Google Analytics Data API
|
|
2795
2794
|
- Call the GA4 Data API using the authenticated request tool
|
|
@@ -2818,7 +2817,36 @@ averageSessionDuration, conversions, totalRevenue
|
|
|
2818
2817
|
|
|
2819
2818
|
### Date Specification
|
|
2820
2819
|
- Absolute: "2024-01-01"
|
|
2821
|
-
- Relative: "today", "yesterday", "7daysAgo", "30daysAgo"
|
|
2820
|
+
- Relative: "today", "yesterday", "7daysAgo", "30daysAgo"
|
|
2821
|
+
|
|
2822
|
+
## Google Analytics SDK (TypeScript handler)
|
|
2823
|
+
Non-SQL connectors like Google Analytics can also be used via the SDK in TypeScript handlers:
|
|
2824
|
+
|
|
2825
|
+
\`\`\`ts
|
|
2826
|
+
import { connection } from "@squadbase/vite-server/connectors/google-analytics";
|
|
2827
|
+
|
|
2828
|
+
const ga = connection("<connectionId>");
|
|
2829
|
+
|
|
2830
|
+
// Authenticated fetch (returns standard Response)
|
|
2831
|
+
const res = await ga.request("properties/{propertyId}:runReport", {
|
|
2832
|
+
method: "POST",
|
|
2833
|
+
body: JSON.stringify({ dateRanges: [{ startDate: "7daysAgo", endDate: "today" }], metrics: [{ name: "activeUsers" }] }),
|
|
2834
|
+
});
|
|
2835
|
+
const data = await res.json();
|
|
2836
|
+
|
|
2837
|
+
// Convenience methods
|
|
2838
|
+
const { rows, rowCount } = await ga.runReport({
|
|
2839
|
+
dateRanges: [{ startDate: "7daysAgo", endDate: "today" }],
|
|
2840
|
+
dimensions: [{ name: "date" }],
|
|
2841
|
+
metrics: [{ name: "activeUsers" }, { name: "sessions" }],
|
|
2842
|
+
limit: 100,
|
|
2843
|
+
});
|
|
2844
|
+
const metadata = await ga.getMetadata();
|
|
2845
|
+
const realtime = await ga.runRealtimeReport({
|
|
2846
|
+
metrics: [{ name: "activeUsers" }],
|
|
2847
|
+
dimensions: [{ name: "country" }],
|
|
2848
|
+
});
|
|
2849
|
+
\`\`\``,
|
|
2822
2850
|
tools: tools11
|
|
2823
2851
|
});
|
|
2824
2852
|
|
|
@@ -2856,9 +2884,9 @@ Authentication is handled automatically using username and password.`,
|
|
|
2856
2884
|
}
|
|
2857
2885
|
console.log(`[connector-request] kintone/${connection.name}: ${method} ${path}`);
|
|
2858
2886
|
try {
|
|
2859
|
-
const baseUrl =
|
|
2860
|
-
const username =
|
|
2861
|
-
const password =
|
|
2887
|
+
const baseUrl = parameters3.baseUrl.getValue(connection);
|
|
2888
|
+
const username = parameters3.username.getValue(connection);
|
|
2889
|
+
const password = parameters3.password.getValue(connection);
|
|
2862
2890
|
const authToken = Buffer.from(`${username}:${password}`).toString("base64");
|
|
2863
2891
|
const url = `${baseUrl.replace(/\/+$/, "")}/k/v1/${path}`;
|
|
2864
2892
|
const controller = new AbortController();
|
|
@@ -2902,7 +2930,7 @@ var kintoneConnector = new ConnectorPlugin({
|
|
|
2902
2930
|
name: "kintone",
|
|
2903
2931
|
description: "Connect to kintone for business application data retrieval and analytics.",
|
|
2904
2932
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/76nPGMJFZkMFE3UQNo2JFy/e71dc5f5d5cec1306ce0e17aafbfd9f0/kintone.png",
|
|
2905
|
-
parameters,
|
|
2933
|
+
parameters: parameters3,
|
|
2906
2934
|
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
2907
2935
|
systemPrompt: `## kintone REST API
|
|
2908
2936
|
- Call the kintone REST API using the authenticated request tool
|
|
@@ -2958,37 +2986,6 @@ const { apps } = await kintone.listApps();
|
|
|
2958
2986
|
tools: tools12
|
|
2959
2987
|
});
|
|
2960
2988
|
|
|
2961
|
-
// src/connectors/wix-store/parameters.ts
|
|
2962
|
-
var parameters14 = {
|
|
2963
|
-
accountId: new ParameterDefinition({
|
|
2964
|
-
slug: "account-id",
|
|
2965
|
-
name: "Account ID",
|
|
2966
|
-
description: "Account ID",
|
|
2967
|
-
envVarBaseKey: "WIX_ACCOUNT_ID",
|
|
2968
|
-
type: "text",
|
|
2969
|
-
secret: false,
|
|
2970
|
-
required: true
|
|
2971
|
-
}),
|
|
2972
|
-
siteId: new ParameterDefinition({
|
|
2973
|
-
slug: "site-id",
|
|
2974
|
-
name: "Site ID",
|
|
2975
|
-
description: "Site ID for Wix Store Project",
|
|
2976
|
-
envVarBaseKey: "WIX_SITE_ID",
|
|
2977
|
-
type: "text",
|
|
2978
|
-
secret: false,
|
|
2979
|
-
required: true
|
|
2980
|
-
}),
|
|
2981
|
-
apiKey: new ParameterDefinition({
|
|
2982
|
-
slug: "api-key",
|
|
2983
|
-
name: "API Key",
|
|
2984
|
-
description: "API Key to access the Wix store project",
|
|
2985
|
-
envVarBaseKey: "WIX_API_KEY",
|
|
2986
|
-
type: "text",
|
|
2987
|
-
secret: true,
|
|
2988
|
-
required: true
|
|
2989
|
-
})
|
|
2990
|
-
};
|
|
2991
|
-
|
|
2992
2989
|
// src/connectors/wix-store/tools/request.ts
|
|
2993
2990
|
import { z as z15 } from "zod";
|
|
2994
2991
|
var BASE_URL3 = "https://www.wixapis.com/";
|
|
@@ -3024,8 +3021,8 @@ Authentication is handled automatically using the API Key and Site ID.`,
|
|
|
3024
3021
|
}
|
|
3025
3022
|
console.log(`[connector-request] wix-store/${connection.name}: ${method} ${path}`);
|
|
3026
3023
|
try {
|
|
3027
|
-
const apiKey =
|
|
3028
|
-
const siteId =
|
|
3024
|
+
const apiKey = parameters4.apiKey.getValue(connection);
|
|
3025
|
+
const siteId = parameters4.siteId.getValue(connection);
|
|
3029
3026
|
const url = `${BASE_URL3}${path}`;
|
|
3030
3027
|
const controller = new AbortController();
|
|
3031
3028
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS6);
|
|
@@ -3067,12 +3064,14 @@ var wixStoreConnector = new ConnectorPlugin({
|
|
|
3067
3064
|
name: "Wix Store",
|
|
3068
3065
|
description: "Connect to Wix Store.",
|
|
3069
3066
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/YyFxclQFzROIYpFam6vRK/e7e75d3feac49a1cc5e433c147216d23/Wix_logo_black.svg",
|
|
3070
|
-
parameters:
|
|
3067
|
+
parameters: parameters4,
|
|
3071
3068
|
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
3072
3069
|
systemPrompt: `## Wix Store API
|
|
3073
3070
|
- Call the Wix Store REST API using the authenticated request tool
|
|
3074
3071
|
- Authentication (API Key, Site ID) is automatically configured
|
|
3075
3072
|
- Wix API uses POST for query endpoints as well
|
|
3073
|
+
- Wix uses WQL (Wix Query Language) for filters
|
|
3074
|
+
- Max 100 items per page
|
|
3076
3075
|
|
|
3077
3076
|
### List Products
|
|
3078
3077
|
- POST stores/v1/products/query
|
|
@@ -3082,55 +3081,46 @@ var wixStoreConnector = new ConnectorPlugin({
|
|
|
3082
3081
|
- POST stores/v1/products/query
|
|
3083
3082
|
- Body: { "query": { "filter": { "name": { "$contains": "keyword" } }, "paging": { "limit": 50 } } }
|
|
3084
3083
|
|
|
3085
|
-
###
|
|
3086
|
-
- POST
|
|
3087
|
-
- Body: { "
|
|
3084
|
+
### Search Orders (eCommerce Orders V1)
|
|
3085
|
+
- POST ecom/v1/orders/search
|
|
3086
|
+
- Body: { "search": { "cursorPaging": { "limit": 50 } } }
|
|
3087
|
+
- Uses cursor-based pagination (cursorPaging, not paging)
|
|
3088
|
+
- Response includes pagingMetadata.cursors.next for pagination
|
|
3088
3089
|
|
|
3089
3090
|
### List Collections (Categories)
|
|
3090
3091
|
- POST stores/v1/collections/query
|
|
3091
|
-
- Body: { "query": { "paging": { "limit": 50 } } }
|
|
3092
|
-
|
|
3092
|
+
- Body: { "query": { "paging": { "limit": 50 } } }
|
|
3093
|
+
|
|
3094
|
+
### List Inventory Items
|
|
3095
|
+
- POST stores/v2/inventoryItems/query
|
|
3096
|
+
- Body: { "query": { "paging": { "limit": 50 } } }
|
|
3097
|
+
|
|
3098
|
+
## Wix Store SDK (TypeScript handler)
|
|
3099
|
+
Non-SQL connectors like Wix Store can also be used via the SDK in TypeScript handlers:
|
|
3100
|
+
|
|
3101
|
+
\`\`\`ts
|
|
3102
|
+
import { connection } from "@squadbase/vite-server/connectors/wix-store";
|
|
3103
|
+
|
|
3104
|
+
const wix = connection("<connectionId>");
|
|
3105
|
+
|
|
3106
|
+
// Authenticated fetch (returns standard Response)
|
|
3107
|
+
const res = await wix.request("/stores/v1/products/query", {
|
|
3108
|
+
method: "POST",
|
|
3109
|
+
headers: { "Content-Type": "application/json" },
|
|
3110
|
+
body: JSON.stringify({ query: { paging: { limit: 10 } } }),
|
|
3093
3111
|
});
|
|
3112
|
+
const data = await res.json();
|
|
3094
3113
|
|
|
3095
|
-
//
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
}),
|
|
3106
|
-
accountId: new ParameterDefinition({
|
|
3107
|
-
slug: "account-id",
|
|
3108
|
-
name: "dbt Account ID",
|
|
3109
|
-
description: "The dbt Cloud account ID.",
|
|
3110
|
-
envVarBaseKey: "DBT_ACCOUNT_ID",
|
|
3111
|
-
type: "text",
|
|
3112
|
-
secret: false,
|
|
3113
|
-
required: true
|
|
3114
|
-
}),
|
|
3115
|
-
prodEnvId: new ParameterDefinition({
|
|
3116
|
-
slug: "prod-env-id",
|
|
3117
|
-
name: "dbt Production Environment ID",
|
|
3118
|
-
description: "The dbt Cloud production environment ID.",
|
|
3119
|
-
envVarBaseKey: "DBT_PROD_ENV_ID",
|
|
3120
|
-
type: "text",
|
|
3121
|
-
secret: false,
|
|
3122
|
-
required: true
|
|
3123
|
-
}),
|
|
3124
|
-
token: new ParameterDefinition({
|
|
3125
|
-
slug: "token",
|
|
3126
|
-
name: "dbt API Token",
|
|
3127
|
-
description: "The API token for authenticating with dbt Cloud.",
|
|
3128
|
-
envVarBaseKey: "DBT_TOKEN",
|
|
3129
|
-
type: "text",
|
|
3130
|
-
secret: true,
|
|
3131
|
-
required: true
|
|
3132
|
-
})
|
|
3133
|
-
};
|
|
3114
|
+
// Convenience methods
|
|
3115
|
+
const { products, totalResults } = await wix.queryProducts({ paging: { limit: 50 } });
|
|
3116
|
+
const { product } = await wix.getProduct("product-id");
|
|
3117
|
+
const { orders, pagingMetadata } = await wix.queryOrders({ cursorPaging: { limit: 50 } });
|
|
3118
|
+
const { order } = await wix.getOrder("order-id");
|
|
3119
|
+
const { inventoryItems } = await wix.queryInventory({ paging: { limit: 50 } });
|
|
3120
|
+
const { collections } = await wix.queryCollections({ paging: { limit: 50 } });
|
|
3121
|
+
\`\`\``,
|
|
3122
|
+
tools: tools13
|
|
3123
|
+
});
|
|
3134
3124
|
|
|
3135
3125
|
// src/connectors/dbt/tools/request.ts
|
|
3136
3126
|
import { z as z16 } from "zod";
|
|
@@ -3170,9 +3160,9 @@ Authentication is handled automatically using the API token.
|
|
|
3170
3160
|
}
|
|
3171
3161
|
console.log(`[connector-request] dbt/${connection.name}: GraphQL query`);
|
|
3172
3162
|
try {
|
|
3173
|
-
const host =
|
|
3174
|
-
const token =
|
|
3175
|
-
const environmentId =
|
|
3163
|
+
const host = parameters5.host.getValue(connection);
|
|
3164
|
+
const token = parameters5.token.getValue(connection);
|
|
3165
|
+
const environmentId = parameters5.prodEnvId.getValue(connection);
|
|
3176
3166
|
const resolvedVariables = variables ? JSON.parse(
|
|
3177
3167
|
JSON.stringify(variables).replace(/\{environmentId\}/g, environmentId)
|
|
3178
3168
|
) : void 0;
|
|
@@ -3222,7 +3212,7 @@ var dbtConnector = new ConnectorPlugin({
|
|
|
3222
3212
|
name: "dbt",
|
|
3223
3213
|
description: "Connect to dbt Cloud for data transformation and analytics engineering.",
|
|
3224
3214
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/4iT6ncXtdtHdkXexU0WgfZ/0367a38d245f2568eab5eb511f9ee692/dbt.png",
|
|
3225
|
-
parameters:
|
|
3215
|
+
parameters: parameters5,
|
|
3226
3216
|
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
3227
3217
|
systemPrompt: `## dbt Cloud Discovery API (GraphQL)
|
|
3228
3218
|
- Call the dbt Cloud Discovery API using the authenticated request tool
|
|
@@ -3274,7 +3264,36 @@ query:
|
|
|
3274
3264
|
|
|
3275
3265
|
### Lineage (Dependencies)
|
|
3276
3266
|
- Traverse relationships using ancestors / children fields
|
|
3277
|
-
- Get ancestors { uniqueId name } or children { uniqueId name } within node
|
|
3267
|
+
- Get ancestors { uniqueId name } or children { uniqueId name } within node
|
|
3268
|
+
|
|
3269
|
+
## dbt SDK (TypeScript handler)
|
|
3270
|
+
Non-SQL connectors like dbt can also be used via the SDK in TypeScript handlers:
|
|
3271
|
+
|
|
3272
|
+
\`\`\`ts
|
|
3273
|
+
import { connection } from "@squadbase/vite-server/connectors/dbt";
|
|
3274
|
+
|
|
3275
|
+
const dbt = connection("<connectionId>");
|
|
3276
|
+
|
|
3277
|
+
// Authenticated fetch (returns standard Response)
|
|
3278
|
+
const res = await dbt.request("/graphql", {
|
|
3279
|
+
method: "POST",
|
|
3280
|
+
headers: { "Content-Type": "application/json" },
|
|
3281
|
+
body: JSON.stringify({ query: "{ ... }", variables: {} }),
|
|
3282
|
+
});
|
|
3283
|
+
const data = await res.json();
|
|
3284
|
+
|
|
3285
|
+
// Convenience methods
|
|
3286
|
+
const result = await dbt.query(\`
|
|
3287
|
+
query($environmentId: BigInt!) {
|
|
3288
|
+
environment(id: $environmentId) { applied { models(first: 10) { edges { node { name } } } } }
|
|
3289
|
+
}
|
|
3290
|
+
\`);
|
|
3291
|
+
const models = await dbt.getModels({ limit: 100 });
|
|
3292
|
+
const model = await dbt.getModelByUniqueId("model.project.my_model");
|
|
3293
|
+
const sources = await dbt.getSources({ limit: 100 });
|
|
3294
|
+
const tests = await dbt.getTests({ limit: 100 });
|
|
3295
|
+
const metrics = await dbt.getMetrics({ limit: 100 });
|
|
3296
|
+
\`\`\``,
|
|
3278
3297
|
tools: tools14
|
|
3279
3298
|
});
|
|
3280
3299
|
|
|
@@ -3425,7 +3444,7 @@ var openaiConnector = new ConnectorPlugin({
|
|
|
3425
3444
|
name: "OpenAI",
|
|
3426
3445
|
description: "Connect to OpenAI for AI model inference, embeddings, and image generation.",
|
|
3427
3446
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/53XJtCgUlW10x6i1X8xpxM/0bfd634069f1d74241296543cb20427a/openai.svg",
|
|
3428
|
-
parameters:
|
|
3447
|
+
parameters: parameters6,
|
|
3429
3448
|
releaseFlag: { dev1: true, dev2: false, prod: false },
|
|
3430
3449
|
systemPrompt: `## OpenAI SDK (TypeScript handler)
|
|
3431
3450
|
Use the OpenAI connector via the SDK in TypeScript handlers:
|