@squadbase/connectors 0.0.13 → 0.0.14
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 +294 -277
- 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 {
|
|
@@ -226,7 +230,7 @@ Follow these steps to set up the Snowflake connection.
|
|
|
226
230
|
});
|
|
227
231
|
|
|
228
232
|
// src/connectors/snowflake/parameters.ts
|
|
229
|
-
var
|
|
233
|
+
var parameters7 = {
|
|
230
234
|
account: new ParameterDefinition({
|
|
231
235
|
slug: "account",
|
|
232
236
|
name: "Snowflake Account",
|
|
@@ -342,15 +346,15 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
342
346
|
try {
|
|
343
347
|
const snowflake = (await import("snowflake-sdk")).default;
|
|
344
348
|
snowflake.configure({ logLevel: "ERROR" });
|
|
345
|
-
const account =
|
|
346
|
-
const user =
|
|
347
|
-
const role =
|
|
348
|
-
const warehouse =
|
|
349
|
-
const privateKeyBase64 =
|
|
349
|
+
const account = parameters7.account.getValue(connection);
|
|
350
|
+
const user = parameters7.user.getValue(connection);
|
|
351
|
+
const role = parameters7.role.getValue(connection);
|
|
352
|
+
const warehouse = parameters7.warehouse.getValue(connection);
|
|
353
|
+
const privateKeyBase64 = parameters7.privateKeyBase64.getValue(connection);
|
|
350
354
|
const privateKeyPem = Buffer.from(privateKeyBase64, "base64").toString(
|
|
351
355
|
"utf-8"
|
|
352
356
|
);
|
|
353
|
-
const privateKeyPass =
|
|
357
|
+
const privateKeyPass = parameters7.privateKeyPassphrase.tryGetValue(connection);
|
|
354
358
|
const privateKey = decryptPrivateKey(privateKeyPem, privateKeyPass ?? void 0);
|
|
355
359
|
const conn = snowflake.createConnection({
|
|
356
360
|
account,
|
|
@@ -415,7 +419,7 @@ var snowflakeConnector = new ConnectorPlugin({
|
|
|
415
419
|
name: "Snowflake",
|
|
416
420
|
description: "Connect to Snowflake for cloud data warehousing and analytics.",
|
|
417
421
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/6oyVtAcP3pMlXaOrts9unk/b7a9dc25d15c388b66e983041b855447/snowflake.svg",
|
|
418
|
-
parameters:
|
|
422
|
+
parameters: parameters7,
|
|
419
423
|
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
420
424
|
setup: snowflakeSetup,
|
|
421
425
|
systemPrompt: `## Snowflake SQL Notes
|
|
@@ -432,16 +436,16 @@ var snowflakeConnector = new ConnectorPlugin({
|
|
|
432
436
|
const snowflake = (await import("snowflake-sdk")).default;
|
|
433
437
|
snowflake.configure({ logLevel: "ERROR" });
|
|
434
438
|
const privateKeyPem = Buffer.from(
|
|
435
|
-
params[
|
|
439
|
+
params[parameters7.privateKeyBase64.slug],
|
|
436
440
|
"base64"
|
|
437
441
|
).toString("utf-8");
|
|
438
|
-
const privateKeyPass = params[
|
|
442
|
+
const privateKeyPass = params[parameters7.privateKeyPassphrase.slug] || void 0;
|
|
439
443
|
const privateKey = decryptPrivateKey(privateKeyPem, privateKeyPass);
|
|
440
444
|
const conn = snowflake.createConnection({
|
|
441
|
-
account: params[
|
|
442
|
-
username: params[
|
|
443
|
-
role: params[
|
|
444
|
-
warehouse: params[
|
|
445
|
+
account: params[parameters7.account.slug],
|
|
446
|
+
username: params[parameters7.user.slug],
|
|
447
|
+
role: params[parameters7.role.slug],
|
|
448
|
+
warehouse: params[parameters7.warehouse.slug],
|
|
445
449
|
authenticator: "SNOWFLAKE_JWT",
|
|
446
450
|
privateKey
|
|
447
451
|
});
|
|
@@ -473,16 +477,16 @@ var snowflakeConnector = new ConnectorPlugin({
|
|
|
473
477
|
const snowflake = (await import("snowflake-sdk")).default;
|
|
474
478
|
snowflake.configure({ logLevel: "ERROR" });
|
|
475
479
|
const privateKeyPem = Buffer.from(
|
|
476
|
-
params[
|
|
480
|
+
params[parameters7.privateKeyBase64.slug],
|
|
477
481
|
"base64"
|
|
478
482
|
).toString("utf-8");
|
|
479
|
-
const privateKeyPass = params[
|
|
483
|
+
const privateKeyPass = params[parameters7.privateKeyPassphrase.slug] || void 0;
|
|
480
484
|
const privateKey = decryptPrivateKey(privateKeyPem, privateKeyPass);
|
|
481
485
|
const conn = snowflake.createConnection({
|
|
482
|
-
account: params[
|
|
483
|
-
username: params[
|
|
484
|
-
role: params[
|
|
485
|
-
warehouse: params[
|
|
486
|
+
account: params[parameters7.account.slug],
|
|
487
|
+
username: params[parameters7.user.slug],
|
|
488
|
+
role: params[parameters7.role.slug],
|
|
489
|
+
warehouse: params[parameters7.warehouse.slug],
|
|
486
490
|
authenticator: "SNOWFLAKE_JWT",
|
|
487
491
|
privateKey
|
|
488
492
|
});
|
|
@@ -511,7 +515,7 @@ var snowflakeConnector = new ConnectorPlugin({
|
|
|
511
515
|
});
|
|
512
516
|
|
|
513
517
|
// src/connectors/snowflake-pat/parameters.ts
|
|
514
|
-
var
|
|
518
|
+
var parameters8 = {
|
|
515
519
|
account: new ParameterDefinition({
|
|
516
520
|
slug: "account",
|
|
517
521
|
name: "Snowflake Account",
|
|
@@ -605,11 +609,11 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
605
609
|
try {
|
|
606
610
|
const snowflake = (await import("snowflake-sdk")).default;
|
|
607
611
|
snowflake.configure({ logLevel: "ERROR" });
|
|
608
|
-
const account =
|
|
609
|
-
const user =
|
|
610
|
-
const role =
|
|
611
|
-
const warehouse =
|
|
612
|
-
const password =
|
|
612
|
+
const account = parameters8.account.getValue(connection);
|
|
613
|
+
const user = parameters8.user.getValue(connection);
|
|
614
|
+
const role = parameters8.role.getValue(connection);
|
|
615
|
+
const warehouse = parameters8.warehouse.getValue(connection);
|
|
616
|
+
const password = parameters8.pat.getValue(connection);
|
|
613
617
|
const conn = snowflake.createConnection({
|
|
614
618
|
account,
|
|
615
619
|
username: user,
|
|
@@ -672,7 +676,7 @@ var snowflakePatConnector = new ConnectorPlugin({
|
|
|
672
676
|
name: "Snowflake (PAT)",
|
|
673
677
|
description: "Connect to Snowflake using a Personal Access Token (PAT).",
|
|
674
678
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/6oyVtAcP3pMlXaOrts9unk/b7a9dc25d15c388b66e983041b855447/snowflake.svg",
|
|
675
|
-
parameters:
|
|
679
|
+
parameters: parameters8,
|
|
676
680
|
releaseFlag: { dev1: true, dev2: false, prod: false },
|
|
677
681
|
setup: snowflakeSetup,
|
|
678
682
|
systemPrompt: `## Snowflake SQL Notes
|
|
@@ -689,11 +693,11 @@ var snowflakePatConnector = new ConnectorPlugin({
|
|
|
689
693
|
const snowflake = (await import("snowflake-sdk")).default;
|
|
690
694
|
snowflake.configure({ logLevel: "ERROR" });
|
|
691
695
|
const conn = snowflake.createConnection({
|
|
692
|
-
account: params[
|
|
693
|
-
username: params[
|
|
694
|
-
role: params[
|
|
695
|
-
warehouse: params[
|
|
696
|
-
password: params[
|
|
696
|
+
account: params[parameters8.account.slug],
|
|
697
|
+
username: params[parameters8.user.slug],
|
|
698
|
+
role: params[parameters8.role.slug],
|
|
699
|
+
warehouse: params[parameters8.warehouse.slug],
|
|
700
|
+
password: params[parameters8.pat.slug]
|
|
697
701
|
});
|
|
698
702
|
await new Promise((resolve, reject) => {
|
|
699
703
|
conn.connect((err) => {
|
|
@@ -728,11 +732,11 @@ var snowflakePatConnector = new ConnectorPlugin({
|
|
|
728
732
|
const snowflake = (await import("snowflake-sdk")).default;
|
|
729
733
|
snowflake.configure({ logLevel: "ERROR" });
|
|
730
734
|
const conn = snowflake.createConnection({
|
|
731
|
-
account: params[
|
|
732
|
-
username: params[
|
|
733
|
-
role: params[
|
|
734
|
-
warehouse: params[
|
|
735
|
-
password: params[
|
|
735
|
+
account: params[parameters8.account.slug],
|
|
736
|
+
username: params[parameters8.user.slug],
|
|
737
|
+
role: params[parameters8.role.slug],
|
|
738
|
+
warehouse: params[parameters8.warehouse.slug],
|
|
739
|
+
password: params[parameters8.pat.slug]
|
|
736
740
|
});
|
|
737
741
|
await new Promise((resolve, reject) => {
|
|
738
742
|
conn.connect((err) => {
|
|
@@ -764,7 +768,7 @@ var snowflakePatConnector = new ConnectorPlugin({
|
|
|
764
768
|
});
|
|
765
769
|
|
|
766
770
|
// src/connectors/postgresql/parameters.ts
|
|
767
|
-
var
|
|
771
|
+
var parameters9 = {
|
|
768
772
|
connectionUrl: new ParameterDefinition({
|
|
769
773
|
slug: "connection-url",
|
|
770
774
|
name: "PostgreSQL Connection URL",
|
|
@@ -821,7 +825,7 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
821
825
|
let connectionUrl;
|
|
822
826
|
try {
|
|
823
827
|
const { Pool } = await import("pg");
|
|
824
|
-
connectionUrl =
|
|
828
|
+
connectionUrl = parameters9.connectionUrl.getValue(connection);
|
|
825
829
|
const pool = new Pool({
|
|
826
830
|
connectionString: connectionUrl,
|
|
827
831
|
ssl: { rejectUnauthorized: false },
|
|
@@ -859,7 +863,7 @@ var postgresqlConnector = new ConnectorPlugin({
|
|
|
859
863
|
name: "PostgreSQL",
|
|
860
864
|
description: "Connect to PostgreSQL databases for relational data storage and querying.",
|
|
861
865
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/42AHi2uqteUn65MyqdN6V7/a0f68f12af6aac96bbcda5980f43de07/elephant.png",
|
|
862
|
-
parameters:
|
|
866
|
+
parameters: parameters9,
|
|
863
867
|
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
864
868
|
systemPrompt: `## PostgreSQL SQL Notes
|
|
865
869
|
- Schema exploration:
|
|
@@ -870,7 +874,7 @@ var postgresqlConnector = new ConnectorPlugin({
|
|
|
870
874
|
async checkConnection(params, _config) {
|
|
871
875
|
const { Pool } = await import("pg");
|
|
872
876
|
const pool = new Pool({
|
|
873
|
-
connectionString: params[
|
|
877
|
+
connectionString: params[parameters9.connectionUrl.slug],
|
|
874
878
|
ssl: { rejectUnauthorized: false },
|
|
875
879
|
connectionTimeoutMillis: 1e4
|
|
876
880
|
});
|
|
@@ -887,7 +891,7 @@ var postgresqlConnector = new ConnectorPlugin({
|
|
|
887
891
|
const { Pool } = await import("pg");
|
|
888
892
|
const { text, values } = buildPositionalParams(sql, namedParams);
|
|
889
893
|
const pool = new Pool({
|
|
890
|
-
connectionString: params[
|
|
894
|
+
connectionString: params[parameters9.connectionUrl.slug],
|
|
891
895
|
ssl: { rejectUnauthorized: false },
|
|
892
896
|
connectionTimeoutMillis: 1e4,
|
|
893
897
|
statement_timeout: 6e4
|
|
@@ -902,7 +906,7 @@ var postgresqlConnector = new ConnectorPlugin({
|
|
|
902
906
|
});
|
|
903
907
|
|
|
904
908
|
// src/connectors/mysql/parameters.ts
|
|
905
|
-
var
|
|
909
|
+
var parameters10 = {
|
|
906
910
|
connectionUrl: new ParameterDefinition({
|
|
907
911
|
slug: "connection-url",
|
|
908
912
|
name: "MySQL Connection URL",
|
|
@@ -959,7 +963,7 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
959
963
|
let connectionUrl;
|
|
960
964
|
try {
|
|
961
965
|
const mysql = await import("mysql2/promise");
|
|
962
|
-
connectionUrl =
|
|
966
|
+
connectionUrl = parameters10.connectionUrl.getValue(connection);
|
|
963
967
|
const pool = mysql.createPool({
|
|
964
968
|
uri: connectionUrl,
|
|
965
969
|
connectTimeout: CONNECT_TIMEOUT_MS2
|
|
@@ -999,7 +1003,7 @@ var mysqlConnector = new ConnectorPlugin({
|
|
|
999
1003
|
name: "MySQL",
|
|
1000
1004
|
description: "Connect to MySQL databases for relational data storage and querying.",
|
|
1001
1005
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/6ghPFeGgl7uBs5NHH1a4L/512c9433beec5b595caa41f04921c1f9/logo-mysql-170x115.png",
|
|
1002
|
-
parameters:
|
|
1006
|
+
parameters: parameters10,
|
|
1003
1007
|
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
1004
1008
|
systemPrompt: `## MySQL SQL Notes
|
|
1005
1009
|
- Schema exploration:
|
|
@@ -1010,7 +1014,7 @@ var mysqlConnector = new ConnectorPlugin({
|
|
|
1010
1014
|
async checkConnection(params, _config) {
|
|
1011
1015
|
const mysql = await import("mysql2/promise");
|
|
1012
1016
|
const pool = mysql.createPool({
|
|
1013
|
-
uri: params[
|
|
1017
|
+
uri: params[parameters10.connectionUrl.slug],
|
|
1014
1018
|
connectTimeout: 1e4
|
|
1015
1019
|
});
|
|
1016
1020
|
try {
|
|
@@ -1026,7 +1030,7 @@ var mysqlConnector = new ConnectorPlugin({
|
|
|
1026
1030
|
const mysql = await import("mysql2/promise");
|
|
1027
1031
|
const { text, values } = buildQuestionmarkParams(sql, namedParams);
|
|
1028
1032
|
const pool = mysql.createPool({
|
|
1029
|
-
uri: params[
|
|
1033
|
+
uri: params[parameters10.connectionUrl.slug],
|
|
1030
1034
|
connectTimeout: 1e4
|
|
1031
1035
|
});
|
|
1032
1036
|
try {
|
|
@@ -1047,7 +1051,7 @@ var mysqlConnector = new ConnectorPlugin({
|
|
|
1047
1051
|
import { z as z5 } from "zod";
|
|
1048
1052
|
|
|
1049
1053
|
// src/connectors/bigquery/parameters.ts
|
|
1050
|
-
var
|
|
1054
|
+
var parameters11 = {
|
|
1051
1055
|
serviceAccountKeyJsonBase64: new ParameterDefinition({
|
|
1052
1056
|
slug: "service-account-key-json-base64",
|
|
1053
1057
|
name: "Google Cloud Service Account JSON",
|
|
@@ -1104,7 +1108,7 @@ var listProjectsTool = new ConnectorTool({
|
|
|
1104
1108
|
};
|
|
1105
1109
|
}
|
|
1106
1110
|
try {
|
|
1107
|
-
const serviceAccountJsonBase64 =
|
|
1111
|
+
const serviceAccountJsonBase64 = parameters11.serviceAccountKeyJsonBase64.getValue(connection);
|
|
1108
1112
|
const credentials = JSON.parse(
|
|
1109
1113
|
Buffer.from(serviceAccountJsonBase64, "base64").toString("utf-8")
|
|
1110
1114
|
);
|
|
@@ -1142,14 +1146,16 @@ var bigquerySetup = new ConnectorSetup({
|
|
|
1142
1146
|
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
1147
|
2. \`updateConnectionParameters\` \u3092\u547C\u3073\u51FA\u3059:
|
|
1144
1148
|
- \`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
|
|
1149
|
+
- \`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
1150
|
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
1151
|
|
|
1148
1152
|
#### \u30B9\u30C6\u30C3\u30D72: \u30C7\u30FC\u30BF\u30BB\u30C3\u30C8\u9078\u629E
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
+
- **\`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
|
|
1154
|
+
- **\u305D\u308C\u4EE5\u5916\u306E\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8**:
|
|
1155
|
+
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
|
|
1156
|
+
2. \u7D50\u679C\u306B\u5FDC\u3058\u3066\u5206\u5C90:
|
|
1157
|
+
- **\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
|
|
1158
|
+
- **\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
1159
|
|
|
1154
1160
|
#### \u30B9\u30C6\u30C3\u30D73: \u30C6\u30FC\u30D6\u30EB\u9078\u629E
|
|
1155
1161
|
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
|
|
@@ -1179,14 +1185,16 @@ Follow these steps to set up the BigQuery connection.
|
|
|
1179
1185
|
1. Call \`${listProjectsToolName}\` to get the list of GCP projects accessible with the service account credentials
|
|
1180
1186
|
2. Call \`updateConnectionParameters\`:
|
|
1181
1187
|
- \`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
|
|
1188
|
+
- \`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
1189
|
3. The \`label\` of the user's selected project will arrive as a message. Proceed to Step 2
|
|
1184
1190
|
|
|
1185
1191
|
#### Step 2: Dataset Selection
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1192
|
+
- **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
|
|
1193
|
+
- **Otherwise**:
|
|
1194
|
+
1. Run \`SELECT schema_name FROM INFORMATION_SCHEMA.SCHEMATA\` to get the list of datasets
|
|
1195
|
+
2. Branch based on results:
|
|
1196
|
+
- **2 or more datasets**: Present them to the user via \`askUserQuestion\` (multiSelect: true) and let them select which datasets to use
|
|
1197
|
+
- **Exactly 1 dataset**: Do NOT call askUserQuestion. Auto-select it. Just write "Auto-selected dataset X" in one sentence
|
|
1190
1198
|
|
|
1191
1199
|
#### Step 3: Table Selection
|
|
1192
1200
|
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)
|
|
@@ -1252,8 +1260,8 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
1252
1260
|
);
|
|
1253
1261
|
try {
|
|
1254
1262
|
const { BigQuery } = await import("@google-cloud/bigquery");
|
|
1255
|
-
const projectId =
|
|
1256
|
-
const serviceAccountJsonBase64 =
|
|
1263
|
+
const projectId = parameters11.projectId.getValue(connection);
|
|
1264
|
+
const serviceAccountJsonBase64 = parameters11.serviceAccountKeyJsonBase64.getValue(connection);
|
|
1257
1265
|
const credentials = JSON.parse(
|
|
1258
1266
|
Buffer.from(serviceAccountJsonBase64, "base64").toString("utf-8")
|
|
1259
1267
|
);
|
|
@@ -1283,7 +1291,7 @@ var bigqueryConnector = new ConnectorPlugin({
|
|
|
1283
1291
|
name: "BigQuery",
|
|
1284
1292
|
description: "Connect to Google BigQuery for data warehouse and analytics.",
|
|
1285
1293
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/6nlehQyOmdbktG5hOYkYMr/6ca559140d5ddc7dadc5eac88858a563/bigquery.svg",
|
|
1286
|
-
parameters:
|
|
1294
|
+
parameters: parameters11,
|
|
1287
1295
|
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
1288
1296
|
setup: bigquerySetup,
|
|
1289
1297
|
systemPrompt: `## BigQuery SQL Notes
|
|
@@ -1297,10 +1305,10 @@ var bigqueryConnector = new ConnectorPlugin({
|
|
|
1297
1305
|
async checkConnection(params, _config) {
|
|
1298
1306
|
const { BigQuery } = await import("@google-cloud/bigquery");
|
|
1299
1307
|
const credentials = JSON.parse(
|
|
1300
|
-
Buffer.from(params[
|
|
1308
|
+
Buffer.from(params[parameters11.serviceAccountKeyJsonBase64.slug], "base64").toString("utf-8")
|
|
1301
1309
|
);
|
|
1302
1310
|
const bq = new BigQuery({
|
|
1303
|
-
projectId: params[
|
|
1311
|
+
projectId: params[parameters11.projectId.slug],
|
|
1304
1312
|
credentials
|
|
1305
1313
|
});
|
|
1306
1314
|
try {
|
|
@@ -1315,10 +1323,10 @@ var bigqueryConnector = new ConnectorPlugin({
|
|
|
1315
1323
|
const { BigQuery } = await import("@google-cloud/bigquery");
|
|
1316
1324
|
const resolvedSql = replaceLiteralParams(sql, namedParams);
|
|
1317
1325
|
const credentials = JSON.parse(
|
|
1318
|
-
Buffer.from(params[
|
|
1326
|
+
Buffer.from(params[parameters11.serviceAccountKeyJsonBase64.slug], "base64").toString("utf-8")
|
|
1319
1327
|
);
|
|
1320
1328
|
const bq = new BigQuery({
|
|
1321
|
-
projectId: params[
|
|
1329
|
+
projectId: params[parameters11.projectId.slug],
|
|
1322
1330
|
credentials
|
|
1323
1331
|
});
|
|
1324
1332
|
const [job] = await bq.createQueryJob({ query: resolvedSql });
|
|
@@ -1447,14 +1455,16 @@ var bigquerySetup2 = new ConnectorSetup({
|
|
|
1447
1455
|
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
1456
|
2. \`updateConnectionParameters\` \u3092\u547C\u3073\u51FA\u3059:
|
|
1449
1457
|
- \`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
|
|
1458
|
+
- \`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
1459
|
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
1460
|
|
|
1453
1461
|
#### \u30B9\u30C6\u30C3\u30D72: \u30C7\u30FC\u30BF\u30BB\u30C3\u30C8\u9078\u629E
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1462
|
+
- **\`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
|
|
1463
|
+
- **\u305D\u308C\u4EE5\u5916\u306E\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8**:
|
|
1464
|
+
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
|
|
1465
|
+
2. \u7D50\u679C\u306B\u5FDC\u3058\u3066\u5206\u5C90:
|
|
1466
|
+
- **\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
|
|
1467
|
+
- **\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
1468
|
|
|
1459
1469
|
#### \u30B9\u30C6\u30C3\u30D73: \u30C6\u30FC\u30D6\u30EB\u9078\u629E
|
|
1460
1470
|
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
|
|
@@ -1484,14 +1494,16 @@ Follow these steps to set up the BigQuery connection.
|
|
|
1484
1494
|
1. Call \`${listProjectsToolName2}\` to get the list of GCP projects accessible with the OAuth credentials
|
|
1485
1495
|
2. Call \`updateConnectionParameters\`:
|
|
1486
1496
|
- \`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
|
|
1497
|
+
- \`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
1498
|
3. The \`label\` of the user's selected project will arrive as a message. Proceed to Step 2
|
|
1489
1499
|
|
|
1490
1500
|
#### Step 2: Dataset Selection
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1501
|
+
- **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
|
|
1502
|
+
- **Otherwise**:
|
|
1503
|
+
1. Run \`SELECT schema_name FROM INFORMATION_SCHEMA.SCHEMATA\` to get the list of datasets
|
|
1504
|
+
2. Branch based on results:
|
|
1505
|
+
- **2 or more datasets**: Present them to the user via \`askUserQuestion\` (multiSelect: true) and let them select which datasets to use
|
|
1506
|
+
- **Exactly 1 dataset**: Do NOT call askUserQuestion. Auto-select it. Just write "Auto-selected dataset X" in one sentence
|
|
1495
1507
|
|
|
1496
1508
|
#### Step 3: Table Selection
|
|
1497
1509
|
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)
|
|
@@ -1514,7 +1526,7 @@ Follow these steps to set up the BigQuery connection.
|
|
|
1514
1526
|
});
|
|
1515
1527
|
|
|
1516
1528
|
// src/connectors/bigquery-oauth/parameters.ts
|
|
1517
|
-
var
|
|
1529
|
+
var parameters12 = {
|
|
1518
1530
|
projectId: new ParameterDefinition({
|
|
1519
1531
|
slug: "project-id",
|
|
1520
1532
|
name: "Google Cloud Project ID",
|
|
@@ -1608,7 +1620,7 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
1608
1620
|
error: `Connection ${connectionId} not found`
|
|
1609
1621
|
};
|
|
1610
1622
|
}
|
|
1611
|
-
const gcpProjectId =
|
|
1623
|
+
const gcpProjectId = parameters12.projectId.getValue(connection);
|
|
1612
1624
|
console.log(
|
|
1613
1625
|
`[connector-query] bigquery-oauth/${connection.name}: ${sql}`
|
|
1614
1626
|
);
|
|
@@ -1675,7 +1687,7 @@ var bigqueryOauthConnector = new ConnectorPlugin({
|
|
|
1675
1687
|
name: "BigQuery (OAuth)",
|
|
1676
1688
|
description: "Connect to Google BigQuery for data warehouse and analytics using OAuth.",
|
|
1677
1689
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/6nlehQyOmdbktG5hOYkYMr/6ca559140d5ddc7dadc5eac88858a563/bigquery.svg",
|
|
1678
|
-
parameters:
|
|
1690
|
+
parameters: parameters12,
|
|
1679
1691
|
releaseFlag: { dev1: true, dev2: false, prod: false },
|
|
1680
1692
|
setup: bigquerySetup2,
|
|
1681
1693
|
proxyPolicy: {
|
|
@@ -1694,7 +1706,7 @@ var bigqueryOauthConnector = new ConnectorPlugin({
|
|
|
1694
1706
|
tools: tools6,
|
|
1695
1707
|
async checkConnection(params, config) {
|
|
1696
1708
|
const { proxyFetch } = config;
|
|
1697
|
-
const projectId = params[
|
|
1709
|
+
const projectId = params[parameters12.projectId.slug];
|
|
1698
1710
|
const url = `https://bigquery.googleapis.com/bigquery/v2/projects/${projectId}/queries`;
|
|
1699
1711
|
try {
|
|
1700
1712
|
const res = await proxyFetch(url, {
|
|
@@ -1713,7 +1725,7 @@ var bigqueryOauthConnector = new ConnectorPlugin({
|
|
|
1713
1725
|
},
|
|
1714
1726
|
async query(params, sql, namedParams, context) {
|
|
1715
1727
|
const { proxyFetch } = context;
|
|
1716
|
-
const projectId = params[
|
|
1728
|
+
const projectId = params[parameters12.projectId.slug];
|
|
1717
1729
|
const resolvedSql = replaceLiteralParams(sql, namedParams);
|
|
1718
1730
|
const url = `https://bigquery.googleapis.com/bigquery/v2/projects/${projectId}/queries`;
|
|
1719
1731
|
const res = await proxyFetch(url, {
|
|
@@ -1731,7 +1743,7 @@ var bigqueryOauthConnector = new ConnectorPlugin({
|
|
|
1731
1743
|
});
|
|
1732
1744
|
|
|
1733
1745
|
// src/connectors/aws-athena/parameters.ts
|
|
1734
|
-
var
|
|
1746
|
+
var parameters13 = {
|
|
1735
1747
|
awsAccessKeyId: new ParameterDefinition({
|
|
1736
1748
|
slug: "aws-access-key-id",
|
|
1737
1749
|
name: "AWS Access Key ID",
|
|
@@ -1828,8 +1840,8 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
1828
1840
|
GetQueryExecutionCommand,
|
|
1829
1841
|
GetQueryResultsCommand
|
|
1830
1842
|
} = await import("@aws-sdk/client-athena");
|
|
1831
|
-
const workgroup =
|
|
1832
|
-
const outputLocation =
|
|
1843
|
+
const workgroup = parameters13.workgroup.tryGetValue(connection);
|
|
1844
|
+
const outputLocation = parameters13.outputLocation.tryGetValue(connection);
|
|
1833
1845
|
if (!workgroup && !outputLocation) {
|
|
1834
1846
|
return {
|
|
1835
1847
|
success: false,
|
|
@@ -1837,10 +1849,10 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
1837
1849
|
};
|
|
1838
1850
|
}
|
|
1839
1851
|
const client = new AthenaClient({
|
|
1840
|
-
region:
|
|
1852
|
+
region: parameters13.awsRegion.getValue(connection),
|
|
1841
1853
|
credentials: {
|
|
1842
|
-
accessKeyId:
|
|
1843
|
-
secretAccessKey:
|
|
1854
|
+
accessKeyId: parameters13.awsAccessKeyId.getValue(connection),
|
|
1855
|
+
secretAccessKey: parameters13.awsSecretAccessKey.getValue(connection)
|
|
1844
1856
|
}
|
|
1845
1857
|
});
|
|
1846
1858
|
const startParams = { QueryString: sql };
|
|
@@ -1904,7 +1916,7 @@ var awsAthenaConnector = new ConnectorPlugin({
|
|
|
1904
1916
|
name: "AWS Athena",
|
|
1905
1917
|
description: "Connect to AWS Athena for serverless SQL queries on S3 data.",
|
|
1906
1918
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/5x0vIHtUHfJJMZUv4RFOYZ/5059bac389f0169542f39cdb4b387d2c/Athena.svg",
|
|
1907
|
-
parameters:
|
|
1919
|
+
parameters: parameters13,
|
|
1908
1920
|
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
1909
1921
|
systemPrompt: `## AWS Athena SQL Notes
|
|
1910
1922
|
- Uses Presto/Trino based SQL syntax
|
|
@@ -1922,8 +1934,8 @@ var awsAthenaConnector = new ConnectorPlugin({
|
|
|
1922
1934
|
StartQueryExecutionCommand,
|
|
1923
1935
|
GetQueryExecutionCommand
|
|
1924
1936
|
} = await import("@aws-sdk/client-athena");
|
|
1925
|
-
const workgroup = params[
|
|
1926
|
-
const outputLocation = params[
|
|
1937
|
+
const workgroup = params[parameters13.workgroup.slug];
|
|
1938
|
+
const outputLocation = params[parameters13.outputLocation.slug];
|
|
1927
1939
|
if (!workgroup && !outputLocation) {
|
|
1928
1940
|
return {
|
|
1929
1941
|
success: false,
|
|
@@ -1931,10 +1943,10 @@ var awsAthenaConnector = new ConnectorPlugin({
|
|
|
1931
1943
|
};
|
|
1932
1944
|
}
|
|
1933
1945
|
const client = new AthenaClient({
|
|
1934
|
-
region: params[
|
|
1946
|
+
region: params[parameters13.awsRegion.slug],
|
|
1935
1947
|
credentials: {
|
|
1936
|
-
accessKeyId: params[
|
|
1937
|
-
secretAccessKey: params[
|
|
1948
|
+
accessKeyId: params[parameters13.awsAccessKeyId.slug],
|
|
1949
|
+
secretAccessKey: params[parameters13.awsSecretAccessKey.slug]
|
|
1938
1950
|
}
|
|
1939
1951
|
});
|
|
1940
1952
|
const startParams = { QueryString: "SELECT 1" };
|
|
@@ -1979,16 +1991,16 @@ var awsAthenaConnector = new ConnectorPlugin({
|
|
|
1979
1991
|
GetQueryResultsCommand
|
|
1980
1992
|
} = await import("@aws-sdk/client-athena");
|
|
1981
1993
|
const resolvedSql = replaceLiteralParams(sql, namedParams);
|
|
1982
|
-
const workgroup = params[
|
|
1983
|
-
const outputLocation = params[
|
|
1994
|
+
const workgroup = params[parameters13.workgroup.slug];
|
|
1995
|
+
const outputLocation = params[parameters13.outputLocation.slug];
|
|
1984
1996
|
if (!workgroup && !outputLocation) {
|
|
1985
1997
|
throw new Error("Either workgroup or output-location is required");
|
|
1986
1998
|
}
|
|
1987
1999
|
const client = new AthenaClient({
|
|
1988
|
-
region: params[
|
|
2000
|
+
region: params[parameters13.awsRegion.slug],
|
|
1989
2001
|
credentials: {
|
|
1990
|
-
accessKeyId: params[
|
|
1991
|
-
secretAccessKey: params[
|
|
2002
|
+
accessKeyId: params[parameters13.awsAccessKeyId.slug],
|
|
2003
|
+
secretAccessKey: params[parameters13.awsSecretAccessKey.slug]
|
|
1992
2004
|
}
|
|
1993
2005
|
});
|
|
1994
2006
|
const startParams = { QueryString: resolvedSql };
|
|
@@ -2033,7 +2045,7 @@ var awsAthenaConnector = new ConnectorPlugin({
|
|
|
2033
2045
|
});
|
|
2034
2046
|
|
|
2035
2047
|
// src/connectors/redshift/parameters.ts
|
|
2036
|
-
var
|
|
2048
|
+
var parameters14 = {
|
|
2037
2049
|
awsAccessKeyId: new ParameterDefinition({
|
|
2038
2050
|
slug: "aws-access-key-id",
|
|
2039
2051
|
name: "AWS Access Key ID",
|
|
@@ -2159,14 +2171,14 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
2159
2171
|
DescribeStatementCommand,
|
|
2160
2172
|
GetStatementResultCommand
|
|
2161
2173
|
} = 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 =
|
|
2174
|
+
const awsAccessKeyId = parameters14.awsAccessKeyId.getValue(connection);
|
|
2175
|
+
const awsSecretAccessKey = parameters14.awsSecretAccessKey.getValue(connection);
|
|
2176
|
+
const awsRegion = parameters14.awsRegion.getValue(connection);
|
|
2177
|
+
const database = parameters14.database.getValue(connection);
|
|
2178
|
+
const clusterIdentifier = parameters14.clusterIdentifier.tryGetValue(connection);
|
|
2179
|
+
const workgroupName = parameters14.workgroupName.tryGetValue(connection);
|
|
2180
|
+
const secretArn = parameters14.secretArn.tryGetValue(connection);
|
|
2181
|
+
const dbUser = parameters14.dbUser.tryGetValue(connection);
|
|
2170
2182
|
if (!clusterIdentifier && !workgroupName) {
|
|
2171
2183
|
return {
|
|
2172
2184
|
success: false,
|
|
@@ -2237,7 +2249,7 @@ var redshiftConnector = new ConnectorPlugin({
|
|
|
2237
2249
|
name: "Redshift",
|
|
2238
2250
|
description: "Connect to Amazon Redshift for data warehouse analytics.",
|
|
2239
2251
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/AEwW2psmrnZ7htTVsgA9t/a637e31707c5d760be73ce1d8ec75580/aws-redshift-logo.svg",
|
|
2240
|
-
parameters:
|
|
2252
|
+
parameters: parameters14,
|
|
2241
2253
|
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
2242
2254
|
systemPrompt: `## Redshift SQL Notes
|
|
2243
2255
|
- Uses PostgreSQL based SQL syntax
|
|
@@ -2255,10 +2267,10 @@ var redshiftConnector = new ConnectorPlugin({
|
|
|
2255
2267
|
ExecuteStatementCommand,
|
|
2256
2268
|
DescribeStatementCommand
|
|
2257
2269
|
} = await import("@aws-sdk/client-redshift-data");
|
|
2258
|
-
const clusterIdentifier = params[
|
|
2259
|
-
const workgroupName = params[
|
|
2260
|
-
const secretArn = params[
|
|
2261
|
-
const dbUser = params[
|
|
2270
|
+
const clusterIdentifier = params[parameters14.clusterIdentifier.slug];
|
|
2271
|
+
const workgroupName = params[parameters14.workgroupName.slug];
|
|
2272
|
+
const secretArn = params[parameters14.secretArn.slug];
|
|
2273
|
+
const dbUser = params[parameters14.dbUser.slug];
|
|
2262
2274
|
if (!clusterIdentifier && !workgroupName) {
|
|
2263
2275
|
return {
|
|
2264
2276
|
success: false,
|
|
@@ -2266,15 +2278,15 @@ var redshiftConnector = new ConnectorPlugin({
|
|
|
2266
2278
|
};
|
|
2267
2279
|
}
|
|
2268
2280
|
const client = new RedshiftDataClient({
|
|
2269
|
-
region: params[
|
|
2281
|
+
region: params[parameters14.awsRegion.slug],
|
|
2270
2282
|
credentials: {
|
|
2271
|
-
accessKeyId: params[
|
|
2272
|
-
secretAccessKey: params[
|
|
2283
|
+
accessKeyId: params[parameters14.awsAccessKeyId.slug],
|
|
2284
|
+
secretAccessKey: params[parameters14.awsSecretAccessKey.slug]
|
|
2273
2285
|
}
|
|
2274
2286
|
});
|
|
2275
2287
|
const { Id: statementId } = await client.send(
|
|
2276
2288
|
new ExecuteStatementCommand({
|
|
2277
|
-
Database: params[
|
|
2289
|
+
Database: params[parameters14.database.slug],
|
|
2278
2290
|
Sql: "SELECT 1",
|
|
2279
2291
|
...clusterIdentifier && { ClusterIdentifier: clusterIdentifier },
|
|
2280
2292
|
...workgroupName && { WorkgroupName: workgroupName },
|
|
@@ -2315,23 +2327,23 @@ var redshiftConnector = new ConnectorPlugin({
|
|
|
2315
2327
|
GetStatementResultCommand
|
|
2316
2328
|
} = await import("@aws-sdk/client-redshift-data");
|
|
2317
2329
|
const resolvedSql = replaceLiteralParams(sql, namedParams);
|
|
2318
|
-
const clusterIdentifier = params[
|
|
2319
|
-
const workgroupName = params[
|
|
2320
|
-
const secretArn = params[
|
|
2321
|
-
const dbUser = params[
|
|
2330
|
+
const clusterIdentifier = params[parameters14.clusterIdentifier.slug];
|
|
2331
|
+
const workgroupName = params[parameters14.workgroupName.slug];
|
|
2332
|
+
const secretArn = params[parameters14.secretArn.slug];
|
|
2333
|
+
const dbUser = params[parameters14.dbUser.slug];
|
|
2322
2334
|
if (!clusterIdentifier && !workgroupName) {
|
|
2323
2335
|
throw new Error("Either cluster-identifier or workgroup-name is required");
|
|
2324
2336
|
}
|
|
2325
2337
|
const client = new RedshiftDataClient({
|
|
2326
|
-
region: params[
|
|
2338
|
+
region: params[parameters14.awsRegion.slug],
|
|
2327
2339
|
credentials: {
|
|
2328
|
-
accessKeyId: params[
|
|
2329
|
-
secretAccessKey: params[
|
|
2340
|
+
accessKeyId: params[parameters14.awsAccessKeyId.slug],
|
|
2341
|
+
secretAccessKey: params[parameters14.awsSecretAccessKey.slug]
|
|
2330
2342
|
}
|
|
2331
2343
|
});
|
|
2332
2344
|
const { Id: statementId } = await client.send(
|
|
2333
2345
|
new ExecuteStatementCommand({
|
|
2334
|
-
Database: params[
|
|
2346
|
+
Database: params[parameters14.database.slug],
|
|
2335
2347
|
Sql: resolvedSql,
|
|
2336
2348
|
...clusterIdentifier && { ClusterIdentifier: clusterIdentifier },
|
|
2337
2349
|
...workgroupName && { WorkgroupName: workgroupName },
|
|
@@ -2369,7 +2381,7 @@ var redshiftConnector = new ConnectorPlugin({
|
|
|
2369
2381
|
});
|
|
2370
2382
|
|
|
2371
2383
|
// src/connectors/databricks/parameters.ts
|
|
2372
|
-
var
|
|
2384
|
+
var parameters15 = {
|
|
2373
2385
|
host: new ParameterDefinition({
|
|
2374
2386
|
slug: "host",
|
|
2375
2387
|
name: "Databricks Workspace Host",
|
|
@@ -2441,9 +2453,9 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
2441
2453
|
);
|
|
2442
2454
|
try {
|
|
2443
2455
|
const { DBSQLClient } = await import("@databricks/sql");
|
|
2444
|
-
const host =
|
|
2445
|
-
const token =
|
|
2446
|
-
const httpPath =
|
|
2456
|
+
const host = parameters15.host.getValue(connection);
|
|
2457
|
+
const token = parameters15.token.getValue(connection);
|
|
2458
|
+
const httpPath = parameters15.httpPath.getValue(connection);
|
|
2447
2459
|
const client = new DBSQLClient();
|
|
2448
2460
|
await client.connect({ host, path: httpPath, token });
|
|
2449
2461
|
let session;
|
|
@@ -2484,7 +2496,7 @@ var databricksConnector = new ConnectorPlugin({
|
|
|
2484
2496
|
name: "Databricks",
|
|
2485
2497
|
description: "Connect to Databricks for data lakehouse and SQL analytics.",
|
|
2486
2498
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/6QgcrfpQOKg18P7DdgKerd/af55bf0d871339049824dd167b97a29f/databricks-icon.svg",
|
|
2487
|
-
parameters:
|
|
2499
|
+
parameters: parameters15,
|
|
2488
2500
|
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
2489
2501
|
systemPrompt: `## Databricks SQL Notes
|
|
2490
2502
|
- Uses Spark SQL / Databricks SQL syntax
|
|
@@ -2499,9 +2511,9 @@ var databricksConnector = new ConnectorPlugin({
|
|
|
2499
2511
|
const { DBSQLClient } = await import("@databricks/sql");
|
|
2500
2512
|
const client = new DBSQLClient();
|
|
2501
2513
|
await client.connect({
|
|
2502
|
-
host: params[
|
|
2503
|
-
path: params[
|
|
2504
|
-
token: params[
|
|
2514
|
+
host: params[parameters15.host.slug],
|
|
2515
|
+
path: params[parameters15.httpPath.slug],
|
|
2516
|
+
token: params[parameters15.token.slug]
|
|
2505
2517
|
});
|
|
2506
2518
|
let session;
|
|
2507
2519
|
let operation;
|
|
@@ -2528,9 +2540,9 @@ var databricksConnector = new ConnectorPlugin({
|
|
|
2528
2540
|
const resolvedSql = replaceLiteralParams(sql, namedParams);
|
|
2529
2541
|
const client = new DBSQLClient();
|
|
2530
2542
|
await client.connect({
|
|
2531
|
-
host: params[
|
|
2532
|
-
path: params[
|
|
2533
|
-
token: params[
|
|
2543
|
+
host: params[parameters15.host.slug],
|
|
2544
|
+
path: params[parameters15.httpPath.slug],
|
|
2545
|
+
token: params[parameters15.token.slug]
|
|
2534
2546
|
});
|
|
2535
2547
|
let session;
|
|
2536
2548
|
let operation;
|
|
@@ -2552,28 +2564,6 @@ var databricksConnector = new ConnectorPlugin({
|
|
|
2552
2564
|
}
|
|
2553
2565
|
});
|
|
2554
2566
|
|
|
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
2567
|
// src/connectors/airtable/tools/request.ts
|
|
2578
2568
|
import { z as z12 } from "zod";
|
|
2579
2569
|
var BASE_URL = "https://api.airtable.com/v0/";
|
|
@@ -2610,8 +2600,8 @@ Authentication is handled automatically using the API Key.
|
|
|
2610
2600
|
}
|
|
2611
2601
|
console.log(`[connector-request] airtable/${connection.name}: ${method} ${path}`);
|
|
2612
2602
|
try {
|
|
2613
|
-
const apiKey =
|
|
2614
|
-
const baseId =
|
|
2603
|
+
const apiKey = parameters.apiKey.getValue(connection);
|
|
2604
|
+
const baseId = parameters.baseId.getValue(connection);
|
|
2615
2605
|
const resolvedPath = path.replace(/\{baseId\}/g, baseId);
|
|
2616
2606
|
const url = `${BASE_URL}${resolvedPath}`;
|
|
2617
2607
|
const controller = new AbortController();
|
|
@@ -2653,7 +2643,7 @@ var airtableConnector = new ConnectorPlugin({
|
|
|
2653
2643
|
name: "Airtable",
|
|
2654
2644
|
description: "Connect to Airtable for spreadsheet-database hybrid data management.",
|
|
2655
2645
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/19JUphfOZjyjTK6Zg4NGCf/8c56227b088cada52d3a2d9385a3be97/airtable.svg",
|
|
2656
|
-
parameters
|
|
2646
|
+
parameters,
|
|
2657
2647
|
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
2658
2648
|
systemPrompt: `## Airtable API
|
|
2659
2649
|
- Call the Airtable REST API using the authenticated request tool
|
|
@@ -2672,32 +2662,39 @@ var airtableConnector = new ConnectorPlugin({
|
|
|
2672
2662
|
- Body: { "records": [{ "fields": { "Name": "value", ... } }] }
|
|
2673
2663
|
|
|
2674
2664
|
### Pagination
|
|
2675
|
-
- If the response contains an offset, fetch the next page by appending ?offset={offset} to the next request
|
|
2665
|
+
- If the response contains an offset, fetch the next page by appending ?offset={offset} to the next request
|
|
2666
|
+
|
|
2667
|
+
## Airtable SDK (TypeScript handler)
|
|
2668
|
+
Non-SQL connectors like Airtable can also be used via the SDK in TypeScript handlers:
|
|
2669
|
+
|
|
2670
|
+
\`\`\`ts
|
|
2671
|
+
import { connection } from "@squadbase/vite-server/connectors/airtable";
|
|
2672
|
+
|
|
2673
|
+
const airtable = connection("<connectionId>");
|
|
2674
|
+
|
|
2675
|
+
// Authenticated fetch (returns standard Response)
|
|
2676
|
+
const res = await airtable.request("meta/bases/{baseId}/tables");
|
|
2677
|
+
const data = await res.json();
|
|
2678
|
+
|
|
2679
|
+
// Convenience methods
|
|
2680
|
+
const { tables } = await airtable.listTables();
|
|
2681
|
+
const { records, offset } = await airtable.listRecords("Tasks", {
|
|
2682
|
+
filterByFormula: '{Status} = "Done"',
|
|
2683
|
+
fields: ["Name", "Status"],
|
|
2684
|
+
maxRecords: 100,
|
|
2685
|
+
sort: [{ field: "Name", direction: "asc" }],
|
|
2686
|
+
});
|
|
2687
|
+
const record = await airtable.getRecord("Tasks", "recXXXXXX");
|
|
2688
|
+
await airtable.createRecords("Tasks", [
|
|
2689
|
+
{ fields: { Name: "New task", Status: "Todo" } },
|
|
2690
|
+
]);
|
|
2691
|
+
await airtable.updateRecords("Tasks", [
|
|
2692
|
+
{ id: "recXXXXXX", fields: { Status: "Done" } },
|
|
2693
|
+
]);
|
|
2694
|
+
\`\`\``,
|
|
2676
2695
|
tools: tools10
|
|
2677
2696
|
});
|
|
2678
2697
|
|
|
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
2698
|
// src/connectors/google-analytics/tools/request.ts
|
|
2702
2699
|
import { z as z13 } from "zod";
|
|
2703
2700
|
var BASE_URL2 = "https://analyticsdata.googleapis.com/v1beta/";
|
|
@@ -2735,8 +2732,8 @@ Authentication is handled automatically using a service account.
|
|
|
2735
2732
|
console.log(`[connector-request] google-analytics/${connection.name}: ${method} ${path}`);
|
|
2736
2733
|
try {
|
|
2737
2734
|
const { GoogleAuth } = await import("google-auth-library");
|
|
2738
|
-
const keyJsonBase64 =
|
|
2739
|
-
const propertyId =
|
|
2735
|
+
const keyJsonBase64 = parameters2.serviceAccountKeyJsonBase64.getValue(connection);
|
|
2736
|
+
const propertyId = parameters2.propertyId.getValue(connection);
|
|
2740
2737
|
const credentials = JSON.parse(
|
|
2741
2738
|
Buffer.from(keyJsonBase64, "base64").toString("utf-8")
|
|
2742
2739
|
);
|
|
@@ -2789,7 +2786,7 @@ var googleAnalyticsConnector = new ConnectorPlugin({
|
|
|
2789
2786
|
name: "Google Analytics",
|
|
2790
2787
|
description: "Connect to Google Analytics for web analytics and reporting.",
|
|
2791
2788
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/7fs0ipzxuD9mACDzBATtxX/3c53ed90d15c96483e4f78cb29dab5e9/google-analytics.svg",
|
|
2792
|
-
parameters:
|
|
2789
|
+
parameters: parameters2,
|
|
2793
2790
|
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
2794
2791
|
systemPrompt: `## Google Analytics Data API
|
|
2795
2792
|
- Call the GA4 Data API using the authenticated request tool
|
|
@@ -2818,7 +2815,36 @@ averageSessionDuration, conversions, totalRevenue
|
|
|
2818
2815
|
|
|
2819
2816
|
### Date Specification
|
|
2820
2817
|
- Absolute: "2024-01-01"
|
|
2821
|
-
- Relative: "today", "yesterday", "7daysAgo", "30daysAgo"
|
|
2818
|
+
- Relative: "today", "yesterday", "7daysAgo", "30daysAgo"
|
|
2819
|
+
|
|
2820
|
+
## Google Analytics SDK (TypeScript handler)
|
|
2821
|
+
Non-SQL connectors like Google Analytics can also be used via the SDK in TypeScript handlers:
|
|
2822
|
+
|
|
2823
|
+
\`\`\`ts
|
|
2824
|
+
import { connection } from "@squadbase/vite-server/connectors/google-analytics";
|
|
2825
|
+
|
|
2826
|
+
const ga = connection("<connectionId>");
|
|
2827
|
+
|
|
2828
|
+
// Authenticated fetch (returns standard Response)
|
|
2829
|
+
const res = await ga.request("properties/{propertyId}:runReport", {
|
|
2830
|
+
method: "POST",
|
|
2831
|
+
body: JSON.stringify({ dateRanges: [{ startDate: "7daysAgo", endDate: "today" }], metrics: [{ name: "activeUsers" }] }),
|
|
2832
|
+
});
|
|
2833
|
+
const data = await res.json();
|
|
2834
|
+
|
|
2835
|
+
// Convenience methods
|
|
2836
|
+
const { rows, rowCount } = await ga.runReport({
|
|
2837
|
+
dateRanges: [{ startDate: "7daysAgo", endDate: "today" }],
|
|
2838
|
+
dimensions: [{ name: "date" }],
|
|
2839
|
+
metrics: [{ name: "activeUsers" }, { name: "sessions" }],
|
|
2840
|
+
limit: 100,
|
|
2841
|
+
});
|
|
2842
|
+
const metadata = await ga.getMetadata();
|
|
2843
|
+
const realtime = await ga.runRealtimeReport({
|
|
2844
|
+
metrics: [{ name: "activeUsers" }],
|
|
2845
|
+
dimensions: [{ name: "country" }],
|
|
2846
|
+
});
|
|
2847
|
+
\`\`\``,
|
|
2822
2848
|
tools: tools11
|
|
2823
2849
|
});
|
|
2824
2850
|
|
|
@@ -2856,9 +2882,9 @@ Authentication is handled automatically using username and password.`,
|
|
|
2856
2882
|
}
|
|
2857
2883
|
console.log(`[connector-request] kintone/${connection.name}: ${method} ${path}`);
|
|
2858
2884
|
try {
|
|
2859
|
-
const baseUrl =
|
|
2860
|
-
const username =
|
|
2861
|
-
const password =
|
|
2885
|
+
const baseUrl = parameters3.baseUrl.getValue(connection);
|
|
2886
|
+
const username = parameters3.username.getValue(connection);
|
|
2887
|
+
const password = parameters3.password.getValue(connection);
|
|
2862
2888
|
const authToken = Buffer.from(`${username}:${password}`).toString("base64");
|
|
2863
2889
|
const url = `${baseUrl.replace(/\/+$/, "")}/k/v1/${path}`;
|
|
2864
2890
|
const controller = new AbortController();
|
|
@@ -2902,7 +2928,7 @@ var kintoneConnector = new ConnectorPlugin({
|
|
|
2902
2928
|
name: "kintone",
|
|
2903
2929
|
description: "Connect to kintone for business application data retrieval and analytics.",
|
|
2904
2930
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/76nPGMJFZkMFE3UQNo2JFy/e71dc5f5d5cec1306ce0e17aafbfd9f0/kintone.png",
|
|
2905
|
-
parameters,
|
|
2931
|
+
parameters: parameters3,
|
|
2906
2932
|
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
2907
2933
|
systemPrompt: `## kintone REST API
|
|
2908
2934
|
- Call the kintone REST API using the authenticated request tool
|
|
@@ -2958,37 +2984,6 @@ const { apps } = await kintone.listApps();
|
|
|
2958
2984
|
tools: tools12
|
|
2959
2985
|
});
|
|
2960
2986
|
|
|
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
2987
|
// src/connectors/wix-store/tools/request.ts
|
|
2993
2988
|
import { z as z15 } from "zod";
|
|
2994
2989
|
var BASE_URL3 = "https://www.wixapis.com/";
|
|
@@ -3024,8 +3019,8 @@ Authentication is handled automatically using the API Key and Site ID.`,
|
|
|
3024
3019
|
}
|
|
3025
3020
|
console.log(`[connector-request] wix-store/${connection.name}: ${method} ${path}`);
|
|
3026
3021
|
try {
|
|
3027
|
-
const apiKey =
|
|
3028
|
-
const siteId =
|
|
3022
|
+
const apiKey = parameters4.apiKey.getValue(connection);
|
|
3023
|
+
const siteId = parameters4.siteId.getValue(connection);
|
|
3029
3024
|
const url = `${BASE_URL3}${path}`;
|
|
3030
3025
|
const controller = new AbortController();
|
|
3031
3026
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS6);
|
|
@@ -3067,12 +3062,14 @@ var wixStoreConnector = new ConnectorPlugin({
|
|
|
3067
3062
|
name: "Wix Store",
|
|
3068
3063
|
description: "Connect to Wix Store.",
|
|
3069
3064
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/YyFxclQFzROIYpFam6vRK/e7e75d3feac49a1cc5e433c147216d23/Wix_logo_black.svg",
|
|
3070
|
-
parameters:
|
|
3065
|
+
parameters: parameters4,
|
|
3071
3066
|
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
3072
3067
|
systemPrompt: `## Wix Store API
|
|
3073
3068
|
- Call the Wix Store REST API using the authenticated request tool
|
|
3074
3069
|
- Authentication (API Key, Site ID) is automatically configured
|
|
3075
3070
|
- Wix API uses POST for query endpoints as well
|
|
3071
|
+
- Wix uses WQL (Wix Query Language) for filters
|
|
3072
|
+
- Max 100 items per page
|
|
3076
3073
|
|
|
3077
3074
|
### List Products
|
|
3078
3075
|
- POST stores/v1/products/query
|
|
@@ -3082,55 +3079,46 @@ var wixStoreConnector = new ConnectorPlugin({
|
|
|
3082
3079
|
- POST stores/v1/products/query
|
|
3083
3080
|
- Body: { "query": { "filter": { "name": { "$contains": "keyword" } }, "paging": { "limit": 50 } } }
|
|
3084
3081
|
|
|
3085
|
-
###
|
|
3086
|
-
- POST
|
|
3087
|
-
- Body: { "
|
|
3082
|
+
### Search Orders (eCommerce Orders V1)
|
|
3083
|
+
- POST ecom/v1/orders/search
|
|
3084
|
+
- Body: { "search": { "cursorPaging": { "limit": 50 } } }
|
|
3085
|
+
- Uses cursor-based pagination (cursorPaging, not paging)
|
|
3086
|
+
- Response includes pagingMetadata.cursors.next for pagination
|
|
3088
3087
|
|
|
3089
3088
|
### List Collections (Categories)
|
|
3090
3089
|
- POST stores/v1/collections/query
|
|
3091
|
-
- Body: { "query": { "paging": { "limit": 50 } } }
|
|
3092
|
-
|
|
3090
|
+
- Body: { "query": { "paging": { "limit": 50 } } }
|
|
3091
|
+
|
|
3092
|
+
### List Inventory Items
|
|
3093
|
+
- POST stores/v2/inventoryItems/query
|
|
3094
|
+
- Body: { "query": { "paging": { "limit": 50 } } }
|
|
3095
|
+
|
|
3096
|
+
## Wix Store SDK (TypeScript handler)
|
|
3097
|
+
Non-SQL connectors like Wix Store can also be used via the SDK in TypeScript handlers:
|
|
3098
|
+
|
|
3099
|
+
\`\`\`ts
|
|
3100
|
+
import { connection } from "@squadbase/vite-server/connectors/wix-store";
|
|
3101
|
+
|
|
3102
|
+
const wix = connection("<connectionId>");
|
|
3103
|
+
|
|
3104
|
+
// Authenticated fetch (returns standard Response)
|
|
3105
|
+
const res = await wix.request("/stores/v1/products/query", {
|
|
3106
|
+
method: "POST",
|
|
3107
|
+
headers: { "Content-Type": "application/json" },
|
|
3108
|
+
body: JSON.stringify({ query: { paging: { limit: 10 } } }),
|
|
3093
3109
|
});
|
|
3110
|
+
const data = await res.json();
|
|
3094
3111
|
|
|
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
|
-
};
|
|
3112
|
+
// Convenience methods
|
|
3113
|
+
const { products, totalResults } = await wix.queryProducts({ paging: { limit: 50 } });
|
|
3114
|
+
const { product } = await wix.getProduct("product-id");
|
|
3115
|
+
const { orders, pagingMetadata } = await wix.queryOrders({ cursorPaging: { limit: 50 } });
|
|
3116
|
+
const { order } = await wix.getOrder("order-id");
|
|
3117
|
+
const { inventoryItems } = await wix.queryInventory({ paging: { limit: 50 } });
|
|
3118
|
+
const { collections } = await wix.queryCollections({ paging: { limit: 50 } });
|
|
3119
|
+
\`\`\``,
|
|
3120
|
+
tools: tools13
|
|
3121
|
+
});
|
|
3134
3122
|
|
|
3135
3123
|
// src/connectors/dbt/tools/request.ts
|
|
3136
3124
|
import { z as z16 } from "zod";
|
|
@@ -3170,9 +3158,9 @@ Authentication is handled automatically using the API token.
|
|
|
3170
3158
|
}
|
|
3171
3159
|
console.log(`[connector-request] dbt/${connection.name}: GraphQL query`);
|
|
3172
3160
|
try {
|
|
3173
|
-
const host =
|
|
3174
|
-
const token =
|
|
3175
|
-
const environmentId =
|
|
3161
|
+
const host = parameters5.host.getValue(connection);
|
|
3162
|
+
const token = parameters5.token.getValue(connection);
|
|
3163
|
+
const environmentId = parameters5.prodEnvId.getValue(connection);
|
|
3176
3164
|
const resolvedVariables = variables ? JSON.parse(
|
|
3177
3165
|
JSON.stringify(variables).replace(/\{environmentId\}/g, environmentId)
|
|
3178
3166
|
) : void 0;
|
|
@@ -3222,7 +3210,7 @@ var dbtConnector = new ConnectorPlugin({
|
|
|
3222
3210
|
name: "dbt",
|
|
3223
3211
|
description: "Connect to dbt Cloud for data transformation and analytics engineering.",
|
|
3224
3212
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/4iT6ncXtdtHdkXexU0WgfZ/0367a38d245f2568eab5eb511f9ee692/dbt.png",
|
|
3225
|
-
parameters:
|
|
3213
|
+
parameters: parameters5,
|
|
3226
3214
|
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
3227
3215
|
systemPrompt: `## dbt Cloud Discovery API (GraphQL)
|
|
3228
3216
|
- Call the dbt Cloud Discovery API using the authenticated request tool
|
|
@@ -3274,7 +3262,36 @@ query:
|
|
|
3274
3262
|
|
|
3275
3263
|
### Lineage (Dependencies)
|
|
3276
3264
|
- Traverse relationships using ancestors / children fields
|
|
3277
|
-
- Get ancestors { uniqueId name } or children { uniqueId name } within node
|
|
3265
|
+
- Get ancestors { uniqueId name } or children { uniqueId name } within node
|
|
3266
|
+
|
|
3267
|
+
## dbt SDK (TypeScript handler)
|
|
3268
|
+
Non-SQL connectors like dbt can also be used via the SDK in TypeScript handlers:
|
|
3269
|
+
|
|
3270
|
+
\`\`\`ts
|
|
3271
|
+
import { connection } from "@squadbase/vite-server/connectors/dbt";
|
|
3272
|
+
|
|
3273
|
+
const dbt = connection("<connectionId>");
|
|
3274
|
+
|
|
3275
|
+
// Authenticated fetch (returns standard Response)
|
|
3276
|
+
const res = await dbt.request("/graphql", {
|
|
3277
|
+
method: "POST",
|
|
3278
|
+
headers: { "Content-Type": "application/json" },
|
|
3279
|
+
body: JSON.stringify({ query: "{ ... }", variables: {} }),
|
|
3280
|
+
});
|
|
3281
|
+
const data = await res.json();
|
|
3282
|
+
|
|
3283
|
+
// Convenience methods
|
|
3284
|
+
const result = await dbt.query(\`
|
|
3285
|
+
query($environmentId: BigInt!) {
|
|
3286
|
+
environment(id: $environmentId) { applied { models(first: 10) { edges { node { name } } } } }
|
|
3287
|
+
}
|
|
3288
|
+
\`);
|
|
3289
|
+
const models = await dbt.getModels({ limit: 100 });
|
|
3290
|
+
const model = await dbt.getModelByUniqueId("model.project.my_model");
|
|
3291
|
+
const sources = await dbt.getSources({ limit: 100 });
|
|
3292
|
+
const tests = await dbt.getTests({ limit: 100 });
|
|
3293
|
+
const metrics = await dbt.getMetrics({ limit: 100 });
|
|
3294
|
+
\`\`\``,
|
|
3278
3295
|
tools: tools14
|
|
3279
3296
|
});
|
|
3280
3297
|
|
|
@@ -3425,7 +3442,7 @@ var openaiConnector = new ConnectorPlugin({
|
|
|
3425
3442
|
name: "OpenAI",
|
|
3426
3443
|
description: "Connect to OpenAI for AI model inference, embeddings, and image generation.",
|
|
3427
3444
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/53XJtCgUlW10x6i1X8xpxM/0bfd634069f1d74241296543cb20427a/openai.svg",
|
|
3428
|
-
parameters:
|
|
3445
|
+
parameters: parameters6,
|
|
3429
3446
|
releaseFlag: { dev1: true, dev2: false, prod: false },
|
|
3430
3447
|
systemPrompt: `## OpenAI SDK (TypeScript handler)
|
|
3431
3448
|
Use the OpenAI connector via the SDK in TypeScript handlers:
|