@squadbase/connectors 0.0.10 → 0.0.11
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-5YEHPSNW.js → chunk-E5AVUXWJ.js} +15 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +168 -137
- package/dist/sdk.d.ts +12 -2
- package/dist/sdk.js +16 -3
- package/package.json +1 -1
|
@@ -73,7 +73,21 @@ var parameters = {
|
|
|
73
73
|
})
|
|
74
74
|
};
|
|
75
75
|
|
|
76
|
+
// src/connectors/openai/parameters.ts
|
|
77
|
+
var parameters2 = {
|
|
78
|
+
apiKey: new ParameterDefinition({
|
|
79
|
+
slug: "api-key",
|
|
80
|
+
name: "OpenAI API Key",
|
|
81
|
+
description: "The OpenAI API key for authentication (starts with sk-).",
|
|
82
|
+
envVarBaseKey: "OPENAI_API_KEY",
|
|
83
|
+
type: "text",
|
|
84
|
+
secret: true,
|
|
85
|
+
required: true
|
|
86
|
+
})
|
|
87
|
+
};
|
|
88
|
+
|
|
76
89
|
export {
|
|
77
90
|
ParameterDefinition,
|
|
78
|
-
parameters
|
|
91
|
+
parameters,
|
|
92
|
+
parameters2
|
|
79
93
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -470,6 +470,9 @@ declare const connectors: {
|
|
|
470
470
|
error: string;
|
|
471
471
|
}>;
|
|
472
472
|
}>;
|
|
473
|
+
openai: ConnectorPlugin<{
|
|
474
|
+
apiKey: ParameterDefinition;
|
|
475
|
+
}, {}>;
|
|
473
476
|
};
|
|
474
477
|
|
|
475
478
|
declare const snowflakeConnector: ConnectorPlugin<{
|
|
@@ -802,4 +805,8 @@ declare const squadbaseDbConnector: ConnectorPlugin<{
|
|
|
802
805
|
}>;
|
|
803
806
|
}>;
|
|
804
807
|
|
|
805
|
-
|
|
808
|
+
declare const openaiConnector: ConnectorPlugin<{
|
|
809
|
+
apiKey: ParameterDefinition;
|
|
810
|
+
}, {}>;
|
|
811
|
+
|
|
812
|
+
export { AUTH_TYPES, type ConnectionCheckResult, ConnectorPlugin, ConnectorSetup, ConnectorTool, type ConnectorToolsConfig, ParameterDefinition, type ProxyPolicy, type ProxyPolicyRule, type ReleaseFlag, type SetupLanguage, airtableConnector, awsAthenaConnector, bigqueryConnector, bigqueryOauthConnector, connectors, databricksConnector, dbtConnector, googleAnalyticsConnector, kintoneConnector, mysqlConnector, openaiConnector, postgresqlConnector, redshiftConnector, snowflakeConnector, snowflakePatConnector, squadbaseDbConnector, wixStoreConnector };
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ParameterDefinition,
|
|
3
|
-
parameters
|
|
4
|
-
|
|
3
|
+
parameters,
|
|
4
|
+
parameters2
|
|
5
|
+
} from "./chunk-E5AVUXWJ.js";
|
|
5
6
|
|
|
6
7
|
// src/connector-setup.ts
|
|
7
8
|
var ConnectorSetup = class {
|
|
@@ -225,7 +226,7 @@ Follow these steps to set up the Snowflake connection.
|
|
|
225
226
|
});
|
|
226
227
|
|
|
227
228
|
// src/connectors/snowflake/parameters.ts
|
|
228
|
-
var
|
|
229
|
+
var parameters3 = {
|
|
229
230
|
account: new ParameterDefinition({
|
|
230
231
|
slug: "account",
|
|
231
232
|
name: "Snowflake Account",
|
|
@@ -319,11 +320,11 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
319
320
|
try {
|
|
320
321
|
const snowflake = (await import("snowflake-sdk")).default;
|
|
321
322
|
snowflake.configure({ logLevel: "ERROR" });
|
|
322
|
-
const account =
|
|
323
|
-
const user =
|
|
324
|
-
const role =
|
|
325
|
-
const warehouse =
|
|
326
|
-
const privateKeyBase64 =
|
|
323
|
+
const account = parameters3.account.getValue(connection);
|
|
324
|
+
const user = parameters3.user.getValue(connection);
|
|
325
|
+
const role = parameters3.role.getValue(connection);
|
|
326
|
+
const warehouse = parameters3.warehouse.getValue(connection);
|
|
327
|
+
const privateKeyBase64 = parameters3.privateKeyBase64.getValue(connection);
|
|
327
328
|
const privateKey = Buffer.from(privateKeyBase64, "base64").toString(
|
|
328
329
|
"utf-8"
|
|
329
330
|
);
|
|
@@ -390,7 +391,7 @@ var snowflakeConnector = new ConnectorPlugin({
|
|
|
390
391
|
name: "Snowflake",
|
|
391
392
|
description: "Connect to Snowflake for cloud data warehousing and analytics.",
|
|
392
393
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/6oyVtAcP3pMlXaOrts9unk/b7a9dc25d15c388b66e983041b855447/snowflake.svg",
|
|
393
|
-
parameters:
|
|
394
|
+
parameters: parameters3,
|
|
394
395
|
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
395
396
|
setup: snowflakeSetup,
|
|
396
397
|
systemPrompt: `## Snowflake SQL Notes
|
|
@@ -407,14 +408,14 @@ var snowflakeConnector = new ConnectorPlugin({
|
|
|
407
408
|
const snowflake = (await import("snowflake-sdk")).default;
|
|
408
409
|
snowflake.configure({ logLevel: "ERROR" });
|
|
409
410
|
const privateKey = Buffer.from(
|
|
410
|
-
params[
|
|
411
|
+
params[parameters3.privateKeyBase64.slug],
|
|
411
412
|
"base64"
|
|
412
413
|
).toString("utf-8");
|
|
413
414
|
const conn = snowflake.createConnection({
|
|
414
|
-
account: params[
|
|
415
|
-
username: params[
|
|
416
|
-
role: params[
|
|
417
|
-
warehouse: params[
|
|
415
|
+
account: params[parameters3.account.slug],
|
|
416
|
+
username: params[parameters3.user.slug],
|
|
417
|
+
role: params[parameters3.role.slug],
|
|
418
|
+
warehouse: params[parameters3.warehouse.slug],
|
|
418
419
|
authenticator: "SNOWFLAKE_JWT",
|
|
419
420
|
privateKey
|
|
420
421
|
});
|
|
@@ -446,14 +447,14 @@ var snowflakeConnector = new ConnectorPlugin({
|
|
|
446
447
|
const snowflake = (await import("snowflake-sdk")).default;
|
|
447
448
|
snowflake.configure({ logLevel: "ERROR" });
|
|
448
449
|
const privateKey = Buffer.from(
|
|
449
|
-
params[
|
|
450
|
+
params[parameters3.privateKeyBase64.slug],
|
|
450
451
|
"base64"
|
|
451
452
|
).toString("utf-8");
|
|
452
453
|
const conn = snowflake.createConnection({
|
|
453
|
-
account: params[
|
|
454
|
-
username: params[
|
|
455
|
-
role: params[
|
|
456
|
-
warehouse: params[
|
|
454
|
+
account: params[parameters3.account.slug],
|
|
455
|
+
username: params[parameters3.user.slug],
|
|
456
|
+
role: params[parameters3.role.slug],
|
|
457
|
+
warehouse: params[parameters3.warehouse.slug],
|
|
457
458
|
authenticator: "SNOWFLAKE_JWT",
|
|
458
459
|
privateKey
|
|
459
460
|
});
|
|
@@ -482,7 +483,7 @@ var snowflakeConnector = new ConnectorPlugin({
|
|
|
482
483
|
});
|
|
483
484
|
|
|
484
485
|
// src/connectors/snowflake-pat/parameters.ts
|
|
485
|
-
var
|
|
486
|
+
var parameters4 = {
|
|
486
487
|
account: new ParameterDefinition({
|
|
487
488
|
slug: "account",
|
|
488
489
|
name: "Snowflake Account",
|
|
@@ -576,11 +577,11 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
576
577
|
try {
|
|
577
578
|
const snowflake = (await import("snowflake-sdk")).default;
|
|
578
579
|
snowflake.configure({ logLevel: "ERROR" });
|
|
579
|
-
const account =
|
|
580
|
-
const user =
|
|
581
|
-
const role =
|
|
582
|
-
const warehouse =
|
|
583
|
-
const password =
|
|
580
|
+
const account = parameters4.account.getValue(connection);
|
|
581
|
+
const user = parameters4.user.getValue(connection);
|
|
582
|
+
const role = parameters4.role.getValue(connection);
|
|
583
|
+
const warehouse = parameters4.warehouse.getValue(connection);
|
|
584
|
+
const password = parameters4.pat.getValue(connection);
|
|
584
585
|
const conn = snowflake.createConnection({
|
|
585
586
|
account,
|
|
586
587
|
username: user,
|
|
@@ -643,7 +644,7 @@ var snowflakePatConnector = new ConnectorPlugin({
|
|
|
643
644
|
name: "Snowflake (PAT)",
|
|
644
645
|
description: "Connect to Snowflake using a Personal Access Token (PAT).",
|
|
645
646
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/6oyVtAcP3pMlXaOrts9unk/b7a9dc25d15c388b66e983041b855447/snowflake.svg",
|
|
646
|
-
parameters:
|
|
647
|
+
parameters: parameters4,
|
|
647
648
|
releaseFlag: { dev1: true, dev2: false, prod: false },
|
|
648
649
|
setup: snowflakeSetup,
|
|
649
650
|
systemPrompt: `## Snowflake SQL Notes
|
|
@@ -660,11 +661,11 @@ var snowflakePatConnector = new ConnectorPlugin({
|
|
|
660
661
|
const snowflake = (await import("snowflake-sdk")).default;
|
|
661
662
|
snowflake.configure({ logLevel: "ERROR" });
|
|
662
663
|
const conn = snowflake.createConnection({
|
|
663
|
-
account: params[
|
|
664
|
-
username: params[
|
|
665
|
-
role: params[
|
|
666
|
-
warehouse: params[
|
|
667
|
-
password: params[
|
|
664
|
+
account: params[parameters4.account.slug],
|
|
665
|
+
username: params[parameters4.user.slug],
|
|
666
|
+
role: params[parameters4.role.slug],
|
|
667
|
+
warehouse: params[parameters4.warehouse.slug],
|
|
668
|
+
password: params[parameters4.pat.slug]
|
|
668
669
|
});
|
|
669
670
|
await new Promise((resolve, reject) => {
|
|
670
671
|
conn.connect((err) => {
|
|
@@ -699,11 +700,11 @@ var snowflakePatConnector = new ConnectorPlugin({
|
|
|
699
700
|
const snowflake = (await import("snowflake-sdk")).default;
|
|
700
701
|
snowflake.configure({ logLevel: "ERROR" });
|
|
701
702
|
const conn = snowflake.createConnection({
|
|
702
|
-
account: params[
|
|
703
|
-
username: params[
|
|
704
|
-
role: params[
|
|
705
|
-
warehouse: params[
|
|
706
|
-
password: params[
|
|
703
|
+
account: params[parameters4.account.slug],
|
|
704
|
+
username: params[parameters4.user.slug],
|
|
705
|
+
role: params[parameters4.role.slug],
|
|
706
|
+
warehouse: params[parameters4.warehouse.slug],
|
|
707
|
+
password: params[parameters4.pat.slug]
|
|
707
708
|
});
|
|
708
709
|
await new Promise((resolve, reject) => {
|
|
709
710
|
conn.connect((err) => {
|
|
@@ -735,7 +736,7 @@ var snowflakePatConnector = new ConnectorPlugin({
|
|
|
735
736
|
});
|
|
736
737
|
|
|
737
738
|
// src/connectors/postgresql/parameters.ts
|
|
738
|
-
var
|
|
739
|
+
var parameters5 = {
|
|
739
740
|
connectionUrl: new ParameterDefinition({
|
|
740
741
|
slug: "connection-url",
|
|
741
742
|
name: "PostgreSQL Connection URL",
|
|
@@ -792,7 +793,7 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
792
793
|
let connectionUrl;
|
|
793
794
|
try {
|
|
794
795
|
const { Pool } = await import("pg");
|
|
795
|
-
connectionUrl =
|
|
796
|
+
connectionUrl = parameters5.connectionUrl.getValue(connection);
|
|
796
797
|
const pool = new Pool({
|
|
797
798
|
connectionString: connectionUrl,
|
|
798
799
|
ssl: { rejectUnauthorized: false },
|
|
@@ -830,7 +831,7 @@ var postgresqlConnector = new ConnectorPlugin({
|
|
|
830
831
|
name: "PostgreSQL",
|
|
831
832
|
description: "Connect to PostgreSQL databases for relational data storage and querying.",
|
|
832
833
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/42AHi2uqteUn65MyqdN6V7/a0f68f12af6aac96bbcda5980f43de07/elephant.png",
|
|
833
|
-
parameters:
|
|
834
|
+
parameters: parameters5,
|
|
834
835
|
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
835
836
|
systemPrompt: `## PostgreSQL SQL Notes
|
|
836
837
|
- Schema exploration:
|
|
@@ -841,7 +842,7 @@ var postgresqlConnector = new ConnectorPlugin({
|
|
|
841
842
|
async checkConnection(params, _config) {
|
|
842
843
|
const { Pool } = await import("pg");
|
|
843
844
|
const pool = new Pool({
|
|
844
|
-
connectionString: params[
|
|
845
|
+
connectionString: params[parameters5.connectionUrl.slug],
|
|
845
846
|
ssl: { rejectUnauthorized: false },
|
|
846
847
|
connectionTimeoutMillis: 1e4
|
|
847
848
|
});
|
|
@@ -858,7 +859,7 @@ var postgresqlConnector = new ConnectorPlugin({
|
|
|
858
859
|
const { Pool } = await import("pg");
|
|
859
860
|
const { text, values } = buildPositionalParams(sql, namedParams);
|
|
860
861
|
const pool = new Pool({
|
|
861
|
-
connectionString: params[
|
|
862
|
+
connectionString: params[parameters5.connectionUrl.slug],
|
|
862
863
|
ssl: { rejectUnauthorized: false },
|
|
863
864
|
connectionTimeoutMillis: 1e4,
|
|
864
865
|
statement_timeout: 6e4
|
|
@@ -873,7 +874,7 @@ var postgresqlConnector = new ConnectorPlugin({
|
|
|
873
874
|
});
|
|
874
875
|
|
|
875
876
|
// src/connectors/mysql/parameters.ts
|
|
876
|
-
var
|
|
877
|
+
var parameters6 = {
|
|
877
878
|
connectionUrl: new ParameterDefinition({
|
|
878
879
|
slug: "connection-url",
|
|
879
880
|
name: "MySQL Connection URL",
|
|
@@ -930,7 +931,7 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
930
931
|
let connectionUrl;
|
|
931
932
|
try {
|
|
932
933
|
const mysql = await import("mysql2/promise");
|
|
933
|
-
connectionUrl =
|
|
934
|
+
connectionUrl = parameters6.connectionUrl.getValue(connection);
|
|
934
935
|
const pool = mysql.createPool({
|
|
935
936
|
uri: connectionUrl,
|
|
936
937
|
connectTimeout: CONNECT_TIMEOUT_MS2
|
|
@@ -970,7 +971,7 @@ var mysqlConnector = new ConnectorPlugin({
|
|
|
970
971
|
name: "MySQL",
|
|
971
972
|
description: "Connect to MySQL databases for relational data storage and querying.",
|
|
972
973
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/6ghPFeGgl7uBs5NHH1a4L/512c9433beec5b595caa41f04921c1f9/logo-mysql-170x115.png",
|
|
973
|
-
parameters:
|
|
974
|
+
parameters: parameters6,
|
|
974
975
|
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
975
976
|
systemPrompt: `## MySQL SQL Notes
|
|
976
977
|
- Schema exploration:
|
|
@@ -981,7 +982,7 @@ var mysqlConnector = new ConnectorPlugin({
|
|
|
981
982
|
async checkConnection(params, _config) {
|
|
982
983
|
const mysql = await import("mysql2/promise");
|
|
983
984
|
const pool = mysql.createPool({
|
|
984
|
-
uri: params[
|
|
985
|
+
uri: params[parameters6.connectionUrl.slug],
|
|
985
986
|
connectTimeout: 1e4
|
|
986
987
|
});
|
|
987
988
|
try {
|
|
@@ -997,7 +998,7 @@ var mysqlConnector = new ConnectorPlugin({
|
|
|
997
998
|
const mysql = await import("mysql2/promise");
|
|
998
999
|
const { text, values } = buildQuestionmarkParams(sql, namedParams);
|
|
999
1000
|
const pool = mysql.createPool({
|
|
1000
|
-
uri: params[
|
|
1001
|
+
uri: params[parameters6.connectionUrl.slug],
|
|
1001
1002
|
connectTimeout: 1e4
|
|
1002
1003
|
});
|
|
1003
1004
|
try {
|
|
@@ -1018,7 +1019,7 @@ var mysqlConnector = new ConnectorPlugin({
|
|
|
1018
1019
|
import { z as z5 } from "zod";
|
|
1019
1020
|
|
|
1020
1021
|
// src/connectors/bigquery/parameters.ts
|
|
1021
|
-
var
|
|
1022
|
+
var parameters7 = {
|
|
1022
1023
|
serviceAccountKeyJsonBase64: new ParameterDefinition({
|
|
1023
1024
|
slug: "service-account-key-json-base64",
|
|
1024
1025
|
name: "Google Cloud Service Account JSON",
|
|
@@ -1075,7 +1076,7 @@ var listProjectsTool = new ConnectorTool({
|
|
|
1075
1076
|
};
|
|
1076
1077
|
}
|
|
1077
1078
|
try {
|
|
1078
|
-
const serviceAccountJsonBase64 =
|
|
1079
|
+
const serviceAccountJsonBase64 = parameters7.serviceAccountKeyJsonBase64.getValue(connection);
|
|
1079
1080
|
const credentials = JSON.parse(
|
|
1080
1081
|
Buffer.from(serviceAccountJsonBase64, "base64").toString("utf-8")
|
|
1081
1082
|
);
|
|
@@ -1223,8 +1224,8 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
1223
1224
|
);
|
|
1224
1225
|
try {
|
|
1225
1226
|
const { BigQuery } = await import("@google-cloud/bigquery");
|
|
1226
|
-
const projectId =
|
|
1227
|
-
const serviceAccountJsonBase64 =
|
|
1227
|
+
const projectId = parameters7.projectId.getValue(connection);
|
|
1228
|
+
const serviceAccountJsonBase64 = parameters7.serviceAccountKeyJsonBase64.getValue(connection);
|
|
1228
1229
|
const credentials = JSON.parse(
|
|
1229
1230
|
Buffer.from(serviceAccountJsonBase64, "base64").toString("utf-8")
|
|
1230
1231
|
);
|
|
@@ -1254,7 +1255,7 @@ var bigqueryConnector = new ConnectorPlugin({
|
|
|
1254
1255
|
name: "BigQuery",
|
|
1255
1256
|
description: "Connect to Google BigQuery for data warehouse and analytics.",
|
|
1256
1257
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/6nlehQyOmdbktG5hOYkYMr/6ca559140d5ddc7dadc5eac88858a563/bigquery.svg",
|
|
1257
|
-
parameters:
|
|
1258
|
+
parameters: parameters7,
|
|
1258
1259
|
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
1259
1260
|
setup: bigquerySetup,
|
|
1260
1261
|
systemPrompt: `## BigQuery SQL Notes
|
|
@@ -1268,10 +1269,10 @@ var bigqueryConnector = new ConnectorPlugin({
|
|
|
1268
1269
|
async checkConnection(params, _config) {
|
|
1269
1270
|
const { BigQuery } = await import("@google-cloud/bigquery");
|
|
1270
1271
|
const credentials = JSON.parse(
|
|
1271
|
-
Buffer.from(params[
|
|
1272
|
+
Buffer.from(params[parameters7.serviceAccountKeyJsonBase64.slug], "base64").toString("utf-8")
|
|
1272
1273
|
);
|
|
1273
1274
|
const bq = new BigQuery({
|
|
1274
|
-
projectId: params[
|
|
1275
|
+
projectId: params[parameters7.projectId.slug],
|
|
1275
1276
|
credentials
|
|
1276
1277
|
});
|
|
1277
1278
|
try {
|
|
@@ -1286,10 +1287,10 @@ var bigqueryConnector = new ConnectorPlugin({
|
|
|
1286
1287
|
const { BigQuery } = await import("@google-cloud/bigquery");
|
|
1287
1288
|
const resolvedSql = replaceLiteralParams(sql, namedParams);
|
|
1288
1289
|
const credentials = JSON.parse(
|
|
1289
|
-
Buffer.from(params[
|
|
1290
|
+
Buffer.from(params[parameters7.serviceAccountKeyJsonBase64.slug], "base64").toString("utf-8")
|
|
1290
1291
|
);
|
|
1291
1292
|
const bq = new BigQuery({
|
|
1292
|
-
projectId: params[
|
|
1293
|
+
projectId: params[parameters7.projectId.slug],
|
|
1293
1294
|
credentials
|
|
1294
1295
|
});
|
|
1295
1296
|
const [job] = await bq.createQueryJob({ query: resolvedSql });
|
|
@@ -1485,7 +1486,7 @@ Follow these steps to set up the BigQuery connection.
|
|
|
1485
1486
|
});
|
|
1486
1487
|
|
|
1487
1488
|
// src/connectors/bigquery-oauth/parameters.ts
|
|
1488
|
-
var
|
|
1489
|
+
var parameters8 = {
|
|
1489
1490
|
projectId: new ParameterDefinition({
|
|
1490
1491
|
slug: "project-id",
|
|
1491
1492
|
name: "Google Cloud Project ID",
|
|
@@ -1579,7 +1580,7 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
1579
1580
|
error: `Connection ${connectionId} not found`
|
|
1580
1581
|
};
|
|
1581
1582
|
}
|
|
1582
|
-
const gcpProjectId =
|
|
1583
|
+
const gcpProjectId = parameters8.projectId.getValue(connection);
|
|
1583
1584
|
console.log(
|
|
1584
1585
|
`[connector-query] bigquery-oauth/${connection.name}: ${sql}`
|
|
1585
1586
|
);
|
|
@@ -1646,7 +1647,7 @@ var bigqueryOauthConnector = new ConnectorPlugin({
|
|
|
1646
1647
|
name: "BigQuery (OAuth)",
|
|
1647
1648
|
description: "Connect to Google BigQuery for data warehouse and analytics using OAuth.",
|
|
1648
1649
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/6nlehQyOmdbktG5hOYkYMr/6ca559140d5ddc7dadc5eac88858a563/bigquery.svg",
|
|
1649
|
-
parameters:
|
|
1650
|
+
parameters: parameters8,
|
|
1650
1651
|
releaseFlag: { dev1: true, dev2: false, prod: false },
|
|
1651
1652
|
setup: bigquerySetup2,
|
|
1652
1653
|
proxyPolicy: {
|
|
@@ -1665,7 +1666,7 @@ var bigqueryOauthConnector = new ConnectorPlugin({
|
|
|
1665
1666
|
tools: tools6,
|
|
1666
1667
|
async checkConnection(params, config) {
|
|
1667
1668
|
const { proxyFetch } = config;
|
|
1668
|
-
const projectId = params[
|
|
1669
|
+
const projectId = params[parameters8.projectId.slug];
|
|
1669
1670
|
const url = `https://bigquery.googleapis.com/bigquery/v2/projects/${projectId}/queries`;
|
|
1670
1671
|
try {
|
|
1671
1672
|
const res = await proxyFetch(url, {
|
|
@@ -1684,7 +1685,7 @@ var bigqueryOauthConnector = new ConnectorPlugin({
|
|
|
1684
1685
|
},
|
|
1685
1686
|
async query(params, sql, namedParams, context) {
|
|
1686
1687
|
const { proxyFetch } = context;
|
|
1687
|
-
const projectId = params[
|
|
1688
|
+
const projectId = params[parameters8.projectId.slug];
|
|
1688
1689
|
const resolvedSql = replaceLiteralParams(sql, namedParams);
|
|
1689
1690
|
const url = `https://bigquery.googleapis.com/bigquery/v2/projects/${projectId}/queries`;
|
|
1690
1691
|
const res = await proxyFetch(url, {
|
|
@@ -1702,7 +1703,7 @@ var bigqueryOauthConnector = new ConnectorPlugin({
|
|
|
1702
1703
|
});
|
|
1703
1704
|
|
|
1704
1705
|
// src/connectors/aws-athena/parameters.ts
|
|
1705
|
-
var
|
|
1706
|
+
var parameters9 = {
|
|
1706
1707
|
awsAccessKeyId: new ParameterDefinition({
|
|
1707
1708
|
slug: "aws-access-key-id",
|
|
1708
1709
|
name: "AWS Access Key ID",
|
|
@@ -1799,8 +1800,8 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
1799
1800
|
GetQueryExecutionCommand,
|
|
1800
1801
|
GetQueryResultsCommand
|
|
1801
1802
|
} = await import("@aws-sdk/client-athena");
|
|
1802
|
-
const workgroup =
|
|
1803
|
-
const outputLocation =
|
|
1803
|
+
const workgroup = parameters9.workgroup.tryGetValue(connection);
|
|
1804
|
+
const outputLocation = parameters9.outputLocation.tryGetValue(connection);
|
|
1804
1805
|
if (!workgroup && !outputLocation) {
|
|
1805
1806
|
return {
|
|
1806
1807
|
success: false,
|
|
@@ -1808,10 +1809,10 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
1808
1809
|
};
|
|
1809
1810
|
}
|
|
1810
1811
|
const client = new AthenaClient({
|
|
1811
|
-
region:
|
|
1812
|
+
region: parameters9.awsRegion.getValue(connection),
|
|
1812
1813
|
credentials: {
|
|
1813
|
-
accessKeyId:
|
|
1814
|
-
secretAccessKey:
|
|
1814
|
+
accessKeyId: parameters9.awsAccessKeyId.getValue(connection),
|
|
1815
|
+
secretAccessKey: parameters9.awsSecretAccessKey.getValue(connection)
|
|
1815
1816
|
}
|
|
1816
1817
|
});
|
|
1817
1818
|
const startParams = { QueryString: sql };
|
|
@@ -1875,7 +1876,7 @@ var awsAthenaConnector = new ConnectorPlugin({
|
|
|
1875
1876
|
name: "AWS Athena",
|
|
1876
1877
|
description: "Connect to AWS Athena for serverless SQL queries on S3 data.",
|
|
1877
1878
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/5x0vIHtUHfJJMZUv4RFOYZ/5059bac389f0169542f39cdb4b387d2c/Athena.svg",
|
|
1878
|
-
parameters:
|
|
1879
|
+
parameters: parameters9,
|
|
1879
1880
|
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
1880
1881
|
systemPrompt: `## AWS Athena SQL Notes
|
|
1881
1882
|
- Uses Presto/Trino based SQL syntax
|
|
@@ -1893,8 +1894,8 @@ var awsAthenaConnector = new ConnectorPlugin({
|
|
|
1893
1894
|
StartQueryExecutionCommand,
|
|
1894
1895
|
GetQueryExecutionCommand
|
|
1895
1896
|
} = await import("@aws-sdk/client-athena");
|
|
1896
|
-
const workgroup = params[
|
|
1897
|
-
const outputLocation = params[
|
|
1897
|
+
const workgroup = params[parameters9.workgroup.slug];
|
|
1898
|
+
const outputLocation = params[parameters9.outputLocation.slug];
|
|
1898
1899
|
if (!workgroup && !outputLocation) {
|
|
1899
1900
|
return {
|
|
1900
1901
|
success: false,
|
|
@@ -1902,10 +1903,10 @@ var awsAthenaConnector = new ConnectorPlugin({
|
|
|
1902
1903
|
};
|
|
1903
1904
|
}
|
|
1904
1905
|
const client = new AthenaClient({
|
|
1905
|
-
region: params[
|
|
1906
|
+
region: params[parameters9.awsRegion.slug],
|
|
1906
1907
|
credentials: {
|
|
1907
|
-
accessKeyId: params[
|
|
1908
|
-
secretAccessKey: params[
|
|
1908
|
+
accessKeyId: params[parameters9.awsAccessKeyId.slug],
|
|
1909
|
+
secretAccessKey: params[parameters9.awsSecretAccessKey.slug]
|
|
1909
1910
|
}
|
|
1910
1911
|
});
|
|
1911
1912
|
const startParams = { QueryString: "SELECT 1" };
|
|
@@ -1950,16 +1951,16 @@ var awsAthenaConnector = new ConnectorPlugin({
|
|
|
1950
1951
|
GetQueryResultsCommand
|
|
1951
1952
|
} = await import("@aws-sdk/client-athena");
|
|
1952
1953
|
const resolvedSql = replaceLiteralParams(sql, namedParams);
|
|
1953
|
-
const workgroup = params[
|
|
1954
|
-
const outputLocation = params[
|
|
1954
|
+
const workgroup = params[parameters9.workgroup.slug];
|
|
1955
|
+
const outputLocation = params[parameters9.outputLocation.slug];
|
|
1955
1956
|
if (!workgroup && !outputLocation) {
|
|
1956
1957
|
throw new Error("Either workgroup or output-location is required");
|
|
1957
1958
|
}
|
|
1958
1959
|
const client = new AthenaClient({
|
|
1959
|
-
region: params[
|
|
1960
|
+
region: params[parameters9.awsRegion.slug],
|
|
1960
1961
|
credentials: {
|
|
1961
|
-
accessKeyId: params[
|
|
1962
|
-
secretAccessKey: params[
|
|
1962
|
+
accessKeyId: params[parameters9.awsAccessKeyId.slug],
|
|
1963
|
+
secretAccessKey: params[parameters9.awsSecretAccessKey.slug]
|
|
1963
1964
|
}
|
|
1964
1965
|
});
|
|
1965
1966
|
const startParams = { QueryString: resolvedSql };
|
|
@@ -2004,7 +2005,7 @@ var awsAthenaConnector = new ConnectorPlugin({
|
|
|
2004
2005
|
});
|
|
2005
2006
|
|
|
2006
2007
|
// src/connectors/redshift/parameters.ts
|
|
2007
|
-
var
|
|
2008
|
+
var parameters10 = {
|
|
2008
2009
|
awsAccessKeyId: new ParameterDefinition({
|
|
2009
2010
|
slug: "aws-access-key-id",
|
|
2010
2011
|
name: "AWS Access Key ID",
|
|
@@ -2130,14 +2131,14 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
2130
2131
|
DescribeStatementCommand,
|
|
2131
2132
|
GetStatementResultCommand
|
|
2132
2133
|
} = await import("@aws-sdk/client-redshift-data");
|
|
2133
|
-
const awsAccessKeyId =
|
|
2134
|
-
const awsSecretAccessKey =
|
|
2135
|
-
const awsRegion =
|
|
2136
|
-
const database =
|
|
2137
|
-
const clusterIdentifier =
|
|
2138
|
-
const workgroupName =
|
|
2139
|
-
const secretArn =
|
|
2140
|
-
const dbUser =
|
|
2134
|
+
const awsAccessKeyId = parameters10.awsAccessKeyId.getValue(connection);
|
|
2135
|
+
const awsSecretAccessKey = parameters10.awsSecretAccessKey.getValue(connection);
|
|
2136
|
+
const awsRegion = parameters10.awsRegion.getValue(connection);
|
|
2137
|
+
const database = parameters10.database.getValue(connection);
|
|
2138
|
+
const clusterIdentifier = parameters10.clusterIdentifier.tryGetValue(connection);
|
|
2139
|
+
const workgroupName = parameters10.workgroupName.tryGetValue(connection);
|
|
2140
|
+
const secretArn = parameters10.secretArn.tryGetValue(connection);
|
|
2141
|
+
const dbUser = parameters10.dbUser.tryGetValue(connection);
|
|
2141
2142
|
if (!clusterIdentifier && !workgroupName) {
|
|
2142
2143
|
return {
|
|
2143
2144
|
success: false,
|
|
@@ -2208,7 +2209,7 @@ var redshiftConnector = new ConnectorPlugin({
|
|
|
2208
2209
|
name: "Redshift",
|
|
2209
2210
|
description: "Connect to Amazon Redshift for data warehouse analytics.",
|
|
2210
2211
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/AEwW2psmrnZ7htTVsgA9t/a637e31707c5d760be73ce1d8ec75580/aws-redshift-logo.svg",
|
|
2211
|
-
parameters:
|
|
2212
|
+
parameters: parameters10,
|
|
2212
2213
|
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
2213
2214
|
systemPrompt: `## Redshift SQL Notes
|
|
2214
2215
|
- Uses PostgreSQL based SQL syntax
|
|
@@ -2226,10 +2227,10 @@ var redshiftConnector = new ConnectorPlugin({
|
|
|
2226
2227
|
ExecuteStatementCommand,
|
|
2227
2228
|
DescribeStatementCommand
|
|
2228
2229
|
} = await import("@aws-sdk/client-redshift-data");
|
|
2229
|
-
const clusterIdentifier = params[
|
|
2230
|
-
const workgroupName = params[
|
|
2231
|
-
const secretArn = params[
|
|
2232
|
-
const dbUser = params[
|
|
2230
|
+
const clusterIdentifier = params[parameters10.clusterIdentifier.slug];
|
|
2231
|
+
const workgroupName = params[parameters10.workgroupName.slug];
|
|
2232
|
+
const secretArn = params[parameters10.secretArn.slug];
|
|
2233
|
+
const dbUser = params[parameters10.dbUser.slug];
|
|
2233
2234
|
if (!clusterIdentifier && !workgroupName) {
|
|
2234
2235
|
return {
|
|
2235
2236
|
success: false,
|
|
@@ -2237,15 +2238,15 @@ var redshiftConnector = new ConnectorPlugin({
|
|
|
2237
2238
|
};
|
|
2238
2239
|
}
|
|
2239
2240
|
const client = new RedshiftDataClient({
|
|
2240
|
-
region: params[
|
|
2241
|
+
region: params[parameters10.awsRegion.slug],
|
|
2241
2242
|
credentials: {
|
|
2242
|
-
accessKeyId: params[
|
|
2243
|
-
secretAccessKey: params[
|
|
2243
|
+
accessKeyId: params[parameters10.awsAccessKeyId.slug],
|
|
2244
|
+
secretAccessKey: params[parameters10.awsSecretAccessKey.slug]
|
|
2244
2245
|
}
|
|
2245
2246
|
});
|
|
2246
2247
|
const { Id: statementId } = await client.send(
|
|
2247
2248
|
new ExecuteStatementCommand({
|
|
2248
|
-
Database: params[
|
|
2249
|
+
Database: params[parameters10.database.slug],
|
|
2249
2250
|
Sql: "SELECT 1",
|
|
2250
2251
|
...clusterIdentifier && { ClusterIdentifier: clusterIdentifier },
|
|
2251
2252
|
...workgroupName && { WorkgroupName: workgroupName },
|
|
@@ -2286,23 +2287,23 @@ var redshiftConnector = new ConnectorPlugin({
|
|
|
2286
2287
|
GetStatementResultCommand
|
|
2287
2288
|
} = await import("@aws-sdk/client-redshift-data");
|
|
2288
2289
|
const resolvedSql = replaceLiteralParams(sql, namedParams);
|
|
2289
|
-
const clusterIdentifier = params[
|
|
2290
|
-
const workgroupName = params[
|
|
2291
|
-
const secretArn = params[
|
|
2292
|
-
const dbUser = params[
|
|
2290
|
+
const clusterIdentifier = params[parameters10.clusterIdentifier.slug];
|
|
2291
|
+
const workgroupName = params[parameters10.workgroupName.slug];
|
|
2292
|
+
const secretArn = params[parameters10.secretArn.slug];
|
|
2293
|
+
const dbUser = params[parameters10.dbUser.slug];
|
|
2293
2294
|
if (!clusterIdentifier && !workgroupName) {
|
|
2294
2295
|
throw new Error("Either cluster-identifier or workgroup-name is required");
|
|
2295
2296
|
}
|
|
2296
2297
|
const client = new RedshiftDataClient({
|
|
2297
|
-
region: params[
|
|
2298
|
+
region: params[parameters10.awsRegion.slug],
|
|
2298
2299
|
credentials: {
|
|
2299
|
-
accessKeyId: params[
|
|
2300
|
-
secretAccessKey: params[
|
|
2300
|
+
accessKeyId: params[parameters10.awsAccessKeyId.slug],
|
|
2301
|
+
secretAccessKey: params[parameters10.awsSecretAccessKey.slug]
|
|
2301
2302
|
}
|
|
2302
2303
|
});
|
|
2303
2304
|
const { Id: statementId } = await client.send(
|
|
2304
2305
|
new ExecuteStatementCommand({
|
|
2305
|
-
Database: params[
|
|
2306
|
+
Database: params[parameters10.database.slug],
|
|
2306
2307
|
Sql: resolvedSql,
|
|
2307
2308
|
...clusterIdentifier && { ClusterIdentifier: clusterIdentifier },
|
|
2308
2309
|
...workgroupName && { WorkgroupName: workgroupName },
|
|
@@ -2340,7 +2341,7 @@ var redshiftConnector = new ConnectorPlugin({
|
|
|
2340
2341
|
});
|
|
2341
2342
|
|
|
2342
2343
|
// src/connectors/databricks/parameters.ts
|
|
2343
|
-
var
|
|
2344
|
+
var parameters11 = {
|
|
2344
2345
|
host: new ParameterDefinition({
|
|
2345
2346
|
slug: "host",
|
|
2346
2347
|
name: "Databricks Workspace Host",
|
|
@@ -2412,9 +2413,9 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
2412
2413
|
);
|
|
2413
2414
|
try {
|
|
2414
2415
|
const { DBSQLClient } = await import("@databricks/sql");
|
|
2415
|
-
const host =
|
|
2416
|
-
const token =
|
|
2417
|
-
const httpPath =
|
|
2416
|
+
const host = parameters11.host.getValue(connection);
|
|
2417
|
+
const token = parameters11.token.getValue(connection);
|
|
2418
|
+
const httpPath = parameters11.httpPath.getValue(connection);
|
|
2418
2419
|
const client = new DBSQLClient();
|
|
2419
2420
|
await client.connect({ host, path: httpPath, token });
|
|
2420
2421
|
let session;
|
|
@@ -2455,7 +2456,7 @@ var databricksConnector = new ConnectorPlugin({
|
|
|
2455
2456
|
name: "Databricks",
|
|
2456
2457
|
description: "Connect to Databricks for data lakehouse and SQL analytics.",
|
|
2457
2458
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/6QgcrfpQOKg18P7DdgKerd/af55bf0d871339049824dd167b97a29f/databricks-icon.svg",
|
|
2458
|
-
parameters:
|
|
2459
|
+
parameters: parameters11,
|
|
2459
2460
|
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
2460
2461
|
systemPrompt: `## Databricks SQL Notes
|
|
2461
2462
|
- Uses Spark SQL / Databricks SQL syntax
|
|
@@ -2470,9 +2471,9 @@ var databricksConnector = new ConnectorPlugin({
|
|
|
2470
2471
|
const { DBSQLClient } = await import("@databricks/sql");
|
|
2471
2472
|
const client = new DBSQLClient();
|
|
2472
2473
|
await client.connect({
|
|
2473
|
-
host: params[
|
|
2474
|
-
path: params[
|
|
2475
|
-
token: params[
|
|
2474
|
+
host: params[parameters11.host.slug],
|
|
2475
|
+
path: params[parameters11.httpPath.slug],
|
|
2476
|
+
token: params[parameters11.token.slug]
|
|
2476
2477
|
});
|
|
2477
2478
|
let session;
|
|
2478
2479
|
let operation;
|
|
@@ -2499,9 +2500,9 @@ var databricksConnector = new ConnectorPlugin({
|
|
|
2499
2500
|
const resolvedSql = replaceLiteralParams(sql, namedParams);
|
|
2500
2501
|
const client = new DBSQLClient();
|
|
2501
2502
|
await client.connect({
|
|
2502
|
-
host: params[
|
|
2503
|
-
path: params[
|
|
2504
|
-
token: params[
|
|
2503
|
+
host: params[parameters11.host.slug],
|
|
2504
|
+
path: params[parameters11.httpPath.slug],
|
|
2505
|
+
token: params[parameters11.token.slug]
|
|
2505
2506
|
});
|
|
2506
2507
|
let session;
|
|
2507
2508
|
let operation;
|
|
@@ -2524,7 +2525,7 @@ var databricksConnector = new ConnectorPlugin({
|
|
|
2524
2525
|
});
|
|
2525
2526
|
|
|
2526
2527
|
// src/connectors/airtable/parameters.ts
|
|
2527
|
-
var
|
|
2528
|
+
var parameters12 = {
|
|
2528
2529
|
baseId: new ParameterDefinition({
|
|
2529
2530
|
slug: "base-id",
|
|
2530
2531
|
name: "Airtable Base ID",
|
|
@@ -2581,8 +2582,8 @@ Authentication is handled automatically using the API Key.
|
|
|
2581
2582
|
}
|
|
2582
2583
|
console.log(`[connector-request] airtable/${connection.name}: ${method} ${path}`);
|
|
2583
2584
|
try {
|
|
2584
|
-
const apiKey =
|
|
2585
|
-
const baseId =
|
|
2585
|
+
const apiKey = parameters12.apiKey.getValue(connection);
|
|
2586
|
+
const baseId = parameters12.baseId.getValue(connection);
|
|
2586
2587
|
const resolvedPath = path.replace(/\{baseId\}/g, baseId);
|
|
2587
2588
|
const url = `${BASE_URL}${resolvedPath}`;
|
|
2588
2589
|
const controller = new AbortController();
|
|
@@ -2624,7 +2625,7 @@ var airtableConnector = new ConnectorPlugin({
|
|
|
2624
2625
|
name: "Airtable",
|
|
2625
2626
|
description: "Connect to Airtable for spreadsheet-database hybrid data management.",
|
|
2626
2627
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/19JUphfOZjyjTK6Zg4NGCf/8c56227b088cada52d3a2d9385a3be97/airtable.svg",
|
|
2627
|
-
parameters:
|
|
2628
|
+
parameters: parameters12,
|
|
2628
2629
|
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
2629
2630
|
systemPrompt: `## Airtable API
|
|
2630
2631
|
- Call the Airtable REST API using the authenticated request tool
|
|
@@ -2648,7 +2649,7 @@ var airtableConnector = new ConnectorPlugin({
|
|
|
2648
2649
|
});
|
|
2649
2650
|
|
|
2650
2651
|
// src/connectors/google-analytics/parameters.ts
|
|
2651
|
-
var
|
|
2652
|
+
var parameters13 = {
|
|
2652
2653
|
serviceAccountKeyJsonBase64: new ParameterDefinition({
|
|
2653
2654
|
slug: "service-account-key-json-base64",
|
|
2654
2655
|
name: "Google Cloud Service Account JSON",
|
|
@@ -2706,8 +2707,8 @@ Authentication is handled automatically using a service account.
|
|
|
2706
2707
|
console.log(`[connector-request] google-analytics/${connection.name}: ${method} ${path}`);
|
|
2707
2708
|
try {
|
|
2708
2709
|
const { GoogleAuth } = await import("google-auth-library");
|
|
2709
|
-
const keyJsonBase64 =
|
|
2710
|
-
const propertyId =
|
|
2710
|
+
const keyJsonBase64 = parameters13.serviceAccountKeyJsonBase64.getValue(connection);
|
|
2711
|
+
const propertyId = parameters13.propertyId.getValue(connection);
|
|
2711
2712
|
const credentials = JSON.parse(
|
|
2712
2713
|
Buffer.from(keyJsonBase64, "base64").toString("utf-8")
|
|
2713
2714
|
);
|
|
@@ -2760,7 +2761,7 @@ var googleAnalyticsConnector = new ConnectorPlugin({
|
|
|
2760
2761
|
name: "Google Analytics",
|
|
2761
2762
|
description: "Connect to Google Analytics for web analytics and reporting.",
|
|
2762
2763
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/7fs0ipzxuD9mACDzBATtxX/3c53ed90d15c96483e4f78cb29dab5e9/google-analytics.svg",
|
|
2763
|
-
parameters:
|
|
2764
|
+
parameters: parameters13,
|
|
2764
2765
|
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
2765
2766
|
systemPrompt: `## Google Analytics Data API
|
|
2766
2767
|
- Call the GA4 Data API using the authenticated request tool
|
|
@@ -2930,7 +2931,7 @@ const { apps } = await kintone.listApps();
|
|
|
2930
2931
|
});
|
|
2931
2932
|
|
|
2932
2933
|
// src/connectors/wix-store/parameters.ts
|
|
2933
|
-
var
|
|
2934
|
+
var parameters14 = {
|
|
2934
2935
|
accountId: new ParameterDefinition({
|
|
2935
2936
|
slug: "account-id",
|
|
2936
2937
|
name: "Account ID",
|
|
@@ -2995,8 +2996,8 @@ Authentication is handled automatically using the API Key and Site ID.`,
|
|
|
2995
2996
|
}
|
|
2996
2997
|
console.log(`[connector-request] wix-store/${connection.name}: ${method} ${path}`);
|
|
2997
2998
|
try {
|
|
2998
|
-
const apiKey =
|
|
2999
|
-
const siteId =
|
|
2999
|
+
const apiKey = parameters14.apiKey.getValue(connection);
|
|
3000
|
+
const siteId = parameters14.siteId.getValue(connection);
|
|
3000
3001
|
const url = `${BASE_URL3}${path}`;
|
|
3001
3002
|
const controller = new AbortController();
|
|
3002
3003
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS6);
|
|
@@ -3038,7 +3039,7 @@ var wixStoreConnector = new ConnectorPlugin({
|
|
|
3038
3039
|
name: "Wix Store",
|
|
3039
3040
|
description: "Connect to Wix Store.",
|
|
3040
3041
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/YyFxclQFzROIYpFam6vRK/e7e75d3feac49a1cc5e433c147216d23/Wix_logo_black.svg",
|
|
3041
|
-
parameters:
|
|
3042
|
+
parameters: parameters14,
|
|
3042
3043
|
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
3043
3044
|
systemPrompt: `## Wix Store API
|
|
3044
3045
|
- Call the Wix Store REST API using the authenticated request tool
|
|
@@ -3064,7 +3065,7 @@ var wixStoreConnector = new ConnectorPlugin({
|
|
|
3064
3065
|
});
|
|
3065
3066
|
|
|
3066
3067
|
// src/connectors/dbt/parameters.ts
|
|
3067
|
-
var
|
|
3068
|
+
var parameters15 = {
|
|
3068
3069
|
host: new ParameterDefinition({
|
|
3069
3070
|
slug: "host",
|
|
3070
3071
|
name: "dbt Cloud Host",
|
|
@@ -3141,9 +3142,9 @@ Authentication is handled automatically using the API token.
|
|
|
3141
3142
|
}
|
|
3142
3143
|
console.log(`[connector-request] dbt/${connection.name}: GraphQL query`);
|
|
3143
3144
|
try {
|
|
3144
|
-
const host =
|
|
3145
|
-
const token =
|
|
3146
|
-
const environmentId =
|
|
3145
|
+
const host = parameters15.host.getValue(connection);
|
|
3146
|
+
const token = parameters15.token.getValue(connection);
|
|
3147
|
+
const environmentId = parameters15.prodEnvId.getValue(connection);
|
|
3147
3148
|
const resolvedVariables = variables ? JSON.parse(
|
|
3148
3149
|
JSON.stringify(variables).replace(/\{environmentId\}/g, environmentId)
|
|
3149
3150
|
) : void 0;
|
|
@@ -3193,7 +3194,7 @@ var dbtConnector = new ConnectorPlugin({
|
|
|
3193
3194
|
name: "dbt",
|
|
3194
3195
|
description: "Connect to dbt Cloud for data transformation and analytics engineering.",
|
|
3195
3196
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/4iT6ncXtdtHdkXexU0WgfZ/0367a38d245f2568eab5eb511f9ee692/dbt.png",
|
|
3196
|
-
parameters:
|
|
3197
|
+
parameters: parameters15,
|
|
3197
3198
|
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
3198
3199
|
systemPrompt: `## dbt Cloud Discovery API (GraphQL)
|
|
3199
3200
|
- Call the dbt Cloud Discovery API using the authenticated request tool
|
|
@@ -3250,7 +3251,7 @@ query:
|
|
|
3250
3251
|
});
|
|
3251
3252
|
|
|
3252
3253
|
// src/connectors/squadbase-db/parameters.ts
|
|
3253
|
-
var
|
|
3254
|
+
var parameters16 = {
|
|
3254
3255
|
connectionUrl: new ParameterDefinition({
|
|
3255
3256
|
slug: "connection-url",
|
|
3256
3257
|
name: "Connection URL",
|
|
@@ -3307,7 +3308,7 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
3307
3308
|
let connectionUrl;
|
|
3308
3309
|
try {
|
|
3309
3310
|
const { Pool } = await import("pg");
|
|
3310
|
-
connectionUrl =
|
|
3311
|
+
connectionUrl = parameters16.connectionUrl.getValue(connection);
|
|
3311
3312
|
const pool = new Pool({
|
|
3312
3313
|
connectionString: connectionUrl,
|
|
3313
3314
|
ssl: { rejectUnauthorized: false },
|
|
@@ -3345,7 +3346,7 @@ var squadbaseDbConnector = new ConnectorPlugin({
|
|
|
3345
3346
|
name: "Squadbase DB",
|
|
3346
3347
|
description: "Connect to Squadbase DB (PostgreSQL).",
|
|
3347
3348
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/25y0XqMxIufeD3egWH3bEl/659b4ade405890654cfaf91c03a4b458/icon.svg",
|
|
3348
|
-
parameters:
|
|
3349
|
+
parameters: parameters16,
|
|
3349
3350
|
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
3350
3351
|
systemPrompt: `## Squadbase DB SQL Notes
|
|
3351
3352
|
- Uses PostgreSQL based SQL syntax
|
|
@@ -3357,7 +3358,7 @@ var squadbaseDbConnector = new ConnectorPlugin({
|
|
|
3357
3358
|
async checkConnection(params, _config) {
|
|
3358
3359
|
const { Pool } = await import("pg");
|
|
3359
3360
|
const pool = new Pool({
|
|
3360
|
-
connectionString: params[
|
|
3361
|
+
connectionString: params[parameters16.connectionUrl.slug],
|
|
3361
3362
|
ssl: { rejectUnauthorized: false },
|
|
3362
3363
|
connectionTimeoutMillis: 1e4
|
|
3363
3364
|
});
|
|
@@ -3374,7 +3375,7 @@ var squadbaseDbConnector = new ConnectorPlugin({
|
|
|
3374
3375
|
const { Pool } = await import("pg");
|
|
3375
3376
|
const { text, values } = buildPositionalParams(sql, namedParams);
|
|
3376
3377
|
const pool = new Pool({
|
|
3377
|
-
connectionString: params[
|
|
3378
|
+
connectionString: params[parameters16.connectionUrl.slug],
|
|
3378
3379
|
ssl: { rejectUnauthorized: false },
|
|
3379
3380
|
connectionTimeoutMillis: 1e4,
|
|
3380
3381
|
statement_timeout: 6e4
|
|
@@ -3388,6 +3389,34 @@ var squadbaseDbConnector = new ConnectorPlugin({
|
|
|
3388
3389
|
}
|
|
3389
3390
|
});
|
|
3390
3391
|
|
|
3392
|
+
// src/connectors/openai/index.ts
|
|
3393
|
+
var tools16 = {};
|
|
3394
|
+
var openaiConnector = new ConnectorPlugin({
|
|
3395
|
+
slug: "openai",
|
|
3396
|
+
authType: null,
|
|
3397
|
+
name: "OpenAI",
|
|
3398
|
+
description: "Connect to OpenAI for AI model inference, embeddings, and image generation.",
|
|
3399
|
+
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/53XJtCgUlW10x6i1X8xpxM/0bfd634069f1d74241296543cb20427a/openai.svg",
|
|
3400
|
+
parameters: parameters2,
|
|
3401
|
+
releaseFlag: { dev1: true, dev2: false, prod: false },
|
|
3402
|
+
systemPrompt: `## OpenAI SDK (TypeScript handler)
|
|
3403
|
+
Use the OpenAI connector via the SDK in TypeScript handlers:
|
|
3404
|
+
|
|
3405
|
+
\`\`\`ts
|
|
3406
|
+
import { connection } from "@squadbase/vite-server/connectors/openai";
|
|
3407
|
+
import OpenAI from "openai";
|
|
3408
|
+
|
|
3409
|
+
const { apiKey } = connection("<connectionId>");
|
|
3410
|
+
const client = new OpenAI({ apiKey });
|
|
3411
|
+
|
|
3412
|
+
const response = await client.chat.completions.create({
|
|
3413
|
+
model: "gpt-4o",
|
|
3414
|
+
messages: [{ role: "user", content: "Hello" }],
|
|
3415
|
+
});
|
|
3416
|
+
\`\`\``,
|
|
3417
|
+
tools: tools16
|
|
3418
|
+
});
|
|
3419
|
+
|
|
3391
3420
|
// src/connectors/registry.ts
|
|
3392
3421
|
var plugins = {
|
|
3393
3422
|
snowflake: snowflakeConnector,
|
|
@@ -3404,7 +3433,8 @@ var plugins = {
|
|
|
3404
3433
|
airtable: airtableConnector,
|
|
3405
3434
|
squadbaseDb: squadbaseDbConnector,
|
|
3406
3435
|
kintone: kintoneConnector,
|
|
3407
|
-
wixStore: wixStoreConnector
|
|
3436
|
+
wixStore: wixStoreConnector,
|
|
3437
|
+
openai: openaiConnector
|
|
3408
3438
|
};
|
|
3409
3439
|
var connectors = {
|
|
3410
3440
|
...plugins,
|
|
@@ -3443,6 +3473,7 @@ export {
|
|
|
3443
3473
|
googleAnalyticsConnector,
|
|
3444
3474
|
kintoneConnector,
|
|
3445
3475
|
mysqlConnector,
|
|
3476
|
+
openaiConnector,
|
|
3446
3477
|
postgresqlConnector,
|
|
3447
3478
|
redshiftConnector,
|
|
3448
3479
|
snowflakeConnector,
|
package/dist/sdk.d.ts
CHANGED
|
@@ -34,6 +34,16 @@ interface KintoneConnectorSdk {
|
|
|
34
34
|
* @param params - Resolved parameter values keyed by parameter slug
|
|
35
35
|
* ("base-url", "username", "password")
|
|
36
36
|
*/
|
|
37
|
-
declare function createClient(params: Record<string, string>): KintoneConnectorSdk;
|
|
37
|
+
declare function createClient$1(params: Record<string, string>): KintoneConnectorSdk;
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
interface OpenAIConnectorSdk {
|
|
40
|
+
apiKey: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Create an OpenAI client from resolved connection parameters.
|
|
44
|
+
*
|
|
45
|
+
* @param params - Resolved parameter values keyed by parameter slug ("api-key")
|
|
46
|
+
*/
|
|
47
|
+
declare function createClient(params: Record<string, string>): OpenAIConnectorSdk;
|
|
48
|
+
|
|
49
|
+
export { type KintoneConnectorSdk, type OpenAIConnectorSdk, createClient$1 as kintone, createClient as openai };
|
package/dist/sdk.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
-
parameters
|
|
3
|
-
|
|
2
|
+
parameters,
|
|
3
|
+
parameters2
|
|
4
|
+
} from "./chunk-E5AVUXWJ.js";
|
|
4
5
|
|
|
5
6
|
// src/connectors/kintone/sdk/index.ts
|
|
6
7
|
function createClient(params) {
|
|
@@ -70,6 +71,18 @@ function createClient(params) {
|
|
|
70
71
|
}
|
|
71
72
|
};
|
|
72
73
|
}
|
|
74
|
+
|
|
75
|
+
// src/connectors/openai/sdk/index.ts
|
|
76
|
+
function createClient2(params) {
|
|
77
|
+
const apiKey = params[parameters2.apiKey.slug];
|
|
78
|
+
if (!apiKey) {
|
|
79
|
+
throw new Error(
|
|
80
|
+
`openai: missing required parameter: ${parameters2.apiKey.slug}`
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
return { apiKey };
|
|
84
|
+
}
|
|
73
85
|
export {
|
|
74
|
-
createClient as kintone
|
|
86
|
+
createClient as kintone,
|
|
87
|
+
createClient2 as openai
|
|
75
88
|
};
|