@squadbase/connectors 0.0.12 → 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 +316 -286
- package/dist/sdk.d.ts +343 -3
- package/dist/sdk.js +668 -11
- package/package.json +3 -4
- 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",
|
|
@@ -285,6 +289,19 @@ var parameters3 = {
|
|
|
285
289
|
|
|
286
290
|
// src/connectors/snowflake/tools/execute-query.ts
|
|
287
291
|
import { z } from "zod";
|
|
292
|
+
|
|
293
|
+
// src/connectors/snowflake/utils.ts
|
|
294
|
+
import crypto from "crypto";
|
|
295
|
+
function decryptPrivateKey(pem, passphrase) {
|
|
296
|
+
if (!passphrase) return pem;
|
|
297
|
+
return crypto.createPrivateKey({
|
|
298
|
+
key: pem,
|
|
299
|
+
format: "pem",
|
|
300
|
+
passphrase
|
|
301
|
+
}).export({ type: "pkcs8", format: "pem" });
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
// src/connectors/snowflake/tools/execute-query.ts
|
|
288
305
|
var MAX_ROWS = 500;
|
|
289
306
|
var QUERY_TIMEOUT_MS = 6e4;
|
|
290
307
|
var inputSchema = z.object({
|
|
@@ -329,23 +346,23 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
329
346
|
try {
|
|
330
347
|
const snowflake = (await import("snowflake-sdk")).default;
|
|
331
348
|
snowflake.configure({ logLevel: "ERROR" });
|
|
332
|
-
const account =
|
|
333
|
-
const user =
|
|
334
|
-
const role =
|
|
335
|
-
const warehouse =
|
|
336
|
-
const privateKeyBase64 =
|
|
337
|
-
const
|
|
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);
|
|
354
|
+
const privateKeyPem = Buffer.from(privateKeyBase64, "base64").toString(
|
|
338
355
|
"utf-8"
|
|
339
356
|
);
|
|
340
|
-
const privateKeyPass =
|
|
357
|
+
const privateKeyPass = parameters7.privateKeyPassphrase.tryGetValue(connection);
|
|
358
|
+
const privateKey = decryptPrivateKey(privateKeyPem, privateKeyPass ?? void 0);
|
|
341
359
|
const conn = snowflake.createConnection({
|
|
342
360
|
account,
|
|
343
361
|
username: user,
|
|
344
362
|
role,
|
|
345
363
|
warehouse,
|
|
346
364
|
authenticator: "SNOWFLAKE_JWT",
|
|
347
|
-
privateKey
|
|
348
|
-
...privateKeyPass ? { privateKeyPass } : {}
|
|
365
|
+
privateKey
|
|
349
366
|
});
|
|
350
367
|
await new Promise((resolve, reject) => {
|
|
351
368
|
conn.connect((err) => {
|
|
@@ -402,7 +419,7 @@ var snowflakeConnector = new ConnectorPlugin({
|
|
|
402
419
|
name: "Snowflake",
|
|
403
420
|
description: "Connect to Snowflake for cloud data warehousing and analytics.",
|
|
404
421
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/6oyVtAcP3pMlXaOrts9unk/b7a9dc25d15c388b66e983041b855447/snowflake.svg",
|
|
405
|
-
parameters:
|
|
422
|
+
parameters: parameters7,
|
|
406
423
|
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
407
424
|
setup: snowflakeSetup,
|
|
408
425
|
systemPrompt: `## Snowflake SQL Notes
|
|
@@ -418,19 +435,19 @@ var snowflakeConnector = new ConnectorPlugin({
|
|
|
418
435
|
try {
|
|
419
436
|
const snowflake = (await import("snowflake-sdk")).default;
|
|
420
437
|
snowflake.configure({ logLevel: "ERROR" });
|
|
421
|
-
const
|
|
422
|
-
params[
|
|
438
|
+
const privateKeyPem = Buffer.from(
|
|
439
|
+
params[parameters7.privateKeyBase64.slug],
|
|
423
440
|
"base64"
|
|
424
441
|
).toString("utf-8");
|
|
425
|
-
const privateKeyPass = params[
|
|
442
|
+
const privateKeyPass = params[parameters7.privateKeyPassphrase.slug] || void 0;
|
|
443
|
+
const privateKey = decryptPrivateKey(privateKeyPem, privateKeyPass);
|
|
426
444
|
const conn = snowflake.createConnection({
|
|
427
|
-
account: params[
|
|
428
|
-
username: params[
|
|
429
|
-
role: params[
|
|
430
|
-
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],
|
|
431
449
|
authenticator: "SNOWFLAKE_JWT",
|
|
432
|
-
privateKey
|
|
433
|
-
...privateKeyPass ? { privateKeyPass } : {}
|
|
450
|
+
privateKey
|
|
434
451
|
});
|
|
435
452
|
await new Promise((resolve, reject) => {
|
|
436
453
|
conn.connect((err) => {
|
|
@@ -459,19 +476,19 @@ var snowflakeConnector = new ConnectorPlugin({
|
|
|
459
476
|
const resolvedSql = replaceLiteralParams(sql, namedParams);
|
|
460
477
|
const snowflake = (await import("snowflake-sdk")).default;
|
|
461
478
|
snowflake.configure({ logLevel: "ERROR" });
|
|
462
|
-
const
|
|
463
|
-
params[
|
|
479
|
+
const privateKeyPem = Buffer.from(
|
|
480
|
+
params[parameters7.privateKeyBase64.slug],
|
|
464
481
|
"base64"
|
|
465
482
|
).toString("utf-8");
|
|
466
|
-
const privateKeyPass = params[
|
|
483
|
+
const privateKeyPass = params[parameters7.privateKeyPassphrase.slug] || void 0;
|
|
484
|
+
const privateKey = decryptPrivateKey(privateKeyPem, privateKeyPass);
|
|
467
485
|
const conn = snowflake.createConnection({
|
|
468
|
-
account: params[
|
|
469
|
-
username: params[
|
|
470
|
-
role: params[
|
|
471
|
-
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],
|
|
472
490
|
authenticator: "SNOWFLAKE_JWT",
|
|
473
|
-
privateKey
|
|
474
|
-
...privateKeyPass ? { privateKeyPass } : {}
|
|
491
|
+
privateKey
|
|
475
492
|
});
|
|
476
493
|
await new Promise((resolve, reject) => {
|
|
477
494
|
conn.connect((err) => {
|
|
@@ -498,7 +515,7 @@ var snowflakeConnector = new ConnectorPlugin({
|
|
|
498
515
|
});
|
|
499
516
|
|
|
500
517
|
// src/connectors/snowflake-pat/parameters.ts
|
|
501
|
-
var
|
|
518
|
+
var parameters8 = {
|
|
502
519
|
account: new ParameterDefinition({
|
|
503
520
|
slug: "account",
|
|
504
521
|
name: "Snowflake Account",
|
|
@@ -592,11 +609,11 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
592
609
|
try {
|
|
593
610
|
const snowflake = (await import("snowflake-sdk")).default;
|
|
594
611
|
snowflake.configure({ logLevel: "ERROR" });
|
|
595
|
-
const account =
|
|
596
|
-
const user =
|
|
597
|
-
const role =
|
|
598
|
-
const warehouse =
|
|
599
|
-
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);
|
|
600
617
|
const conn = snowflake.createConnection({
|
|
601
618
|
account,
|
|
602
619
|
username: user,
|
|
@@ -659,7 +676,7 @@ var snowflakePatConnector = new ConnectorPlugin({
|
|
|
659
676
|
name: "Snowflake (PAT)",
|
|
660
677
|
description: "Connect to Snowflake using a Personal Access Token (PAT).",
|
|
661
678
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/6oyVtAcP3pMlXaOrts9unk/b7a9dc25d15c388b66e983041b855447/snowflake.svg",
|
|
662
|
-
parameters:
|
|
679
|
+
parameters: parameters8,
|
|
663
680
|
releaseFlag: { dev1: true, dev2: false, prod: false },
|
|
664
681
|
setup: snowflakeSetup,
|
|
665
682
|
systemPrompt: `## Snowflake SQL Notes
|
|
@@ -676,11 +693,11 @@ var snowflakePatConnector = new ConnectorPlugin({
|
|
|
676
693
|
const snowflake = (await import("snowflake-sdk")).default;
|
|
677
694
|
snowflake.configure({ logLevel: "ERROR" });
|
|
678
695
|
const conn = snowflake.createConnection({
|
|
679
|
-
account: params[
|
|
680
|
-
username: params[
|
|
681
|
-
role: params[
|
|
682
|
-
warehouse: params[
|
|
683
|
-
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]
|
|
684
701
|
});
|
|
685
702
|
await new Promise((resolve, reject) => {
|
|
686
703
|
conn.connect((err) => {
|
|
@@ -715,11 +732,11 @@ var snowflakePatConnector = new ConnectorPlugin({
|
|
|
715
732
|
const snowflake = (await import("snowflake-sdk")).default;
|
|
716
733
|
snowflake.configure({ logLevel: "ERROR" });
|
|
717
734
|
const conn = snowflake.createConnection({
|
|
718
|
-
account: params[
|
|
719
|
-
username: params[
|
|
720
|
-
role: params[
|
|
721
|
-
warehouse: params[
|
|
722
|
-
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]
|
|
723
740
|
});
|
|
724
741
|
await new Promise((resolve, reject) => {
|
|
725
742
|
conn.connect((err) => {
|
|
@@ -751,7 +768,7 @@ var snowflakePatConnector = new ConnectorPlugin({
|
|
|
751
768
|
});
|
|
752
769
|
|
|
753
770
|
// src/connectors/postgresql/parameters.ts
|
|
754
|
-
var
|
|
771
|
+
var parameters9 = {
|
|
755
772
|
connectionUrl: new ParameterDefinition({
|
|
756
773
|
slug: "connection-url",
|
|
757
774
|
name: "PostgreSQL Connection URL",
|
|
@@ -808,7 +825,7 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
808
825
|
let connectionUrl;
|
|
809
826
|
try {
|
|
810
827
|
const { Pool } = await import("pg");
|
|
811
|
-
connectionUrl =
|
|
828
|
+
connectionUrl = parameters9.connectionUrl.getValue(connection);
|
|
812
829
|
const pool = new Pool({
|
|
813
830
|
connectionString: connectionUrl,
|
|
814
831
|
ssl: { rejectUnauthorized: false },
|
|
@@ -846,7 +863,7 @@ var postgresqlConnector = new ConnectorPlugin({
|
|
|
846
863
|
name: "PostgreSQL",
|
|
847
864
|
description: "Connect to PostgreSQL databases for relational data storage and querying.",
|
|
848
865
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/42AHi2uqteUn65MyqdN6V7/a0f68f12af6aac96bbcda5980f43de07/elephant.png",
|
|
849
|
-
parameters:
|
|
866
|
+
parameters: parameters9,
|
|
850
867
|
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
851
868
|
systemPrompt: `## PostgreSQL SQL Notes
|
|
852
869
|
- Schema exploration:
|
|
@@ -857,7 +874,7 @@ var postgresqlConnector = new ConnectorPlugin({
|
|
|
857
874
|
async checkConnection(params, _config) {
|
|
858
875
|
const { Pool } = await import("pg");
|
|
859
876
|
const pool = new Pool({
|
|
860
|
-
connectionString: params[
|
|
877
|
+
connectionString: params[parameters9.connectionUrl.slug],
|
|
861
878
|
ssl: { rejectUnauthorized: false },
|
|
862
879
|
connectionTimeoutMillis: 1e4
|
|
863
880
|
});
|
|
@@ -874,7 +891,7 @@ var postgresqlConnector = new ConnectorPlugin({
|
|
|
874
891
|
const { Pool } = await import("pg");
|
|
875
892
|
const { text, values } = buildPositionalParams(sql, namedParams);
|
|
876
893
|
const pool = new Pool({
|
|
877
|
-
connectionString: params[
|
|
894
|
+
connectionString: params[parameters9.connectionUrl.slug],
|
|
878
895
|
ssl: { rejectUnauthorized: false },
|
|
879
896
|
connectionTimeoutMillis: 1e4,
|
|
880
897
|
statement_timeout: 6e4
|
|
@@ -889,7 +906,7 @@ var postgresqlConnector = new ConnectorPlugin({
|
|
|
889
906
|
});
|
|
890
907
|
|
|
891
908
|
// src/connectors/mysql/parameters.ts
|
|
892
|
-
var
|
|
909
|
+
var parameters10 = {
|
|
893
910
|
connectionUrl: new ParameterDefinition({
|
|
894
911
|
slug: "connection-url",
|
|
895
912
|
name: "MySQL Connection URL",
|
|
@@ -946,7 +963,7 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
946
963
|
let connectionUrl;
|
|
947
964
|
try {
|
|
948
965
|
const mysql = await import("mysql2/promise");
|
|
949
|
-
connectionUrl =
|
|
966
|
+
connectionUrl = parameters10.connectionUrl.getValue(connection);
|
|
950
967
|
const pool = mysql.createPool({
|
|
951
968
|
uri: connectionUrl,
|
|
952
969
|
connectTimeout: CONNECT_TIMEOUT_MS2
|
|
@@ -986,7 +1003,7 @@ var mysqlConnector = new ConnectorPlugin({
|
|
|
986
1003
|
name: "MySQL",
|
|
987
1004
|
description: "Connect to MySQL databases for relational data storage and querying.",
|
|
988
1005
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/6ghPFeGgl7uBs5NHH1a4L/512c9433beec5b595caa41f04921c1f9/logo-mysql-170x115.png",
|
|
989
|
-
parameters:
|
|
1006
|
+
parameters: parameters10,
|
|
990
1007
|
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
991
1008
|
systemPrompt: `## MySQL SQL Notes
|
|
992
1009
|
- Schema exploration:
|
|
@@ -997,7 +1014,7 @@ var mysqlConnector = new ConnectorPlugin({
|
|
|
997
1014
|
async checkConnection(params, _config) {
|
|
998
1015
|
const mysql = await import("mysql2/promise");
|
|
999
1016
|
const pool = mysql.createPool({
|
|
1000
|
-
uri: params[
|
|
1017
|
+
uri: params[parameters10.connectionUrl.slug],
|
|
1001
1018
|
connectTimeout: 1e4
|
|
1002
1019
|
});
|
|
1003
1020
|
try {
|
|
@@ -1013,7 +1030,7 @@ var mysqlConnector = new ConnectorPlugin({
|
|
|
1013
1030
|
const mysql = await import("mysql2/promise");
|
|
1014
1031
|
const { text, values } = buildQuestionmarkParams(sql, namedParams);
|
|
1015
1032
|
const pool = mysql.createPool({
|
|
1016
|
-
uri: params[
|
|
1033
|
+
uri: params[parameters10.connectionUrl.slug],
|
|
1017
1034
|
connectTimeout: 1e4
|
|
1018
1035
|
});
|
|
1019
1036
|
try {
|
|
@@ -1034,7 +1051,7 @@ var mysqlConnector = new ConnectorPlugin({
|
|
|
1034
1051
|
import { z as z5 } from "zod";
|
|
1035
1052
|
|
|
1036
1053
|
// src/connectors/bigquery/parameters.ts
|
|
1037
|
-
var
|
|
1054
|
+
var parameters11 = {
|
|
1038
1055
|
serviceAccountKeyJsonBase64: new ParameterDefinition({
|
|
1039
1056
|
slug: "service-account-key-json-base64",
|
|
1040
1057
|
name: "Google Cloud Service Account JSON",
|
|
@@ -1091,7 +1108,7 @@ var listProjectsTool = new ConnectorTool({
|
|
|
1091
1108
|
};
|
|
1092
1109
|
}
|
|
1093
1110
|
try {
|
|
1094
|
-
const serviceAccountJsonBase64 =
|
|
1111
|
+
const serviceAccountJsonBase64 = parameters11.serviceAccountKeyJsonBase64.getValue(connection);
|
|
1095
1112
|
const credentials = JSON.parse(
|
|
1096
1113
|
Buffer.from(serviceAccountJsonBase64, "base64").toString("utf-8")
|
|
1097
1114
|
);
|
|
@@ -1129,14 +1146,16 @@ var bigquerySetup = new ConnectorSetup({
|
|
|
1129
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
|
|
1130
1147
|
2. \`updateConnectionParameters\` \u3092\u547C\u3073\u51FA\u3059:
|
|
1131
1148
|
- \`parameterSlug\`: \`"project-id"\`
|
|
1132
|
-
- \`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
|
|
1133
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
|
|
1134
1151
|
|
|
1135
1152
|
#### \u30B9\u30C6\u30C3\u30D72: \u30C7\u30FC\u30BF\u30BB\u30C3\u30C8\u9078\u629E
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
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
|
|
1140
1159
|
|
|
1141
1160
|
#### \u30B9\u30C6\u30C3\u30D73: \u30C6\u30FC\u30D6\u30EB\u9078\u629E
|
|
1142
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
|
|
@@ -1166,14 +1185,16 @@ Follow these steps to set up the BigQuery connection.
|
|
|
1166
1185
|
1. Call \`${listProjectsToolName}\` to get the list of GCP projects accessible with the service account credentials
|
|
1167
1186
|
2. Call \`updateConnectionParameters\`:
|
|
1168
1187
|
- \`parameterSlug\`: \`"project-id"\`
|
|
1169
|
-
- \`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
|
|
1170
1189
|
3. The \`label\` of the user's selected project will arrive as a message. Proceed to Step 2
|
|
1171
1190
|
|
|
1172
1191
|
#### Step 2: Dataset Selection
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
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
|
|
1177
1198
|
|
|
1178
1199
|
#### Step 3: Table Selection
|
|
1179
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)
|
|
@@ -1239,8 +1260,8 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
1239
1260
|
);
|
|
1240
1261
|
try {
|
|
1241
1262
|
const { BigQuery } = await import("@google-cloud/bigquery");
|
|
1242
|
-
const projectId =
|
|
1243
|
-
const serviceAccountJsonBase64 =
|
|
1263
|
+
const projectId = parameters11.projectId.getValue(connection);
|
|
1264
|
+
const serviceAccountJsonBase64 = parameters11.serviceAccountKeyJsonBase64.getValue(connection);
|
|
1244
1265
|
const credentials = JSON.parse(
|
|
1245
1266
|
Buffer.from(serviceAccountJsonBase64, "base64").toString("utf-8")
|
|
1246
1267
|
);
|
|
@@ -1270,7 +1291,7 @@ var bigqueryConnector = new ConnectorPlugin({
|
|
|
1270
1291
|
name: "BigQuery",
|
|
1271
1292
|
description: "Connect to Google BigQuery for data warehouse and analytics.",
|
|
1272
1293
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/6nlehQyOmdbktG5hOYkYMr/6ca559140d5ddc7dadc5eac88858a563/bigquery.svg",
|
|
1273
|
-
parameters:
|
|
1294
|
+
parameters: parameters11,
|
|
1274
1295
|
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
1275
1296
|
setup: bigquerySetup,
|
|
1276
1297
|
systemPrompt: `## BigQuery SQL Notes
|
|
@@ -1284,10 +1305,10 @@ var bigqueryConnector = new ConnectorPlugin({
|
|
|
1284
1305
|
async checkConnection(params, _config) {
|
|
1285
1306
|
const { BigQuery } = await import("@google-cloud/bigquery");
|
|
1286
1307
|
const credentials = JSON.parse(
|
|
1287
|
-
Buffer.from(params[
|
|
1308
|
+
Buffer.from(params[parameters11.serviceAccountKeyJsonBase64.slug], "base64").toString("utf-8")
|
|
1288
1309
|
);
|
|
1289
1310
|
const bq = new BigQuery({
|
|
1290
|
-
projectId: params[
|
|
1311
|
+
projectId: params[parameters11.projectId.slug],
|
|
1291
1312
|
credentials
|
|
1292
1313
|
});
|
|
1293
1314
|
try {
|
|
@@ -1302,10 +1323,10 @@ var bigqueryConnector = new ConnectorPlugin({
|
|
|
1302
1323
|
const { BigQuery } = await import("@google-cloud/bigquery");
|
|
1303
1324
|
const resolvedSql = replaceLiteralParams(sql, namedParams);
|
|
1304
1325
|
const credentials = JSON.parse(
|
|
1305
|
-
Buffer.from(params[
|
|
1326
|
+
Buffer.from(params[parameters11.serviceAccountKeyJsonBase64.slug], "base64").toString("utf-8")
|
|
1306
1327
|
);
|
|
1307
1328
|
const bq = new BigQuery({
|
|
1308
|
-
projectId: params[
|
|
1329
|
+
projectId: params[parameters11.projectId.slug],
|
|
1309
1330
|
credentials
|
|
1310
1331
|
});
|
|
1311
1332
|
const [job] = await bq.createQueryJob({ query: resolvedSql });
|
|
@@ -1434,14 +1455,16 @@ var bigquerySetup2 = new ConnectorSetup({
|
|
|
1434
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
|
|
1435
1456
|
2. \`updateConnectionParameters\` \u3092\u547C\u3073\u51FA\u3059:
|
|
1436
1457
|
- \`parameterSlug\`: \`"project-id"\`
|
|
1437
|
-
- \`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
|
|
1438
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
|
|
1439
1460
|
|
|
1440
1461
|
#### \u30B9\u30C6\u30C3\u30D72: \u30C7\u30FC\u30BF\u30BB\u30C3\u30C8\u9078\u629E
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
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
|
|
1445
1468
|
|
|
1446
1469
|
#### \u30B9\u30C6\u30C3\u30D73: \u30C6\u30FC\u30D6\u30EB\u9078\u629E
|
|
1447
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
|
|
@@ -1471,14 +1494,16 @@ Follow these steps to set up the BigQuery connection.
|
|
|
1471
1494
|
1. Call \`${listProjectsToolName2}\` to get the list of GCP projects accessible with the OAuth credentials
|
|
1472
1495
|
2. Call \`updateConnectionParameters\`:
|
|
1473
1496
|
- \`parameterSlug\`: \`"project-id"\`
|
|
1474
|
-
- \`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
|
|
1475
1498
|
3. The \`label\` of the user's selected project will arrive as a message. Proceed to Step 2
|
|
1476
1499
|
|
|
1477
1500
|
#### Step 2: Dataset Selection
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
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
|
|
1482
1507
|
|
|
1483
1508
|
#### Step 3: Table Selection
|
|
1484
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)
|
|
@@ -1501,7 +1526,7 @@ Follow these steps to set up the BigQuery connection.
|
|
|
1501
1526
|
});
|
|
1502
1527
|
|
|
1503
1528
|
// src/connectors/bigquery-oauth/parameters.ts
|
|
1504
|
-
var
|
|
1529
|
+
var parameters12 = {
|
|
1505
1530
|
projectId: new ParameterDefinition({
|
|
1506
1531
|
slug: "project-id",
|
|
1507
1532
|
name: "Google Cloud Project ID",
|
|
@@ -1595,7 +1620,7 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
1595
1620
|
error: `Connection ${connectionId} not found`
|
|
1596
1621
|
};
|
|
1597
1622
|
}
|
|
1598
|
-
const gcpProjectId =
|
|
1623
|
+
const gcpProjectId = parameters12.projectId.getValue(connection);
|
|
1599
1624
|
console.log(
|
|
1600
1625
|
`[connector-query] bigquery-oauth/${connection.name}: ${sql}`
|
|
1601
1626
|
);
|
|
@@ -1662,7 +1687,7 @@ var bigqueryOauthConnector = new ConnectorPlugin({
|
|
|
1662
1687
|
name: "BigQuery (OAuth)",
|
|
1663
1688
|
description: "Connect to Google BigQuery for data warehouse and analytics using OAuth.",
|
|
1664
1689
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/6nlehQyOmdbktG5hOYkYMr/6ca559140d5ddc7dadc5eac88858a563/bigquery.svg",
|
|
1665
|
-
parameters:
|
|
1690
|
+
parameters: parameters12,
|
|
1666
1691
|
releaseFlag: { dev1: true, dev2: false, prod: false },
|
|
1667
1692
|
setup: bigquerySetup2,
|
|
1668
1693
|
proxyPolicy: {
|
|
@@ -1681,7 +1706,7 @@ var bigqueryOauthConnector = new ConnectorPlugin({
|
|
|
1681
1706
|
tools: tools6,
|
|
1682
1707
|
async checkConnection(params, config) {
|
|
1683
1708
|
const { proxyFetch } = config;
|
|
1684
|
-
const projectId = params[
|
|
1709
|
+
const projectId = params[parameters12.projectId.slug];
|
|
1685
1710
|
const url = `https://bigquery.googleapis.com/bigquery/v2/projects/${projectId}/queries`;
|
|
1686
1711
|
try {
|
|
1687
1712
|
const res = await proxyFetch(url, {
|
|
@@ -1700,7 +1725,7 @@ var bigqueryOauthConnector = new ConnectorPlugin({
|
|
|
1700
1725
|
},
|
|
1701
1726
|
async query(params, sql, namedParams, context) {
|
|
1702
1727
|
const { proxyFetch } = context;
|
|
1703
|
-
const projectId = params[
|
|
1728
|
+
const projectId = params[parameters12.projectId.slug];
|
|
1704
1729
|
const resolvedSql = replaceLiteralParams(sql, namedParams);
|
|
1705
1730
|
const url = `https://bigquery.googleapis.com/bigquery/v2/projects/${projectId}/queries`;
|
|
1706
1731
|
const res = await proxyFetch(url, {
|
|
@@ -1718,7 +1743,7 @@ var bigqueryOauthConnector = new ConnectorPlugin({
|
|
|
1718
1743
|
});
|
|
1719
1744
|
|
|
1720
1745
|
// src/connectors/aws-athena/parameters.ts
|
|
1721
|
-
var
|
|
1746
|
+
var parameters13 = {
|
|
1722
1747
|
awsAccessKeyId: new ParameterDefinition({
|
|
1723
1748
|
slug: "aws-access-key-id",
|
|
1724
1749
|
name: "AWS Access Key ID",
|
|
@@ -1815,8 +1840,8 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
1815
1840
|
GetQueryExecutionCommand,
|
|
1816
1841
|
GetQueryResultsCommand
|
|
1817
1842
|
} = await import("@aws-sdk/client-athena");
|
|
1818
|
-
const workgroup =
|
|
1819
|
-
const outputLocation =
|
|
1843
|
+
const workgroup = parameters13.workgroup.tryGetValue(connection);
|
|
1844
|
+
const outputLocation = parameters13.outputLocation.tryGetValue(connection);
|
|
1820
1845
|
if (!workgroup && !outputLocation) {
|
|
1821
1846
|
return {
|
|
1822
1847
|
success: false,
|
|
@@ -1824,10 +1849,10 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
1824
1849
|
};
|
|
1825
1850
|
}
|
|
1826
1851
|
const client = new AthenaClient({
|
|
1827
|
-
region:
|
|
1852
|
+
region: parameters13.awsRegion.getValue(connection),
|
|
1828
1853
|
credentials: {
|
|
1829
|
-
accessKeyId:
|
|
1830
|
-
secretAccessKey:
|
|
1854
|
+
accessKeyId: parameters13.awsAccessKeyId.getValue(connection),
|
|
1855
|
+
secretAccessKey: parameters13.awsSecretAccessKey.getValue(connection)
|
|
1831
1856
|
}
|
|
1832
1857
|
});
|
|
1833
1858
|
const startParams = { QueryString: sql };
|
|
@@ -1891,7 +1916,7 @@ var awsAthenaConnector = new ConnectorPlugin({
|
|
|
1891
1916
|
name: "AWS Athena",
|
|
1892
1917
|
description: "Connect to AWS Athena for serverless SQL queries on S3 data.",
|
|
1893
1918
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/5x0vIHtUHfJJMZUv4RFOYZ/5059bac389f0169542f39cdb4b387d2c/Athena.svg",
|
|
1894
|
-
parameters:
|
|
1919
|
+
parameters: parameters13,
|
|
1895
1920
|
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
1896
1921
|
systemPrompt: `## AWS Athena SQL Notes
|
|
1897
1922
|
- Uses Presto/Trino based SQL syntax
|
|
@@ -1909,8 +1934,8 @@ var awsAthenaConnector = new ConnectorPlugin({
|
|
|
1909
1934
|
StartQueryExecutionCommand,
|
|
1910
1935
|
GetQueryExecutionCommand
|
|
1911
1936
|
} = await import("@aws-sdk/client-athena");
|
|
1912
|
-
const workgroup = params[
|
|
1913
|
-
const outputLocation = params[
|
|
1937
|
+
const workgroup = params[parameters13.workgroup.slug];
|
|
1938
|
+
const outputLocation = params[parameters13.outputLocation.slug];
|
|
1914
1939
|
if (!workgroup && !outputLocation) {
|
|
1915
1940
|
return {
|
|
1916
1941
|
success: false,
|
|
@@ -1918,10 +1943,10 @@ var awsAthenaConnector = new ConnectorPlugin({
|
|
|
1918
1943
|
};
|
|
1919
1944
|
}
|
|
1920
1945
|
const client = new AthenaClient({
|
|
1921
|
-
region: params[
|
|
1946
|
+
region: params[parameters13.awsRegion.slug],
|
|
1922
1947
|
credentials: {
|
|
1923
|
-
accessKeyId: params[
|
|
1924
|
-
secretAccessKey: params[
|
|
1948
|
+
accessKeyId: params[parameters13.awsAccessKeyId.slug],
|
|
1949
|
+
secretAccessKey: params[parameters13.awsSecretAccessKey.slug]
|
|
1925
1950
|
}
|
|
1926
1951
|
});
|
|
1927
1952
|
const startParams = { QueryString: "SELECT 1" };
|
|
@@ -1966,16 +1991,16 @@ var awsAthenaConnector = new ConnectorPlugin({
|
|
|
1966
1991
|
GetQueryResultsCommand
|
|
1967
1992
|
} = await import("@aws-sdk/client-athena");
|
|
1968
1993
|
const resolvedSql = replaceLiteralParams(sql, namedParams);
|
|
1969
|
-
const workgroup = params[
|
|
1970
|
-
const outputLocation = params[
|
|
1994
|
+
const workgroup = params[parameters13.workgroup.slug];
|
|
1995
|
+
const outputLocation = params[parameters13.outputLocation.slug];
|
|
1971
1996
|
if (!workgroup && !outputLocation) {
|
|
1972
1997
|
throw new Error("Either workgroup or output-location is required");
|
|
1973
1998
|
}
|
|
1974
1999
|
const client = new AthenaClient({
|
|
1975
|
-
region: params[
|
|
2000
|
+
region: params[parameters13.awsRegion.slug],
|
|
1976
2001
|
credentials: {
|
|
1977
|
-
accessKeyId: params[
|
|
1978
|
-
secretAccessKey: params[
|
|
2002
|
+
accessKeyId: params[parameters13.awsAccessKeyId.slug],
|
|
2003
|
+
secretAccessKey: params[parameters13.awsSecretAccessKey.slug]
|
|
1979
2004
|
}
|
|
1980
2005
|
});
|
|
1981
2006
|
const startParams = { QueryString: resolvedSql };
|
|
@@ -2020,7 +2045,7 @@ var awsAthenaConnector = new ConnectorPlugin({
|
|
|
2020
2045
|
});
|
|
2021
2046
|
|
|
2022
2047
|
// src/connectors/redshift/parameters.ts
|
|
2023
|
-
var
|
|
2048
|
+
var parameters14 = {
|
|
2024
2049
|
awsAccessKeyId: new ParameterDefinition({
|
|
2025
2050
|
slug: "aws-access-key-id",
|
|
2026
2051
|
name: "AWS Access Key ID",
|
|
@@ -2146,14 +2171,14 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
2146
2171
|
DescribeStatementCommand,
|
|
2147
2172
|
GetStatementResultCommand
|
|
2148
2173
|
} = await import("@aws-sdk/client-redshift-data");
|
|
2149
|
-
const awsAccessKeyId =
|
|
2150
|
-
const awsSecretAccessKey =
|
|
2151
|
-
const awsRegion =
|
|
2152
|
-
const database =
|
|
2153
|
-
const clusterIdentifier =
|
|
2154
|
-
const workgroupName =
|
|
2155
|
-
const secretArn =
|
|
2156
|
-
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);
|
|
2157
2182
|
if (!clusterIdentifier && !workgroupName) {
|
|
2158
2183
|
return {
|
|
2159
2184
|
success: false,
|
|
@@ -2224,7 +2249,7 @@ var redshiftConnector = new ConnectorPlugin({
|
|
|
2224
2249
|
name: "Redshift",
|
|
2225
2250
|
description: "Connect to Amazon Redshift for data warehouse analytics.",
|
|
2226
2251
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/AEwW2psmrnZ7htTVsgA9t/a637e31707c5d760be73ce1d8ec75580/aws-redshift-logo.svg",
|
|
2227
|
-
parameters:
|
|
2252
|
+
parameters: parameters14,
|
|
2228
2253
|
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
2229
2254
|
systemPrompt: `## Redshift SQL Notes
|
|
2230
2255
|
- Uses PostgreSQL based SQL syntax
|
|
@@ -2242,10 +2267,10 @@ var redshiftConnector = new ConnectorPlugin({
|
|
|
2242
2267
|
ExecuteStatementCommand,
|
|
2243
2268
|
DescribeStatementCommand
|
|
2244
2269
|
} = await import("@aws-sdk/client-redshift-data");
|
|
2245
|
-
const clusterIdentifier = params[
|
|
2246
|
-
const workgroupName = params[
|
|
2247
|
-
const secretArn = params[
|
|
2248
|
-
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];
|
|
2249
2274
|
if (!clusterIdentifier && !workgroupName) {
|
|
2250
2275
|
return {
|
|
2251
2276
|
success: false,
|
|
@@ -2253,15 +2278,15 @@ var redshiftConnector = new ConnectorPlugin({
|
|
|
2253
2278
|
};
|
|
2254
2279
|
}
|
|
2255
2280
|
const client = new RedshiftDataClient({
|
|
2256
|
-
region: params[
|
|
2281
|
+
region: params[parameters14.awsRegion.slug],
|
|
2257
2282
|
credentials: {
|
|
2258
|
-
accessKeyId: params[
|
|
2259
|
-
secretAccessKey: params[
|
|
2283
|
+
accessKeyId: params[parameters14.awsAccessKeyId.slug],
|
|
2284
|
+
secretAccessKey: params[parameters14.awsSecretAccessKey.slug]
|
|
2260
2285
|
}
|
|
2261
2286
|
});
|
|
2262
2287
|
const { Id: statementId } = await client.send(
|
|
2263
2288
|
new ExecuteStatementCommand({
|
|
2264
|
-
Database: params[
|
|
2289
|
+
Database: params[parameters14.database.slug],
|
|
2265
2290
|
Sql: "SELECT 1",
|
|
2266
2291
|
...clusterIdentifier && { ClusterIdentifier: clusterIdentifier },
|
|
2267
2292
|
...workgroupName && { WorkgroupName: workgroupName },
|
|
@@ -2302,23 +2327,23 @@ var redshiftConnector = new ConnectorPlugin({
|
|
|
2302
2327
|
GetStatementResultCommand
|
|
2303
2328
|
} = await import("@aws-sdk/client-redshift-data");
|
|
2304
2329
|
const resolvedSql = replaceLiteralParams(sql, namedParams);
|
|
2305
|
-
const clusterIdentifier = params[
|
|
2306
|
-
const workgroupName = params[
|
|
2307
|
-
const secretArn = params[
|
|
2308
|
-
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];
|
|
2309
2334
|
if (!clusterIdentifier && !workgroupName) {
|
|
2310
2335
|
throw new Error("Either cluster-identifier or workgroup-name is required");
|
|
2311
2336
|
}
|
|
2312
2337
|
const client = new RedshiftDataClient({
|
|
2313
|
-
region: params[
|
|
2338
|
+
region: params[parameters14.awsRegion.slug],
|
|
2314
2339
|
credentials: {
|
|
2315
|
-
accessKeyId: params[
|
|
2316
|
-
secretAccessKey: params[
|
|
2340
|
+
accessKeyId: params[parameters14.awsAccessKeyId.slug],
|
|
2341
|
+
secretAccessKey: params[parameters14.awsSecretAccessKey.slug]
|
|
2317
2342
|
}
|
|
2318
2343
|
});
|
|
2319
2344
|
const { Id: statementId } = await client.send(
|
|
2320
2345
|
new ExecuteStatementCommand({
|
|
2321
|
-
Database: params[
|
|
2346
|
+
Database: params[parameters14.database.slug],
|
|
2322
2347
|
Sql: resolvedSql,
|
|
2323
2348
|
...clusterIdentifier && { ClusterIdentifier: clusterIdentifier },
|
|
2324
2349
|
...workgroupName && { WorkgroupName: workgroupName },
|
|
@@ -2356,7 +2381,7 @@ var redshiftConnector = new ConnectorPlugin({
|
|
|
2356
2381
|
});
|
|
2357
2382
|
|
|
2358
2383
|
// src/connectors/databricks/parameters.ts
|
|
2359
|
-
var
|
|
2384
|
+
var parameters15 = {
|
|
2360
2385
|
host: new ParameterDefinition({
|
|
2361
2386
|
slug: "host",
|
|
2362
2387
|
name: "Databricks Workspace Host",
|
|
@@ -2428,9 +2453,9 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
2428
2453
|
);
|
|
2429
2454
|
try {
|
|
2430
2455
|
const { DBSQLClient } = await import("@databricks/sql");
|
|
2431
|
-
const host =
|
|
2432
|
-
const token =
|
|
2433
|
-
const httpPath =
|
|
2456
|
+
const host = parameters15.host.getValue(connection);
|
|
2457
|
+
const token = parameters15.token.getValue(connection);
|
|
2458
|
+
const httpPath = parameters15.httpPath.getValue(connection);
|
|
2434
2459
|
const client = new DBSQLClient();
|
|
2435
2460
|
await client.connect({ host, path: httpPath, token });
|
|
2436
2461
|
let session;
|
|
@@ -2471,7 +2496,7 @@ var databricksConnector = new ConnectorPlugin({
|
|
|
2471
2496
|
name: "Databricks",
|
|
2472
2497
|
description: "Connect to Databricks for data lakehouse and SQL analytics.",
|
|
2473
2498
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/6QgcrfpQOKg18P7DdgKerd/af55bf0d871339049824dd167b97a29f/databricks-icon.svg",
|
|
2474
|
-
parameters:
|
|
2499
|
+
parameters: parameters15,
|
|
2475
2500
|
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
2476
2501
|
systemPrompt: `## Databricks SQL Notes
|
|
2477
2502
|
- Uses Spark SQL / Databricks SQL syntax
|
|
@@ -2486,9 +2511,9 @@ var databricksConnector = new ConnectorPlugin({
|
|
|
2486
2511
|
const { DBSQLClient } = await import("@databricks/sql");
|
|
2487
2512
|
const client = new DBSQLClient();
|
|
2488
2513
|
await client.connect({
|
|
2489
|
-
host: params[
|
|
2490
|
-
path: params[
|
|
2491
|
-
token: params[
|
|
2514
|
+
host: params[parameters15.host.slug],
|
|
2515
|
+
path: params[parameters15.httpPath.slug],
|
|
2516
|
+
token: params[parameters15.token.slug]
|
|
2492
2517
|
});
|
|
2493
2518
|
let session;
|
|
2494
2519
|
let operation;
|
|
@@ -2515,9 +2540,9 @@ var databricksConnector = new ConnectorPlugin({
|
|
|
2515
2540
|
const resolvedSql = replaceLiteralParams(sql, namedParams);
|
|
2516
2541
|
const client = new DBSQLClient();
|
|
2517
2542
|
await client.connect({
|
|
2518
|
-
host: params[
|
|
2519
|
-
path: params[
|
|
2520
|
-
token: params[
|
|
2543
|
+
host: params[parameters15.host.slug],
|
|
2544
|
+
path: params[parameters15.httpPath.slug],
|
|
2545
|
+
token: params[parameters15.token.slug]
|
|
2521
2546
|
});
|
|
2522
2547
|
let session;
|
|
2523
2548
|
let operation;
|
|
@@ -2539,28 +2564,6 @@ var databricksConnector = new ConnectorPlugin({
|
|
|
2539
2564
|
}
|
|
2540
2565
|
});
|
|
2541
2566
|
|
|
2542
|
-
// src/connectors/airtable/parameters.ts
|
|
2543
|
-
var parameters12 = {
|
|
2544
|
-
baseId: new ParameterDefinition({
|
|
2545
|
-
slug: "base-id",
|
|
2546
|
-
name: "Airtable Base ID",
|
|
2547
|
-
description: "The Airtable Base ID (e.g., appXXXXXXXXXXXXXX).",
|
|
2548
|
-
envVarBaseKey: "AIRTABLE_BASE_ID",
|
|
2549
|
-
type: "text",
|
|
2550
|
-
secret: false,
|
|
2551
|
-
required: true
|
|
2552
|
-
}),
|
|
2553
|
-
apiKey: new ParameterDefinition({
|
|
2554
|
-
slug: "api-key",
|
|
2555
|
-
name: "Airtable API Key",
|
|
2556
|
-
description: "The Airtable API key or Personal Access Token for authentication. Required scopes: schema.bases:read, data.records:read.",
|
|
2557
|
-
envVarBaseKey: "AIRTABLE_API_KEY",
|
|
2558
|
-
type: "text",
|
|
2559
|
-
secret: true,
|
|
2560
|
-
required: true
|
|
2561
|
-
})
|
|
2562
|
-
};
|
|
2563
|
-
|
|
2564
2567
|
// src/connectors/airtable/tools/request.ts
|
|
2565
2568
|
import { z as z12 } from "zod";
|
|
2566
2569
|
var BASE_URL = "https://api.airtable.com/v0/";
|
|
@@ -2597,8 +2600,8 @@ Authentication is handled automatically using the API Key.
|
|
|
2597
2600
|
}
|
|
2598
2601
|
console.log(`[connector-request] airtable/${connection.name}: ${method} ${path}`);
|
|
2599
2602
|
try {
|
|
2600
|
-
const apiKey =
|
|
2601
|
-
const baseId =
|
|
2603
|
+
const apiKey = parameters.apiKey.getValue(connection);
|
|
2604
|
+
const baseId = parameters.baseId.getValue(connection);
|
|
2602
2605
|
const resolvedPath = path.replace(/\{baseId\}/g, baseId);
|
|
2603
2606
|
const url = `${BASE_URL}${resolvedPath}`;
|
|
2604
2607
|
const controller = new AbortController();
|
|
@@ -2640,7 +2643,7 @@ var airtableConnector = new ConnectorPlugin({
|
|
|
2640
2643
|
name: "Airtable",
|
|
2641
2644
|
description: "Connect to Airtable for spreadsheet-database hybrid data management.",
|
|
2642
2645
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/19JUphfOZjyjTK6Zg4NGCf/8c56227b088cada52d3a2d9385a3be97/airtable.svg",
|
|
2643
|
-
parameters
|
|
2646
|
+
parameters,
|
|
2644
2647
|
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
2645
2648
|
systemPrompt: `## Airtable API
|
|
2646
2649
|
- Call the Airtable REST API using the authenticated request tool
|
|
@@ -2659,32 +2662,39 @@ var airtableConnector = new ConnectorPlugin({
|
|
|
2659
2662
|
- Body: { "records": [{ "fields": { "Name": "value", ... } }] }
|
|
2660
2663
|
|
|
2661
2664
|
### Pagination
|
|
2662
|
-
- 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
|
+
\`\`\``,
|
|
2663
2695
|
tools: tools10
|
|
2664
2696
|
});
|
|
2665
2697
|
|
|
2666
|
-
// src/connectors/google-analytics/parameters.ts
|
|
2667
|
-
var parameters13 = {
|
|
2668
|
-
serviceAccountKeyJsonBase64: new ParameterDefinition({
|
|
2669
|
-
slug: "service-account-key-json-base64",
|
|
2670
|
-
name: "Google Cloud Service Account JSON",
|
|
2671
|
-
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.",
|
|
2672
|
-
envVarBaseKey: "GA_SERVICE_ACCOUNT_JSON_BASE64",
|
|
2673
|
-
type: "base64EncodedJson",
|
|
2674
|
-
secret: true,
|
|
2675
|
-
required: true
|
|
2676
|
-
}),
|
|
2677
|
-
propertyId: new ParameterDefinition({
|
|
2678
|
-
slug: "property-id",
|
|
2679
|
-
name: "Google Analytics Property ID",
|
|
2680
|
-
description: "The Google Analytics 4 property ID (e.g., 123456789).",
|
|
2681
|
-
envVarBaseKey: "GA_PROPERTY_ID",
|
|
2682
|
-
type: "text",
|
|
2683
|
-
secret: false,
|
|
2684
|
-
required: true
|
|
2685
|
-
})
|
|
2686
|
-
};
|
|
2687
|
-
|
|
2688
2698
|
// src/connectors/google-analytics/tools/request.ts
|
|
2689
2699
|
import { z as z13 } from "zod";
|
|
2690
2700
|
var BASE_URL2 = "https://analyticsdata.googleapis.com/v1beta/";
|
|
@@ -2722,8 +2732,8 @@ Authentication is handled automatically using a service account.
|
|
|
2722
2732
|
console.log(`[connector-request] google-analytics/${connection.name}: ${method} ${path}`);
|
|
2723
2733
|
try {
|
|
2724
2734
|
const { GoogleAuth } = await import("google-auth-library");
|
|
2725
|
-
const keyJsonBase64 =
|
|
2726
|
-
const propertyId =
|
|
2735
|
+
const keyJsonBase64 = parameters2.serviceAccountKeyJsonBase64.getValue(connection);
|
|
2736
|
+
const propertyId = parameters2.propertyId.getValue(connection);
|
|
2727
2737
|
const credentials = JSON.parse(
|
|
2728
2738
|
Buffer.from(keyJsonBase64, "base64").toString("utf-8")
|
|
2729
2739
|
);
|
|
@@ -2776,7 +2786,7 @@ var googleAnalyticsConnector = new ConnectorPlugin({
|
|
|
2776
2786
|
name: "Google Analytics",
|
|
2777
2787
|
description: "Connect to Google Analytics for web analytics and reporting.",
|
|
2778
2788
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/7fs0ipzxuD9mACDzBATtxX/3c53ed90d15c96483e4f78cb29dab5e9/google-analytics.svg",
|
|
2779
|
-
parameters:
|
|
2789
|
+
parameters: parameters2,
|
|
2780
2790
|
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
2781
2791
|
systemPrompt: `## Google Analytics Data API
|
|
2782
2792
|
- Call the GA4 Data API using the authenticated request tool
|
|
@@ -2805,7 +2815,36 @@ averageSessionDuration, conversions, totalRevenue
|
|
|
2805
2815
|
|
|
2806
2816
|
### Date Specification
|
|
2807
2817
|
- Absolute: "2024-01-01"
|
|
2808
|
-
- 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
|
+
\`\`\``,
|
|
2809
2848
|
tools: tools11
|
|
2810
2849
|
});
|
|
2811
2850
|
|
|
@@ -2843,9 +2882,9 @@ Authentication is handled automatically using username and password.`,
|
|
|
2843
2882
|
}
|
|
2844
2883
|
console.log(`[connector-request] kintone/${connection.name}: ${method} ${path}`);
|
|
2845
2884
|
try {
|
|
2846
|
-
const baseUrl =
|
|
2847
|
-
const username =
|
|
2848
|
-
const password =
|
|
2885
|
+
const baseUrl = parameters3.baseUrl.getValue(connection);
|
|
2886
|
+
const username = parameters3.username.getValue(connection);
|
|
2887
|
+
const password = parameters3.password.getValue(connection);
|
|
2849
2888
|
const authToken = Buffer.from(`${username}:${password}`).toString("base64");
|
|
2850
2889
|
const url = `${baseUrl.replace(/\/+$/, "")}/k/v1/${path}`;
|
|
2851
2890
|
const controller = new AbortController();
|
|
@@ -2889,7 +2928,7 @@ var kintoneConnector = new ConnectorPlugin({
|
|
|
2889
2928
|
name: "kintone",
|
|
2890
2929
|
description: "Connect to kintone for business application data retrieval and analytics.",
|
|
2891
2930
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/76nPGMJFZkMFE3UQNo2JFy/e71dc5f5d5cec1306ce0e17aafbfd9f0/kintone.png",
|
|
2892
|
-
parameters,
|
|
2931
|
+
parameters: parameters3,
|
|
2893
2932
|
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
2894
2933
|
systemPrompt: `## kintone REST API
|
|
2895
2934
|
- Call the kintone REST API using the authenticated request tool
|
|
@@ -2945,37 +2984,6 @@ const { apps } = await kintone.listApps();
|
|
|
2945
2984
|
tools: tools12
|
|
2946
2985
|
});
|
|
2947
2986
|
|
|
2948
|
-
// src/connectors/wix-store/parameters.ts
|
|
2949
|
-
var parameters14 = {
|
|
2950
|
-
accountId: new ParameterDefinition({
|
|
2951
|
-
slug: "account-id",
|
|
2952
|
-
name: "Account ID",
|
|
2953
|
-
description: "Account ID",
|
|
2954
|
-
envVarBaseKey: "WIX_ACCOUNT_ID",
|
|
2955
|
-
type: "text",
|
|
2956
|
-
secret: false,
|
|
2957
|
-
required: true
|
|
2958
|
-
}),
|
|
2959
|
-
siteId: new ParameterDefinition({
|
|
2960
|
-
slug: "site-id",
|
|
2961
|
-
name: "Site ID",
|
|
2962
|
-
description: "Site ID for Wix Store Project",
|
|
2963
|
-
envVarBaseKey: "WIX_SITE_ID",
|
|
2964
|
-
type: "text",
|
|
2965
|
-
secret: false,
|
|
2966
|
-
required: true
|
|
2967
|
-
}),
|
|
2968
|
-
apiKey: new ParameterDefinition({
|
|
2969
|
-
slug: "api-key",
|
|
2970
|
-
name: "API Key",
|
|
2971
|
-
description: "API Key to access the Wix store project",
|
|
2972
|
-
envVarBaseKey: "WIX_API_KEY",
|
|
2973
|
-
type: "text",
|
|
2974
|
-
secret: true,
|
|
2975
|
-
required: true
|
|
2976
|
-
})
|
|
2977
|
-
};
|
|
2978
|
-
|
|
2979
2987
|
// src/connectors/wix-store/tools/request.ts
|
|
2980
2988
|
import { z as z15 } from "zod";
|
|
2981
2989
|
var BASE_URL3 = "https://www.wixapis.com/";
|
|
@@ -3011,8 +3019,8 @@ Authentication is handled automatically using the API Key and Site ID.`,
|
|
|
3011
3019
|
}
|
|
3012
3020
|
console.log(`[connector-request] wix-store/${connection.name}: ${method} ${path}`);
|
|
3013
3021
|
try {
|
|
3014
|
-
const apiKey =
|
|
3015
|
-
const siteId =
|
|
3022
|
+
const apiKey = parameters4.apiKey.getValue(connection);
|
|
3023
|
+
const siteId = parameters4.siteId.getValue(connection);
|
|
3016
3024
|
const url = `${BASE_URL3}${path}`;
|
|
3017
3025
|
const controller = new AbortController();
|
|
3018
3026
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS6);
|
|
@@ -3054,12 +3062,14 @@ var wixStoreConnector = new ConnectorPlugin({
|
|
|
3054
3062
|
name: "Wix Store",
|
|
3055
3063
|
description: "Connect to Wix Store.",
|
|
3056
3064
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/YyFxclQFzROIYpFam6vRK/e7e75d3feac49a1cc5e433c147216d23/Wix_logo_black.svg",
|
|
3057
|
-
parameters:
|
|
3065
|
+
parameters: parameters4,
|
|
3058
3066
|
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
3059
3067
|
systemPrompt: `## Wix Store API
|
|
3060
3068
|
- Call the Wix Store REST API using the authenticated request tool
|
|
3061
3069
|
- Authentication (API Key, Site ID) is automatically configured
|
|
3062
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
|
|
3063
3073
|
|
|
3064
3074
|
### List Products
|
|
3065
3075
|
- POST stores/v1/products/query
|
|
@@ -3069,55 +3079,46 @@ var wixStoreConnector = new ConnectorPlugin({
|
|
|
3069
3079
|
- POST stores/v1/products/query
|
|
3070
3080
|
- Body: { "query": { "filter": { "name": { "$contains": "keyword" } }, "paging": { "limit": 50 } } }
|
|
3071
3081
|
|
|
3072
|
-
###
|
|
3073
|
-
- POST
|
|
3074
|
-
- 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
|
|
3075
3087
|
|
|
3076
3088
|
### List Collections (Categories)
|
|
3077
3089
|
- POST stores/v1/collections/query
|
|
3078
|
-
- Body: { "query": { "paging": { "limit": 50 } } }
|
|
3079
|
-
|
|
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 } } }),
|
|
3080
3109
|
});
|
|
3110
|
+
const data = await res.json();
|
|
3081
3111
|
|
|
3082
|
-
//
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
}),
|
|
3093
|
-
accountId: new ParameterDefinition({
|
|
3094
|
-
slug: "account-id",
|
|
3095
|
-
name: "dbt Account ID",
|
|
3096
|
-
description: "The dbt Cloud account ID.",
|
|
3097
|
-
envVarBaseKey: "DBT_ACCOUNT_ID",
|
|
3098
|
-
type: "text",
|
|
3099
|
-
secret: false,
|
|
3100
|
-
required: true
|
|
3101
|
-
}),
|
|
3102
|
-
prodEnvId: new ParameterDefinition({
|
|
3103
|
-
slug: "prod-env-id",
|
|
3104
|
-
name: "dbt Production Environment ID",
|
|
3105
|
-
description: "The dbt Cloud production environment ID.",
|
|
3106
|
-
envVarBaseKey: "DBT_PROD_ENV_ID",
|
|
3107
|
-
type: "text",
|
|
3108
|
-
secret: false,
|
|
3109
|
-
required: true
|
|
3110
|
-
}),
|
|
3111
|
-
token: new ParameterDefinition({
|
|
3112
|
-
slug: "token",
|
|
3113
|
-
name: "dbt API Token",
|
|
3114
|
-
description: "The API token for authenticating with dbt Cloud.",
|
|
3115
|
-
envVarBaseKey: "DBT_TOKEN",
|
|
3116
|
-
type: "text",
|
|
3117
|
-
secret: true,
|
|
3118
|
-
required: true
|
|
3119
|
-
})
|
|
3120
|
-
};
|
|
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
|
+
});
|
|
3121
3122
|
|
|
3122
3123
|
// src/connectors/dbt/tools/request.ts
|
|
3123
3124
|
import { z as z16 } from "zod";
|
|
@@ -3157,9 +3158,9 @@ Authentication is handled automatically using the API token.
|
|
|
3157
3158
|
}
|
|
3158
3159
|
console.log(`[connector-request] dbt/${connection.name}: GraphQL query`);
|
|
3159
3160
|
try {
|
|
3160
|
-
const host =
|
|
3161
|
-
const token =
|
|
3162
|
-
const environmentId =
|
|
3161
|
+
const host = parameters5.host.getValue(connection);
|
|
3162
|
+
const token = parameters5.token.getValue(connection);
|
|
3163
|
+
const environmentId = parameters5.prodEnvId.getValue(connection);
|
|
3163
3164
|
const resolvedVariables = variables ? JSON.parse(
|
|
3164
3165
|
JSON.stringify(variables).replace(/\{environmentId\}/g, environmentId)
|
|
3165
3166
|
) : void 0;
|
|
@@ -3209,7 +3210,7 @@ var dbtConnector = new ConnectorPlugin({
|
|
|
3209
3210
|
name: "dbt",
|
|
3210
3211
|
description: "Connect to dbt Cloud for data transformation and analytics engineering.",
|
|
3211
3212
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/4iT6ncXtdtHdkXexU0WgfZ/0367a38d245f2568eab5eb511f9ee692/dbt.png",
|
|
3212
|
-
parameters:
|
|
3213
|
+
parameters: parameters5,
|
|
3213
3214
|
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
3214
3215
|
systemPrompt: `## dbt Cloud Discovery API (GraphQL)
|
|
3215
3216
|
- Call the dbt Cloud Discovery API using the authenticated request tool
|
|
@@ -3261,7 +3262,36 @@ query:
|
|
|
3261
3262
|
|
|
3262
3263
|
### Lineage (Dependencies)
|
|
3263
3264
|
- Traverse relationships using ancestors / children fields
|
|
3264
|
-
- 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
|
+
\`\`\``,
|
|
3265
3295
|
tools: tools14
|
|
3266
3296
|
});
|
|
3267
3297
|
|
|
@@ -3412,7 +3442,7 @@ var openaiConnector = new ConnectorPlugin({
|
|
|
3412
3442
|
name: "OpenAI",
|
|
3413
3443
|
description: "Connect to OpenAI for AI model inference, embeddings, and image generation.",
|
|
3414
3444
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/53XJtCgUlW10x6i1X8xpxM/0bfd634069f1d74241296543cb20427a/openai.svg",
|
|
3415
|
-
parameters:
|
|
3445
|
+
parameters: parameters6,
|
|
3416
3446
|
releaseFlag: { dev1: true, dev2: false, prod: false },
|
|
3417
3447
|
systemPrompt: `## OpenAI SDK (TypeScript handler)
|
|
3418
3448
|
Use the OpenAI connector via the SDK in TypeScript handlers:
|