@squadbase/vite-server 0.1.10 → 0.1.12-dev.822582a
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/cli/index.js +1595 -284
- package/dist/connectors/oracle.js +1 -1
- package/dist/connectors/outlook-oauth.d.ts +5 -0
- package/dist/connectors/outlook-oauth.js +929 -0
- package/dist/connectors/powerbi-oauth.d.ts +5 -0
- package/dist/connectors/powerbi-oauth.js +720 -0
- package/dist/connectors/tableau.d.ts +5 -0
- package/dist/connectors/tableau.js +879 -0
- package/dist/index.js +1593 -282
- package/dist/main.js +1593 -282
- package/dist/vite-plugin.js +1595 -284
- package/package.json +13 -1
package/dist/cli/index.js
CHANGED
|
@@ -438,6 +438,37 @@ import { z } from "zod";
|
|
|
438
438
|
|
|
439
439
|
// ../connectors/src/connectors/snowflake/utils.ts
|
|
440
440
|
import crypto from "crypto";
|
|
441
|
+
|
|
442
|
+
// ../connectors/src/lib/approx-bytes.ts
|
|
443
|
+
function approxBytes(value, acc, limit) {
|
|
444
|
+
if (acc > limit) return acc;
|
|
445
|
+
if (value == null) return acc;
|
|
446
|
+
const t = typeof value;
|
|
447
|
+
if (t === "string") return acc + value.length;
|
|
448
|
+
if (t === "number" || t === "boolean") return acc + 8;
|
|
449
|
+
if (t === "bigint") return acc + 16;
|
|
450
|
+
if (value instanceof Date) return acc + 8;
|
|
451
|
+
if (Buffer.isBuffer(value)) return acc + value.byteLength;
|
|
452
|
+
if (Array.isArray(value)) {
|
|
453
|
+
for (const item of value) {
|
|
454
|
+
acc = approxBytes(item, acc, limit);
|
|
455
|
+
if (acc > limit) return acc;
|
|
456
|
+
}
|
|
457
|
+
return acc;
|
|
458
|
+
}
|
|
459
|
+
if (t === "object") {
|
|
460
|
+
const obj = value;
|
|
461
|
+
for (const k in obj) {
|
|
462
|
+
acc += k.length;
|
|
463
|
+
acc = approxBytes(obj[k], acc, limit);
|
|
464
|
+
if (acc > limit) return acc;
|
|
465
|
+
}
|
|
466
|
+
return acc;
|
|
467
|
+
}
|
|
468
|
+
return acc;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
// ../connectors/src/connectors/snowflake/utils.ts
|
|
441
472
|
function decryptPrivateKey(pem, passphrase) {
|
|
442
473
|
if (!passphrase) return pem;
|
|
443
474
|
return crypto.createPrivateKey({
|
|
@@ -446,10 +477,46 @@ function decryptPrivateKey(pem, passphrase) {
|
|
|
446
477
|
passphrase
|
|
447
478
|
}).export({ type: "pkcs8", format: "pem" });
|
|
448
479
|
}
|
|
480
|
+
async function executeWithSizeLimit(conn, sql, options) {
|
|
481
|
+
const rows = [];
|
|
482
|
+
let acc = 0;
|
|
483
|
+
let exceeded = false;
|
|
484
|
+
await new Promise((resolve, reject) => {
|
|
485
|
+
const stmt = conn.execute({
|
|
486
|
+
sqlText: sql,
|
|
487
|
+
streamResult: true
|
|
488
|
+
});
|
|
489
|
+
const stream = stmt.streamRows();
|
|
490
|
+
stream.on("data", (row) => {
|
|
491
|
+
if (exceeded) return;
|
|
492
|
+
acc = approxBytes(row, acc, options.maxBytes);
|
|
493
|
+
if (acc > options.maxBytes) {
|
|
494
|
+
exceeded = true;
|
|
495
|
+
stream.destroy();
|
|
496
|
+
stmt.cancel(() => {
|
|
497
|
+
});
|
|
498
|
+
resolve();
|
|
499
|
+
return;
|
|
500
|
+
}
|
|
501
|
+
rows.push(row);
|
|
502
|
+
});
|
|
503
|
+
stream.on("end", () => {
|
|
504
|
+
resolve();
|
|
505
|
+
});
|
|
506
|
+
stream.on("error", (err) => {
|
|
507
|
+
if (exceeded) return;
|
|
508
|
+
reject(new Error(`Snowflake query failed: ${err.message}`));
|
|
509
|
+
});
|
|
510
|
+
});
|
|
511
|
+
if (exceeded) {
|
|
512
|
+
return { exceeded: true };
|
|
513
|
+
}
|
|
514
|
+
return { exceeded: false, rows };
|
|
515
|
+
}
|
|
449
516
|
|
|
450
517
|
// ../connectors/src/connectors/snowflake/tools/execute-query.ts
|
|
451
|
-
var
|
|
452
|
-
var
|
|
518
|
+
var MAX_RESULT_BYTES = 5 * 1024 * 1024;
|
|
519
|
+
var STATEMENT_TIMEOUT_SECONDS = 60;
|
|
453
520
|
var inputSchema = z.object({
|
|
454
521
|
toolUseIntent: z.string().optional().describe(
|
|
455
522
|
"Brief description of what you intend to accomplish with this tool call"
|
|
@@ -463,7 +530,6 @@ var outputSchema = z.discriminatedUnion("success", [
|
|
|
463
530
|
z.object({
|
|
464
531
|
success: z.literal(true),
|
|
465
532
|
rowCount: z.number(),
|
|
466
|
-
truncated: z.boolean(),
|
|
467
533
|
rows: z.array(z.record(z.string(), z.unknown()))
|
|
468
534
|
}),
|
|
469
535
|
z.object({
|
|
@@ -473,9 +539,12 @@ var outputSchema = z.discriminatedUnion("success", [
|
|
|
473
539
|
]);
|
|
474
540
|
var executeQueryTool = new ConnectorTool({
|
|
475
541
|
name: "executeQuery",
|
|
476
|
-
description: `Execute SQL against Snowflake.
|
|
477
|
-
Use for: schema exploration (SHOW DATABASES/SCHEMAS/TABLES, DESCRIBE TABLE, INFORMATION_SCHEMA),
|
|
478
|
-
|
|
542
|
+
description: `Execute SQL against Snowflake. Results are streamed; if the approximate result size exceeds 5MB the call fails with an explicit error and you must retry with a smaller query (add LIMIT, wrap wide text columns with SUBSTR, or aggregate inside Snowflake).
|
|
543
|
+
Use for: schema exploration (SHOW DATABASES/SCHEMAS/TABLES, DESCRIBE TABLE, INFORMATION_SCHEMA), sampling (LIMIT, SAMPLE), and analytical queries.
|
|
544
|
+
Memory guidance:
|
|
545
|
+
- Avoid SELECT * on tables with long text columns (logs, JSON, concatenated text). Project only the columns you need; truncate wide text with SUBSTR(col, 1, N).
|
|
546
|
+
- For full-dataset analysis, do the aggregation inside Snowflake (COUNT, SUM, GROUP BY, APPROX_TOP_K, HISTOGRAM) instead of returning raw rows.
|
|
547
|
+
- Exploration is iterative: start with a small LIMIT to inspect shape, then refine.`,
|
|
479
548
|
inputSchema,
|
|
480
549
|
outputSchema,
|
|
481
550
|
async execute({ connectionId, sql }, connections) {
|
|
@@ -517,39 +586,43 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
517
586
|
else resolve();
|
|
518
587
|
});
|
|
519
588
|
});
|
|
520
|
-
|
|
521
|
-
(resolve, reject) => {
|
|
522
|
-
const timeoutId = setTimeout(() => {
|
|
523
|
-
reject(
|
|
524
|
-
new Error(
|
|
525
|
-
"Snowflake query timeout: query exceeded 60 seconds"
|
|
526
|
-
)
|
|
527
|
-
);
|
|
528
|
-
}, QUERY_TIMEOUT_MS);
|
|
589
|
+
try {
|
|
590
|
+
await new Promise((resolve, reject) => {
|
|
529
591
|
conn.execute({
|
|
530
|
-
sqlText:
|
|
531
|
-
complete: (err
|
|
532
|
-
clearTimeout(timeoutId);
|
|
592
|
+
sqlText: `ALTER SESSION SET STATEMENT_TIMEOUT_IN_SECONDS = ${STATEMENT_TIMEOUT_SECONDS}`,
|
|
593
|
+
complete: (err) => {
|
|
533
594
|
if (err)
|
|
534
|
-
reject(
|
|
535
|
-
|
|
595
|
+
reject(
|
|
596
|
+
new Error(
|
|
597
|
+
`Failed to set Snowflake statement timeout: ${err.message}`
|
|
598
|
+
)
|
|
599
|
+
);
|
|
600
|
+
else resolve();
|
|
536
601
|
}
|
|
537
602
|
});
|
|
603
|
+
});
|
|
604
|
+
const result = await executeWithSizeLimit(conn, sql, {
|
|
605
|
+
maxBytes: MAX_RESULT_BYTES
|
|
606
|
+
});
|
|
607
|
+
if (result.exceeded) {
|
|
608
|
+
return {
|
|
609
|
+
success: false,
|
|
610
|
+
error: "Result size exceeded 5MB. Reduce the query: add LIMIT, wrap wide text columns with SUBSTR(col, 1, N), or aggregate inside Snowflake (COUNT/SUM/GROUP BY)."
|
|
611
|
+
};
|
|
538
612
|
}
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
};
|
|
613
|
+
return {
|
|
614
|
+
success: true,
|
|
615
|
+
rowCount: result.rows.length,
|
|
616
|
+
rows: result.rows
|
|
617
|
+
};
|
|
618
|
+
} finally {
|
|
619
|
+
conn.destroy((err) => {
|
|
620
|
+
if (err)
|
|
621
|
+
console.warn(
|
|
622
|
+
`[connector-query] Snowflake destroy error: ${err.message}`
|
|
623
|
+
);
|
|
624
|
+
});
|
|
625
|
+
}
|
|
553
626
|
} catch (err) {
|
|
554
627
|
const msg = err instanceof Error ? err.message : String(err);
|
|
555
628
|
return { success: false, error: msg };
|
|
@@ -738,8 +811,8 @@ var parameters2 = {
|
|
|
738
811
|
|
|
739
812
|
// ../connectors/src/connectors/snowflake-pat/tools/execute-query.ts
|
|
740
813
|
import { z as z2 } from "zod";
|
|
741
|
-
var
|
|
742
|
-
var
|
|
814
|
+
var MAX_ROWS = 500;
|
|
815
|
+
var QUERY_TIMEOUT_MS = 6e4;
|
|
743
816
|
var inputSchema2 = z2.object({
|
|
744
817
|
toolUseIntent: z2.string().optional().describe(
|
|
745
818
|
"Brief description of what you intend to accomplish with this tool call"
|
|
@@ -763,7 +836,7 @@ var outputSchema2 = z2.discriminatedUnion("success", [
|
|
|
763
836
|
]);
|
|
764
837
|
var executeQueryTool2 = new ConnectorTool({
|
|
765
838
|
name: "executeQuery",
|
|
766
|
-
description: `Execute SQL against Snowflake. Returns up to ${
|
|
839
|
+
description: `Execute SQL against Snowflake. Returns up to ${MAX_ROWS} rows.
|
|
767
840
|
Use for: schema exploration (SHOW DATABASES/SCHEMAS/TABLES, DESCRIBE TABLE, INFORMATION_SCHEMA), data sampling, analytical queries.
|
|
768
841
|
Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
769
842
|
inputSchema: inputSchema2,
|
|
@@ -809,7 +882,7 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
809
882
|
"Snowflake query timeout: query exceeded 60 seconds"
|
|
810
883
|
)
|
|
811
884
|
);
|
|
812
|
-
},
|
|
885
|
+
}, QUERY_TIMEOUT_MS);
|
|
813
886
|
conn.execute({
|
|
814
887
|
sqlText: sql,
|
|
815
888
|
complete: (err, _stmt, rows) => {
|
|
@@ -827,12 +900,12 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
827
900
|
`[connector-query] Snowflake destroy error: ${err.message}`
|
|
828
901
|
);
|
|
829
902
|
});
|
|
830
|
-
const truncated = allRows.length >
|
|
903
|
+
const truncated = allRows.length > MAX_ROWS;
|
|
831
904
|
return {
|
|
832
905
|
success: true,
|
|
833
|
-
rowCount: Math.min(allRows.length,
|
|
906
|
+
rowCount: Math.min(allRows.length, MAX_ROWS),
|
|
834
907
|
truncated,
|
|
835
|
-
rows: allRows.slice(0,
|
|
908
|
+
rows: allRows.slice(0, MAX_ROWS)
|
|
836
909
|
};
|
|
837
910
|
} catch (err) {
|
|
838
911
|
const msg = err instanceof Error ? err.message : String(err);
|
|
@@ -1166,7 +1239,7 @@ var POSTGRES_DEFAULT_PORT = 5432;
|
|
|
1166
1239
|
|
|
1167
1240
|
// ../connectors/src/connectors/postgresql/tools/execute-query.ts
|
|
1168
1241
|
import { z as z3 } from "zod";
|
|
1169
|
-
var
|
|
1242
|
+
var MAX_ROWS2 = 500;
|
|
1170
1243
|
var CONNECT_TIMEOUT_MS = 1e4;
|
|
1171
1244
|
var STATEMENT_TIMEOUT_MS = 6e4;
|
|
1172
1245
|
var inputSchema3 = z3.object({
|
|
@@ -1190,7 +1263,7 @@ var outputSchema3 = z3.discriminatedUnion("success", [
|
|
|
1190
1263
|
]);
|
|
1191
1264
|
var executeQueryTool3 = new ConnectorTool({
|
|
1192
1265
|
name: "executeQuery",
|
|
1193
|
-
description: `Execute SQL against PostgreSQL. Returns up to ${
|
|
1266
|
+
description: `Execute SQL against PostgreSQL. Returns up to ${MAX_ROWS2} rows.
|
|
1194
1267
|
Use for: schema exploration (information_schema), data sampling, analytical queries.
|
|
1195
1268
|
Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
1196
1269
|
inputSchema: inputSchema3,
|
|
@@ -1228,12 +1301,12 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
1228
1301
|
STATEMENT_TIMEOUT_MS
|
|
1229
1302
|
);
|
|
1230
1303
|
const rows = result.rows;
|
|
1231
|
-
const truncated = rows.length >
|
|
1304
|
+
const truncated = rows.length > MAX_ROWS2;
|
|
1232
1305
|
return {
|
|
1233
1306
|
success: true,
|
|
1234
|
-
rowCount: Math.min(rows.length,
|
|
1307
|
+
rowCount: Math.min(rows.length, MAX_ROWS2),
|
|
1235
1308
|
truncated,
|
|
1236
|
-
rows: rows.slice(0,
|
|
1309
|
+
rows: rows.slice(0, MAX_ROWS2)
|
|
1237
1310
|
};
|
|
1238
1311
|
} finally {
|
|
1239
1312
|
await pool.end();
|
|
@@ -1370,9 +1443,9 @@ var MYSQL_DEFAULT_PORT = 3306;
|
|
|
1370
1443
|
|
|
1371
1444
|
// ../connectors/src/connectors/mysql/tools/execute-query.ts
|
|
1372
1445
|
import { z as z4 } from "zod";
|
|
1373
|
-
var
|
|
1446
|
+
var MAX_ROWS3 = 500;
|
|
1374
1447
|
var CONNECT_TIMEOUT_MS2 = 1e4;
|
|
1375
|
-
var
|
|
1448
|
+
var QUERY_TIMEOUT_MS2 = 6e4;
|
|
1376
1449
|
var inputSchema4 = z4.object({
|
|
1377
1450
|
toolUseIntent: z4.string().optional().describe(
|
|
1378
1451
|
"Brief description of what you intend to accomplish with this tool call"
|
|
@@ -1394,7 +1467,7 @@ var outputSchema4 = z4.discriminatedUnion("success", [
|
|
|
1394
1467
|
]);
|
|
1395
1468
|
var executeQueryTool4 = new ConnectorTool({
|
|
1396
1469
|
name: "executeQuery",
|
|
1397
|
-
description: `Execute SQL against MySQL. Returns up to ${
|
|
1470
|
+
description: `Execute SQL against MySQL. Returns up to ${MAX_ROWS3} rows.
|
|
1398
1471
|
Use for: schema exploration (information_schema), data sampling, analytical queries.
|
|
1399
1472
|
Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
1400
1473
|
inputSchema: inputSchema4,
|
|
@@ -1427,16 +1500,16 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
1427
1500
|
try {
|
|
1428
1501
|
const queryPromise = pool.query(sql);
|
|
1429
1502
|
const timeoutPromise = new Promise(
|
|
1430
|
-
(_, reject) => setTimeout(() => reject(new Error("Query timed out after 60 seconds")),
|
|
1503
|
+
(_, reject) => setTimeout(() => reject(new Error("Query timed out after 60 seconds")), QUERY_TIMEOUT_MS2)
|
|
1431
1504
|
);
|
|
1432
1505
|
const [rows] = await Promise.race([queryPromise, timeoutPromise]);
|
|
1433
1506
|
const resultRows = Array.isArray(rows) ? rows : [];
|
|
1434
|
-
const truncated = resultRows.length >
|
|
1507
|
+
const truncated = resultRows.length > MAX_ROWS3;
|
|
1435
1508
|
return {
|
|
1436
1509
|
success: true,
|
|
1437
|
-
rowCount: Math.min(resultRows.length,
|
|
1510
|
+
rowCount: Math.min(resultRows.length, MAX_ROWS3),
|
|
1438
1511
|
truncated,
|
|
1439
|
-
rows: resultRows.slice(0,
|
|
1512
|
+
rows: resultRows.slice(0, MAX_ROWS3)
|
|
1440
1513
|
};
|
|
1441
1514
|
} finally {
|
|
1442
1515
|
await pool.end();
|
|
@@ -1763,7 +1836,7 @@ var bigqueryOnboarding = new ConnectorOnboarding({
|
|
|
1763
1836
|
|
|
1764
1837
|
// ../connectors/src/connectors/bigquery/tools/execute-query.ts
|
|
1765
1838
|
import { z as z7 } from "zod";
|
|
1766
|
-
var
|
|
1839
|
+
var MAX_ROWS4 = 500;
|
|
1767
1840
|
var inputSchema7 = z7.object({
|
|
1768
1841
|
toolUseIntent: z7.string().optional().describe(
|
|
1769
1842
|
"Brief description of what you intend to accomplish with this tool call"
|
|
@@ -1787,7 +1860,7 @@ var outputSchema7 = z7.discriminatedUnion("success", [
|
|
|
1787
1860
|
]);
|
|
1788
1861
|
var executeQueryTool5 = new ConnectorTool({
|
|
1789
1862
|
name: "executeQuery",
|
|
1790
|
-
description: `Execute SQL against BigQuery. Returns up to ${
|
|
1863
|
+
description: `Execute SQL against BigQuery. Returns up to ${MAX_ROWS4} rows.
|
|
1791
1864
|
Use for: schema exploration (INFORMATION_SCHEMA), data sampling, analytical queries.
|
|
1792
1865
|
Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
1793
1866
|
inputSchema: inputSchema7,
|
|
@@ -1814,12 +1887,12 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
1814
1887
|
const [job] = await bq.createQueryJob({ query: sql });
|
|
1815
1888
|
const [rows] = await job.getQueryResults();
|
|
1816
1889
|
const allRows = rows;
|
|
1817
|
-
const truncated = allRows.length >
|
|
1890
|
+
const truncated = allRows.length > MAX_ROWS4;
|
|
1818
1891
|
return {
|
|
1819
1892
|
success: true,
|
|
1820
|
-
rowCount: Math.min(allRows.length,
|
|
1893
|
+
rowCount: Math.min(allRows.length, MAX_ROWS4),
|
|
1821
1894
|
truncated,
|
|
1822
|
-
rows: allRows.slice(0,
|
|
1895
|
+
rows: allRows.slice(0, MAX_ROWS4)
|
|
1823
1896
|
};
|
|
1824
1897
|
} catch (err) {
|
|
1825
1898
|
const msg = err instanceof Error ? err.message : String(err);
|
|
@@ -2220,7 +2293,7 @@ var bigqueryOnboarding2 = new ConnectorOnboarding({
|
|
|
2220
2293
|
|
|
2221
2294
|
// ../connectors/src/connectors/bigquery-oauth/tools/execute-query.ts
|
|
2222
2295
|
import { z as z10 } from "zod";
|
|
2223
|
-
var
|
|
2296
|
+
var MAX_ROWS5 = 500;
|
|
2224
2297
|
var REQUEST_TIMEOUT_MS3 = 6e4;
|
|
2225
2298
|
var cachedToken3 = null;
|
|
2226
2299
|
async function getProxyToken3(config) {
|
|
@@ -2287,7 +2360,7 @@ function parseQueryResponse(data) {
|
|
|
2287
2360
|
}
|
|
2288
2361
|
var executeQueryTool6 = new ConnectorTool({
|
|
2289
2362
|
name: "executeQuery",
|
|
2290
|
-
description: `Execute SQL against BigQuery via OAuth. Returns up to ${
|
|
2363
|
+
description: `Execute SQL against BigQuery via OAuth. Returns up to ${MAX_ROWS5} rows.
|
|
2291
2364
|
Use for: schema exploration (INFORMATION_SCHEMA), data sampling, analytical queries.
|
|
2292
2365
|
Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
2293
2366
|
inputSchema: inputSchema10,
|
|
@@ -2320,7 +2393,7 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
2320
2393
|
body: JSON.stringify({
|
|
2321
2394
|
url: queryUrl,
|
|
2322
2395
|
method: "POST",
|
|
2323
|
-
body: { query: sql, useLegacySql: false, maxResults:
|
|
2396
|
+
body: { query: sql, useLegacySql: false, maxResults: MAX_ROWS5 }
|
|
2324
2397
|
}),
|
|
2325
2398
|
signal: controller.signal
|
|
2326
2399
|
});
|
|
@@ -2330,12 +2403,12 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
2330
2403
|
return { success: false, error: errorMessage };
|
|
2331
2404
|
}
|
|
2332
2405
|
const rows = parseQueryResponse(data);
|
|
2333
|
-
const truncated = rows.length >
|
|
2406
|
+
const truncated = rows.length > MAX_ROWS5;
|
|
2334
2407
|
return {
|
|
2335
2408
|
success: true,
|
|
2336
|
-
rowCount: Math.min(rows.length,
|
|
2409
|
+
rowCount: Math.min(rows.length, MAX_ROWS5),
|
|
2337
2410
|
truncated,
|
|
2338
|
-
rows: rows.slice(0,
|
|
2411
|
+
rows: rows.slice(0, MAX_ROWS5)
|
|
2339
2412
|
};
|
|
2340
2413
|
} finally {
|
|
2341
2414
|
clearTimeout(timeout);
|
|
@@ -2515,7 +2588,7 @@ var parameters7 = {
|
|
|
2515
2588
|
|
|
2516
2589
|
// ../connectors/src/connectors/aws-athena/tools/execute-query.ts
|
|
2517
2590
|
import { z as z11 } from "zod";
|
|
2518
|
-
var
|
|
2591
|
+
var MAX_ROWS6 = 500;
|
|
2519
2592
|
var POLL_INTERVAL_MS = 1e3;
|
|
2520
2593
|
var POLL_TIMEOUT_MS = 12e4;
|
|
2521
2594
|
var inputSchema11 = z11.object({
|
|
@@ -2539,7 +2612,7 @@ var outputSchema11 = z11.discriminatedUnion("success", [
|
|
|
2539
2612
|
]);
|
|
2540
2613
|
var executeQueryTool7 = new ConnectorTool({
|
|
2541
2614
|
name: "executeQuery",
|
|
2542
|
-
description: `Execute SQL against AWS Athena. Returns up to ${
|
|
2615
|
+
description: `Execute SQL against AWS Athena. Returns up to ${MAX_ROWS6} rows.
|
|
2543
2616
|
Use for: schema exploration (SHOW DATABASES/TABLES, DESCRIBE TABLE), data sampling, analytical queries on S3 data.
|
|
2544
2617
|
Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
2545
2618
|
inputSchema: inputSchema11,
|
|
@@ -2616,12 +2689,12 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
2616
2689
|
});
|
|
2617
2690
|
return obj;
|
|
2618
2691
|
});
|
|
2619
|
-
const truncated = dataRows.length >
|
|
2692
|
+
const truncated = dataRows.length > MAX_ROWS6;
|
|
2620
2693
|
return {
|
|
2621
2694
|
success: true,
|
|
2622
|
-
rowCount: Math.min(dataRows.length,
|
|
2695
|
+
rowCount: Math.min(dataRows.length, MAX_ROWS6),
|
|
2623
2696
|
truncated,
|
|
2624
|
-
rows: dataRows.slice(0,
|
|
2697
|
+
rows: dataRows.slice(0, MAX_ROWS6)
|
|
2625
2698
|
};
|
|
2626
2699
|
} catch (err) {
|
|
2627
2700
|
const msg = err instanceof Error ? err.message : String(err);
|
|
@@ -3536,7 +3609,7 @@ var parameters9 = {
|
|
|
3536
3609
|
|
|
3537
3610
|
// ../connectors/src/connectors/redshift/tools/execute-query.ts
|
|
3538
3611
|
import { z as z15 } from "zod";
|
|
3539
|
-
var
|
|
3612
|
+
var MAX_ROWS7 = 500;
|
|
3540
3613
|
var POLL_INTERVAL_MS2 = 1e3;
|
|
3541
3614
|
var POLL_TIMEOUT_MS2 = 12e4;
|
|
3542
3615
|
var inputSchema15 = z15.object({
|
|
@@ -3562,7 +3635,7 @@ var outputSchema15 = z15.discriminatedUnion("success", [
|
|
|
3562
3635
|
]);
|
|
3563
3636
|
var executeQueryTool8 = new ConnectorTool({
|
|
3564
3637
|
name: "executeQuery",
|
|
3565
|
-
description: `Execute SQL against Amazon Redshift. Returns up to ${
|
|
3638
|
+
description: `Execute SQL against Amazon Redshift. Returns up to ${MAX_ROWS7} rows.
|
|
3566
3639
|
Use for: schema exploration, data sampling, analytical queries.
|
|
3567
3640
|
Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
3568
3641
|
inputSchema: inputSchema15,
|
|
@@ -3641,12 +3714,12 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
3641
3714
|
});
|
|
3642
3715
|
return row;
|
|
3643
3716
|
});
|
|
3644
|
-
const truncated = allRows.length >
|
|
3717
|
+
const truncated = allRows.length > MAX_ROWS7;
|
|
3645
3718
|
return {
|
|
3646
3719
|
success: true,
|
|
3647
|
-
rowCount: Math.min(allRows.length,
|
|
3720
|
+
rowCount: Math.min(allRows.length, MAX_ROWS7),
|
|
3648
3721
|
truncated,
|
|
3649
|
-
rows: allRows.slice(0,
|
|
3722
|
+
rows: allRows.slice(0, MAX_ROWS7)
|
|
3650
3723
|
};
|
|
3651
3724
|
} catch (err) {
|
|
3652
3725
|
const msg = err instanceof Error ? err.message : String(err);
|
|
@@ -3867,7 +3940,7 @@ var parameters10 = {
|
|
|
3867
3940
|
|
|
3868
3941
|
// ../connectors/src/connectors/databricks/tools/execute-query.ts
|
|
3869
3942
|
import { z as z16 } from "zod";
|
|
3870
|
-
var
|
|
3943
|
+
var MAX_ROWS8 = 500;
|
|
3871
3944
|
var inputSchema16 = z16.object({
|
|
3872
3945
|
toolUseIntent: z16.string().optional().describe(
|
|
3873
3946
|
"Brief description of what you intend to accomplish with this tool call"
|
|
@@ -3889,7 +3962,7 @@ var outputSchema16 = z16.discriminatedUnion("success", [
|
|
|
3889
3962
|
]);
|
|
3890
3963
|
var executeQueryTool9 = new ConnectorTool({
|
|
3891
3964
|
name: "executeQuery",
|
|
3892
|
-
description: `Execute SQL against Databricks. Returns up to ${
|
|
3965
|
+
description: `Execute SQL against Databricks. Returns up to ${MAX_ROWS8} rows.
|
|
3893
3966
|
Use for: schema exploration (SHOW CATALOGS/DATABASES/TABLES, DESCRIBE TABLE), data sampling, analytical queries.
|
|
3894
3967
|
Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
3895
3968
|
inputSchema: inputSchema16,
|
|
@@ -3920,12 +3993,12 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
3920
3993
|
runAsync: true
|
|
3921
3994
|
});
|
|
3922
3995
|
const allRows = await operation.fetchAll();
|
|
3923
|
-
const truncated = allRows.length >
|
|
3996
|
+
const truncated = allRows.length > MAX_ROWS8;
|
|
3924
3997
|
return {
|
|
3925
3998
|
success: true,
|
|
3926
|
-
rowCount: Math.min(allRows.length,
|
|
3999
|
+
rowCount: Math.min(allRows.length, MAX_ROWS8),
|
|
3927
4000
|
truncated,
|
|
3928
|
-
rows: allRows.slice(0,
|
|
4001
|
+
rows: allRows.slice(0, MAX_ROWS8)
|
|
3929
4002
|
};
|
|
3930
4003
|
} finally {
|
|
3931
4004
|
if (operation) await operation.close().catch(() => {
|
|
@@ -10870,7 +10943,7 @@ var parameters29 = {
|
|
|
10870
10943
|
|
|
10871
10944
|
// ../connectors/src/connectors/squadbase-db/tools/execute-query.ts
|
|
10872
10945
|
import { z as z40 } from "zod";
|
|
10873
|
-
var
|
|
10946
|
+
var MAX_ROWS9 = 500;
|
|
10874
10947
|
var CONNECT_TIMEOUT_MS3 = 1e4;
|
|
10875
10948
|
var STATEMENT_TIMEOUT_MS2 = 6e4;
|
|
10876
10949
|
var inputSchema40 = z40.object({
|
|
@@ -10894,7 +10967,7 @@ var outputSchema40 = z40.discriminatedUnion("success", [
|
|
|
10894
10967
|
]);
|
|
10895
10968
|
var executeQueryTool10 = new ConnectorTool({
|
|
10896
10969
|
name: "executeQuery",
|
|
10897
|
-
description: `Execute SQL against Squadbase DB (PostgreSQL). Returns up to ${
|
|
10970
|
+
description: `Execute SQL against Squadbase DB (PostgreSQL). Returns up to ${MAX_ROWS9} rows.
|
|
10898
10971
|
Use for: schema exploration (information_schema), data sampling, analytical queries.
|
|
10899
10972
|
Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
10900
10973
|
inputSchema: inputSchema40,
|
|
@@ -10923,12 +10996,12 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
10923
10996
|
try {
|
|
10924
10997
|
const result = await pool.query(sql);
|
|
10925
10998
|
const rows = result.rows;
|
|
10926
|
-
const truncated = rows.length >
|
|
10999
|
+
const truncated = rows.length > MAX_ROWS9;
|
|
10927
11000
|
return {
|
|
10928
11001
|
success: true,
|
|
10929
|
-
rowCount: Math.min(rows.length,
|
|
11002
|
+
rowCount: Math.min(rows.length, MAX_ROWS9),
|
|
10930
11003
|
truncated,
|
|
10931
|
-
rows: rows.slice(0,
|
|
11004
|
+
rows: rows.slice(0, MAX_ROWS9)
|
|
10932
11005
|
};
|
|
10933
11006
|
} finally {
|
|
10934
11007
|
await pool.end();
|
|
@@ -13702,8 +13775,8 @@ var parameters41 = {
|
|
|
13702
13775
|
|
|
13703
13776
|
// ../connectors/src/connectors/clickhouse/tools/execute-query.ts
|
|
13704
13777
|
import { z as z49 } from "zod";
|
|
13705
|
-
var
|
|
13706
|
-
var
|
|
13778
|
+
var MAX_ROWS10 = 500;
|
|
13779
|
+
var QUERY_TIMEOUT_MS3 = 6e4;
|
|
13707
13780
|
var inputSchema49 = z49.object({
|
|
13708
13781
|
toolUseIntent: z49.string().optional().describe(
|
|
13709
13782
|
"Brief description of what you intend to accomplish with this tool call"
|
|
@@ -13725,7 +13798,7 @@ var outputSchema49 = z49.discriminatedUnion("success", [
|
|
|
13725
13798
|
]);
|
|
13726
13799
|
var executeQueryTool11 = new ConnectorTool({
|
|
13727
13800
|
name: "executeQuery",
|
|
13728
|
-
description: `Execute SQL against ClickHouse. Returns up to ${
|
|
13801
|
+
description: `Execute SQL against ClickHouse. Returns up to ${MAX_ROWS10} rows.
|
|
13729
13802
|
Use for: schema exploration (SHOW DATABASES, SHOW TABLES, DESCRIBE TABLE), data sampling, analytical queries on large-scale columnar data.
|
|
13730
13803
|
Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
13731
13804
|
inputSchema: inputSchema49,
|
|
@@ -13753,7 +13826,7 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
13753
13826
|
username,
|
|
13754
13827
|
password: password || "",
|
|
13755
13828
|
database: database || "default",
|
|
13756
|
-
request_timeout:
|
|
13829
|
+
request_timeout: QUERY_TIMEOUT_MS3
|
|
13757
13830
|
});
|
|
13758
13831
|
try {
|
|
13759
13832
|
const resultSet = await client.query({
|
|
@@ -13761,12 +13834,12 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
13761
13834
|
format: "JSONEachRow"
|
|
13762
13835
|
});
|
|
13763
13836
|
const allRows = await resultSet.json();
|
|
13764
|
-
const truncated = allRows.length >
|
|
13837
|
+
const truncated = allRows.length > MAX_ROWS10;
|
|
13765
13838
|
return {
|
|
13766
13839
|
success: true,
|
|
13767
|
-
rowCount: Math.min(allRows.length,
|
|
13840
|
+
rowCount: Math.min(allRows.length, MAX_ROWS10),
|
|
13768
13841
|
truncated,
|
|
13769
|
-
rows: allRows.slice(0,
|
|
13842
|
+
rows: allRows.slice(0, MAX_ROWS10)
|
|
13770
13843
|
};
|
|
13771
13844
|
} finally {
|
|
13772
13845
|
await client.close();
|
|
@@ -13922,7 +13995,7 @@ var parameters42 = {
|
|
|
13922
13995
|
import { z as z50 } from "zod";
|
|
13923
13996
|
var MAX_DOCUMENTS = 500;
|
|
13924
13997
|
var CONNECT_TIMEOUT_MS4 = 1e4;
|
|
13925
|
-
var
|
|
13998
|
+
var QUERY_TIMEOUT_MS4 = 6e4;
|
|
13926
13999
|
var inputSchema50 = z50.object({
|
|
13927
14000
|
toolUseIntent: z50.string().optional().describe(
|
|
13928
14001
|
"Brief description of what you intend to accomplish with this tool call"
|
|
@@ -13981,7 +14054,7 @@ For listing collections, use the aggregate tool with an empty pipeline on the sp
|
|
|
13981
14054
|
const client = new MongoClient(connectionUrl, {
|
|
13982
14055
|
connectTimeoutMS: CONNECT_TIMEOUT_MS4,
|
|
13983
14056
|
serverSelectionTimeoutMS: CONNECT_TIMEOUT_MS4,
|
|
13984
|
-
socketTimeoutMS:
|
|
14057
|
+
socketTimeoutMS: QUERY_TIMEOUT_MS4
|
|
13985
14058
|
});
|
|
13986
14059
|
try {
|
|
13987
14060
|
await client.connect();
|
|
@@ -14027,7 +14100,7 @@ For listing collections, use the aggregate tool with an empty pipeline on the sp
|
|
|
14027
14100
|
import { z as z51 } from "zod";
|
|
14028
14101
|
var MAX_DOCUMENTS2 = 500;
|
|
14029
14102
|
var CONNECT_TIMEOUT_MS5 = 1e4;
|
|
14030
|
-
var
|
|
14103
|
+
var QUERY_TIMEOUT_MS5 = 6e4;
|
|
14031
14104
|
var inputSchema51 = z51.object({
|
|
14032
14105
|
toolUseIntent: z51.string().optional().describe(
|
|
14033
14106
|
"Brief description of what you intend to accomplish with this tool call"
|
|
@@ -14078,7 +14151,7 @@ Common stages: $match (filter), $group (aggregate), $sort (order), $project (res
|
|
|
14078
14151
|
const client = new MongoClient(connectionUrl, {
|
|
14079
14152
|
connectTimeoutMS: CONNECT_TIMEOUT_MS5,
|
|
14080
14153
|
serverSelectionTimeoutMS: CONNECT_TIMEOUT_MS5,
|
|
14081
|
-
socketTimeoutMS:
|
|
14154
|
+
socketTimeoutMS: QUERY_TIMEOUT_MS5
|
|
14082
14155
|
});
|
|
14083
14156
|
try {
|
|
14084
14157
|
await client.connect();
|
|
@@ -23307,7 +23380,7 @@ function redactJdbcUrl(jdbcUrl) {
|
|
|
23307
23380
|
}
|
|
23308
23381
|
|
|
23309
23382
|
// ../connectors/src/connectors/jdbc/tools/execute-query.ts
|
|
23310
|
-
var
|
|
23383
|
+
var MAX_ROWS11 = 500;
|
|
23311
23384
|
var CONNECT_TIMEOUT_MS7 = 1e4;
|
|
23312
23385
|
var STATEMENT_TIMEOUT_MS3 = 6e4;
|
|
23313
23386
|
var inputSchema82 = z82.object({
|
|
@@ -23333,7 +23406,7 @@ var outputSchema82 = z82.discriminatedUnion("success", [
|
|
|
23333
23406
|
]);
|
|
23334
23407
|
var executeQueryTool12 = new ConnectorTool({
|
|
23335
23408
|
name: "executeQuery",
|
|
23336
|
-
description: `Execute a SQL query through the JDBC connector. Returns up to ${
|
|
23409
|
+
description: `Execute a SQL query through the JDBC connector. Returns up to ${MAX_ROWS11} rows.
|
|
23337
23410
|
Use for: schema exploration via \`information_schema\` (or USER_TABLES on Oracle), data sampling, analytical queries.
|
|
23338
23411
|
The connector dispatches by JDBC URL prefix to the matching driver
|
|
23339
23412
|
(PostgreSQL / Redshift / MySQL / MariaDB / SQL Server / Oracle), so use the dialect that matches the connection.
|
|
@@ -23374,9 +23447,9 @@ Always bound results: LIMIT for PG/MySQL/Redshift, TOP for SQL Server, FETCH FIR
|
|
|
23374
23447
|
const rows = result.rows;
|
|
23375
23448
|
return {
|
|
23376
23449
|
success: true,
|
|
23377
|
-
rowCount: Math.min(rows.length,
|
|
23378
|
-
truncated: rows.length >
|
|
23379
|
-
rows: rows.slice(0,
|
|
23450
|
+
rowCount: Math.min(rows.length, MAX_ROWS11),
|
|
23451
|
+
truncated: rows.length > MAX_ROWS11,
|
|
23452
|
+
rows: rows.slice(0, MAX_ROWS11)
|
|
23380
23453
|
};
|
|
23381
23454
|
}
|
|
23382
23455
|
if (parsed.driver === "oracle") {
|
|
@@ -23391,9 +23464,9 @@ Always bound results: LIMIT for PG/MySQL/Redshift, TOP for SQL Server, FETCH FIR
|
|
|
23391
23464
|
const rows = result.rows;
|
|
23392
23465
|
return {
|
|
23393
23466
|
success: true,
|
|
23394
|
-
rowCount: Math.min(rows.length,
|
|
23395
|
-
truncated: rows.length >
|
|
23396
|
-
rows: rows.slice(0,
|
|
23467
|
+
rowCount: Math.min(rows.length, MAX_ROWS11),
|
|
23468
|
+
truncated: rows.length > MAX_ROWS11,
|
|
23469
|
+
rows: rows.slice(0, MAX_ROWS11)
|
|
23397
23470
|
};
|
|
23398
23471
|
}
|
|
23399
23472
|
let tunnel;
|
|
@@ -23417,12 +23490,12 @@ Always bound results: LIMIT for PG/MySQL/Redshift, TOP for SQL Server, FETCH FIR
|
|
|
23417
23490
|
STATEMENT_TIMEOUT_MS3
|
|
23418
23491
|
);
|
|
23419
23492
|
const rows = result.rows;
|
|
23420
|
-
const truncated = rows.length >
|
|
23493
|
+
const truncated = rows.length > MAX_ROWS11;
|
|
23421
23494
|
return {
|
|
23422
23495
|
success: true,
|
|
23423
|
-
rowCount: Math.min(rows.length,
|
|
23496
|
+
rowCount: Math.min(rows.length, MAX_ROWS11),
|
|
23424
23497
|
truncated,
|
|
23425
|
-
rows: rows.slice(0,
|
|
23498
|
+
rows: rows.slice(0, MAX_ROWS11)
|
|
23426
23499
|
};
|
|
23427
23500
|
} finally {
|
|
23428
23501
|
await pool2.end();
|
|
@@ -23443,12 +23516,12 @@ Always bound results: LIMIT for PG/MySQL/Redshift, TOP for SQL Server, FETCH FIR
|
|
|
23443
23516
|
);
|
|
23444
23517
|
const [rows] = await Promise.race([queryPromise, timeoutPromise]);
|
|
23445
23518
|
const resultRows = Array.isArray(rows) ? rows : [];
|
|
23446
|
-
const truncated = resultRows.length >
|
|
23519
|
+
const truncated = resultRows.length > MAX_ROWS11;
|
|
23447
23520
|
return {
|
|
23448
23521
|
success: true,
|
|
23449
|
-
rowCount: Math.min(resultRows.length,
|
|
23522
|
+
rowCount: Math.min(resultRows.length, MAX_ROWS11),
|
|
23450
23523
|
truncated,
|
|
23451
|
-
rows: resultRows.slice(0,
|
|
23524
|
+
rows: resultRows.slice(0, MAX_ROWS11)
|
|
23452
23525
|
};
|
|
23453
23526
|
} finally {
|
|
23454
23527
|
await pool.end();
|
|
@@ -24717,7 +24790,7 @@ var parameters70 = {
|
|
|
24717
24790
|
|
|
24718
24791
|
// ../connectors/src/connectors/supabase/tools/execute-query.ts
|
|
24719
24792
|
import { z as z86 } from "zod";
|
|
24720
|
-
var
|
|
24793
|
+
var MAX_ROWS12 = 500;
|
|
24721
24794
|
var CONNECT_TIMEOUT_MS8 = 1e4;
|
|
24722
24795
|
var STATEMENT_TIMEOUT_MS4 = 6e4;
|
|
24723
24796
|
var inputSchema86 = z86.object({
|
|
@@ -24743,7 +24816,7 @@ var outputSchema86 = z86.discriminatedUnion("success", [
|
|
|
24743
24816
|
]);
|
|
24744
24817
|
var executeQueryTool13 = new ConnectorTool({
|
|
24745
24818
|
name: "executeQuery",
|
|
24746
|
-
description: `Execute SQL against a Supabase Postgres database. Returns up to ${
|
|
24819
|
+
description: `Execute SQL against a Supabase Postgres database. Returns up to ${MAX_ROWS12} rows.
|
|
24747
24820
|
Use for: schema exploration (information_schema), data sampling, and analytical queries against Supabase tables.
|
|
24748
24821
|
User tables live in the \`public\` schema by default; Supabase-managed metadata lives in \`auth\` and \`storage\`.
|
|
24749
24822
|
Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
@@ -24773,12 +24846,12 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
24773
24846
|
try {
|
|
24774
24847
|
const result = await pool.query(sql);
|
|
24775
24848
|
const rows = result.rows;
|
|
24776
|
-
const truncated = rows.length >
|
|
24849
|
+
const truncated = rows.length > MAX_ROWS12;
|
|
24777
24850
|
return {
|
|
24778
24851
|
success: true,
|
|
24779
|
-
rowCount: Math.min(rows.length,
|
|
24852
|
+
rowCount: Math.min(rows.length, MAX_ROWS12),
|
|
24780
24853
|
truncated,
|
|
24781
|
-
rows: rows.slice(0,
|
|
24854
|
+
rows: rows.slice(0, MAX_ROWS12)
|
|
24782
24855
|
};
|
|
24783
24856
|
} finally {
|
|
24784
24857
|
await pool.end();
|
|
@@ -25257,7 +25330,7 @@ var parameters72 = {
|
|
|
25257
25330
|
|
|
25258
25331
|
// ../connectors/src/connectors/sqlserver/tools/execute-query.ts
|
|
25259
25332
|
import { z as z88 } from "zod";
|
|
25260
|
-
var
|
|
25333
|
+
var MAX_ROWS13 = 500;
|
|
25261
25334
|
var inputSchema88 = z88.object({
|
|
25262
25335
|
toolUseIntent: z88.string().optional().describe(
|
|
25263
25336
|
"Brief description of what you intend to accomplish with this tool call"
|
|
@@ -25281,7 +25354,7 @@ var outputSchema88 = z88.discriminatedUnion("success", [
|
|
|
25281
25354
|
]);
|
|
25282
25355
|
var executeQueryTool14 = new ConnectorTool({
|
|
25283
25356
|
name: "executeQuery",
|
|
25284
|
-
description: `Execute a T-SQL query against Microsoft SQL Server. Returns up to ${
|
|
25357
|
+
description: `Execute a T-SQL query against Microsoft SQL Server. Returns up to ${MAX_ROWS13} rows.
|
|
25285
25358
|
Use for: schema exploration via \`INFORMATION_SCHEMA\`, data sampling, and analytical queries.
|
|
25286
25359
|
SQL Server uses \`TOP n\` instead of \`LIMIT n\`. Identifiers can be wrapped in square brackets (\`[schema].[table]\`).
|
|
25287
25360
|
Avoid loading large amounts of data; always include \`TOP\` in queries.`,
|
|
@@ -25314,12 +25387,12 @@ Avoid loading large amounts of data; always include \`TOP\` in queries.`,
|
|
|
25314
25387
|
const { rows } = await runMssqlQuery(parsed, sql, {
|
|
25315
25388
|
tunnelParams: connectionParamsToRecord(connection)
|
|
25316
25389
|
});
|
|
25317
|
-
const truncated = rows.length >
|
|
25390
|
+
const truncated = rows.length > MAX_ROWS13;
|
|
25318
25391
|
return {
|
|
25319
25392
|
success: true,
|
|
25320
|
-
rowCount: Math.min(rows.length,
|
|
25393
|
+
rowCount: Math.min(rows.length, MAX_ROWS13),
|
|
25321
25394
|
truncated,
|
|
25322
|
-
rows: rows.slice(0,
|
|
25395
|
+
rows: rows.slice(0, MAX_ROWS13)
|
|
25323
25396
|
};
|
|
25324
25397
|
} catch (err) {
|
|
25325
25398
|
let msg = err instanceof Error ? err.message : String(err);
|
|
@@ -25452,7 +25525,7 @@ var parameters73 = {
|
|
|
25452
25525
|
|
|
25453
25526
|
// ../connectors/src/connectors/azure-sql/tools/execute-query.ts
|
|
25454
25527
|
import { z as z89 } from "zod";
|
|
25455
|
-
var
|
|
25528
|
+
var MAX_ROWS14 = 500;
|
|
25456
25529
|
var inputSchema89 = z89.object({
|
|
25457
25530
|
toolUseIntent: z89.string().optional().describe(
|
|
25458
25531
|
"Brief description of what you intend to accomplish with this tool call"
|
|
@@ -25476,7 +25549,7 @@ var outputSchema89 = z89.discriminatedUnion("success", [
|
|
|
25476
25549
|
]);
|
|
25477
25550
|
var executeQueryTool15 = new ConnectorTool({
|
|
25478
25551
|
name: "executeQuery",
|
|
25479
|
-
description: `Execute a T-SQL query against Azure SQL Database. Returns up to ${
|
|
25552
|
+
description: `Execute a T-SQL query against Azure SQL Database. Returns up to ${MAX_ROWS14} rows.
|
|
25480
25553
|
Use for: schema exploration via \`INFORMATION_SCHEMA\`, data sampling, and analytical queries.
|
|
25481
25554
|
Azure SQL is T-SQL: use \`TOP n\` instead of \`LIMIT n\`. Identifiers can be wrapped in square brackets.
|
|
25482
25555
|
Avoid loading large amounts of data; always include \`TOP\` in queries.`,
|
|
@@ -25510,12 +25583,12 @@ Avoid loading large amounts of data; always include \`TOP\` in queries.`,
|
|
|
25510
25583
|
forceEncrypt: true,
|
|
25511
25584
|
tunnelParams: connectionParamsToRecord(connection)
|
|
25512
25585
|
});
|
|
25513
|
-
const truncated = rows.length >
|
|
25586
|
+
const truncated = rows.length > MAX_ROWS14;
|
|
25514
25587
|
return {
|
|
25515
25588
|
success: true,
|
|
25516
|
-
rowCount: Math.min(rows.length,
|
|
25589
|
+
rowCount: Math.min(rows.length, MAX_ROWS14),
|
|
25517
25590
|
truncated,
|
|
25518
|
-
rows: rows.slice(0,
|
|
25591
|
+
rows: rows.slice(0, MAX_ROWS14)
|
|
25519
25592
|
};
|
|
25520
25593
|
} catch (err) {
|
|
25521
25594
|
let msg = err instanceof Error ? err.message : String(err);
|
|
@@ -25992,7 +26065,7 @@ var parameters75 = {
|
|
|
25992
26065
|
|
|
25993
26066
|
// ../connectors/src/connectors/oracle/tools/execute-query.ts
|
|
25994
26067
|
import { z as z92 } from "zod";
|
|
25995
|
-
var
|
|
26068
|
+
var MAX_ROWS15 = 500;
|
|
25996
26069
|
var inputSchema92 = z92.object({
|
|
25997
26070
|
toolUseIntent: z92.string().optional().describe(
|
|
25998
26071
|
"Brief description of what you intend to accomplish with this tool call"
|
|
@@ -26016,7 +26089,7 @@ var outputSchema92 = z92.discriminatedUnion("success", [
|
|
|
26016
26089
|
]);
|
|
26017
26090
|
var executeQueryTool16 = new ConnectorTool({
|
|
26018
26091
|
name: "executeQuery",
|
|
26019
|
-
description: `Execute a query against an Oracle Database. Returns up to ${
|
|
26092
|
+
description: `Execute a query against an Oracle Database. Returns up to ${MAX_ROWS15} rows.
|
|
26020
26093
|
Use for: schema exploration via \`USER_TABLES\` / \`USER_TAB_COLUMNS\` / \`ALL_TABLES\`, data sampling, and analytical queries.
|
|
26021
26094
|
Oracle uses \`FETCH FIRST n ROWS ONLY\` (12c+) or \`ROWNUM\` for row limiting \u2014 there is no \`LIMIT\` keyword.
|
|
26022
26095
|
Unquoted identifiers are stored upper-case (\`SELECT * FROM employees\` resolves to \`EMPLOYEES\`).
|
|
@@ -26051,12 +26124,12 @@ Do NOT terminate statements with a semicolon; the driver rejects trailing termin
|
|
|
26051
26124
|
const { rows } = await runOracleQuery(parsed, cleanSql, {
|
|
26052
26125
|
tunnelParams: connectionParamsToRecord(connection)
|
|
26053
26126
|
});
|
|
26054
|
-
const truncated = rows.length >
|
|
26127
|
+
const truncated = rows.length > MAX_ROWS15;
|
|
26055
26128
|
return {
|
|
26056
26129
|
success: true,
|
|
26057
|
-
rowCount: Math.min(rows.length,
|
|
26130
|
+
rowCount: Math.min(rows.length, MAX_ROWS15),
|
|
26058
26131
|
truncated,
|
|
26059
|
-
rows: rows.slice(0,
|
|
26132
|
+
rows: rows.slice(0, MAX_ROWS15)
|
|
26060
26133
|
};
|
|
26061
26134
|
} catch (err) {
|
|
26062
26135
|
let msg = err instanceof Error ? err.message : String(err);
|
|
@@ -26075,7 +26148,7 @@ var oracleConnector = new ConnectorPlugin({
|
|
|
26075
26148
|
description: "Connect to Oracle Database using a JDBC-style URL via the pure-JS Thin driver (no Oracle Instant Client required).",
|
|
26076
26149
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/3iGEdzvGHncU5bYqFOROiV/9e7bdda7230d7ca6b34e7f6a862de876/oracle-icon.webp",
|
|
26077
26150
|
parameters: parameters75,
|
|
26078
|
-
releaseFlag: { dev1: true, dev2:
|
|
26151
|
+
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
26079
26152
|
categories: ["database"],
|
|
26080
26153
|
onboarding: oracleOnboarding,
|
|
26081
26154
|
systemPrompt: {
|
|
@@ -27552,119 +27625,1357 @@ export default async function handler(c: Context) {
|
|
|
27552
27625
|
tools: tools79
|
|
27553
27626
|
});
|
|
27554
27627
|
|
|
27555
|
-
// ../connectors/src/connectors/
|
|
27556
|
-
|
|
27557
|
-
|
|
27558
|
-
|
|
27559
|
-
|
|
27560
|
-
|
|
27561
|
-
|
|
27562
|
-
|
|
27563
|
-
|
|
27564
|
-
|
|
27565
|
-
awsBilling: awsBillingConnector,
|
|
27566
|
-
postgresql: postgresqlConnector,
|
|
27567
|
-
mysql: mysqlConnector,
|
|
27568
|
-
googleAds: googleAdsConnector,
|
|
27569
|
-
googleAnalytics: googleAnalyticsConnector,
|
|
27570
|
-
googleAnalyticsOauth: googleAnalyticsOauthConnector,
|
|
27571
|
-
googleCalendar: googleCalendarConnector,
|
|
27572
|
-
googleCalendarOauth: googleCalendarOauthConnector,
|
|
27573
|
-
googleDocs: googleDocsConnector,
|
|
27574
|
-
googleDrive: googleDriveConnector,
|
|
27575
|
-
googleSheets: googleSheetsConnector,
|
|
27576
|
-
googleSlides: googleSlidesConnector,
|
|
27577
|
-
hubspotOauth: hubspotOauthConnector,
|
|
27578
|
-
stripeOauth: stripeOauthConnector,
|
|
27579
|
-
stripeApiKey: stripeApiKeyConnector,
|
|
27580
|
-
airtable: airtableConnector,
|
|
27581
|
-
airtableOauth: airtableOauthConnector,
|
|
27582
|
-
squadbaseDb: squadbaseDbConnector,
|
|
27583
|
-
kintone: kintoneConnector,
|
|
27584
|
-
kintoneApiToken: kintoneApiTokenConnector,
|
|
27585
|
-
wixStore: wixStoreConnector,
|
|
27586
|
-
openai: openaiConnector,
|
|
27587
|
-
gemini: geminiConnector,
|
|
27588
|
-
anthropic: anthropicConnector,
|
|
27589
|
-
amplitude: amplitudeConnector,
|
|
27590
|
-
attio: attioConnector,
|
|
27591
|
-
shopify: shopifyConnector,
|
|
27592
|
-
shopifyOauth: shopifyOauthConnector,
|
|
27593
|
-
hubspot: hubspotConnector,
|
|
27594
|
-
jira: jiraConnector,
|
|
27595
|
-
linear: linearConnector,
|
|
27596
|
-
asana: asanaConnector,
|
|
27597
|
-
clickhouse: clickhouseConnector,
|
|
27598
|
-
mongodb: mongodbConnector,
|
|
27599
|
-
notion: notionConnector,
|
|
27600
|
-
notionOauth: notionOauthConnector,
|
|
27601
|
-
metaAds: metaAdsConnector,
|
|
27602
|
-
metaAdsOauth: metaAdsOauthConnector,
|
|
27603
|
-
tiktokAds: tiktokAdsConnector,
|
|
27604
|
-
mailchimp: mailchimpConnector,
|
|
27605
|
-
mailchimpOauth: mailchimpOauthConnector,
|
|
27606
|
-
customerio: customerioConnector,
|
|
27607
|
-
gmail: gmailConnector,
|
|
27608
|
-
gmailOauth: gmailOauthConnector,
|
|
27609
|
-
googleAuditLog: googleAuditLogConnector,
|
|
27610
|
-
linkedinAds: linkedinAdsConnector,
|
|
27611
|
-
zendesk: zendeskConnector,
|
|
27612
|
-
zendeskOauth: zendeskOauthConnector,
|
|
27613
|
-
intercom: intercomConnector,
|
|
27614
|
-
intercomOauth: intercomOauthConnector,
|
|
27615
|
-
mixpanel: mixpanelConnector,
|
|
27616
|
-
grafana: grafanaConnector,
|
|
27617
|
-
backlog: backlogConnector,
|
|
27618
|
-
gamma: gammaConnector,
|
|
27619
|
-
sentry: sentryConnector,
|
|
27620
|
-
salesforce: salesforceConnector,
|
|
27621
|
-
influxdb: influxdbConnector,
|
|
27622
|
-
monday: mondayConnector,
|
|
27623
|
-
jdbc: jdbcConnector,
|
|
27624
|
-
semrush: semrushConnector,
|
|
27625
|
-
googleSearchConsoleOauth: googleSearchConsoleOauthConnector,
|
|
27626
|
-
supabase: supabaseConnector,
|
|
27627
|
-
clickup: clickupConnector,
|
|
27628
|
-
sqlserver: sqlserverConnector,
|
|
27629
|
-
azureSql: azureSqlConnector,
|
|
27630
|
-
cosmosdb: cosmosdbConnector,
|
|
27631
|
-
oracle: oracleConnector,
|
|
27632
|
-
freshservice: freshserviceConnector,
|
|
27633
|
-
freshdesk: freshdeskConnector,
|
|
27634
|
-
freshsales: freshsalesConnector,
|
|
27635
|
-
github: githubConnector
|
|
27636
|
-
};
|
|
27637
|
-
var connectors = {
|
|
27638
|
-
...plugins,
|
|
27639
|
-
/**
|
|
27640
|
-
* Return plugins that have at least one matching connection.
|
|
27641
|
-
*/
|
|
27642
|
-
pluginsFor(connections) {
|
|
27643
|
-
const keys = new Set(
|
|
27644
|
-
connections.map(
|
|
27645
|
-
(c) => ConnectorPlugin.deriveKey(c.connector.slug, c.connector.authType)
|
|
27646
|
-
)
|
|
27647
|
-
);
|
|
27648
|
-
return Object.values(plugins).filter((p) => keys.has(p.connectorKey));
|
|
27649
|
-
},
|
|
27650
|
-
/**
|
|
27651
|
-
* Find a plugin by slug and authType.
|
|
27652
|
-
*/
|
|
27653
|
-
findByKey(slug, authType) {
|
|
27654
|
-
const key = ConnectorPlugin.deriveKey(slug, authType);
|
|
27655
|
-
return Object.values(plugins).find((p) => p.connectorKey === key);
|
|
27656
|
-
}
|
|
27657
|
-
};
|
|
27658
|
-
|
|
27659
|
-
// src/connector-client/env.ts
|
|
27660
|
-
function resolveEnvVar(entry, key, connectionId) {
|
|
27661
|
-
const envVarName = entry.envVars[key];
|
|
27662
|
-
if (!envVarName) {
|
|
27663
|
-
throw new Error(`Connection "${connectionId}" is missing envVars mapping for key "${key}"`);
|
|
27628
|
+
// ../connectors/src/connectors/powerbi-oauth/tools/request.ts
|
|
27629
|
+
import { z as z97 } from "zod";
|
|
27630
|
+
var BASE_HOST12 = "https://api.powerbi.com";
|
|
27631
|
+
var BASE_PATH_SEGMENT15 = "/v1.0/myorg";
|
|
27632
|
+
var BASE_URL41 = `${BASE_HOST12}${BASE_PATH_SEGMENT15}`;
|
|
27633
|
+
var REQUEST_TIMEOUT_MS74 = 6e4;
|
|
27634
|
+
var cachedToken32 = null;
|
|
27635
|
+
async function getProxyToken32(config) {
|
|
27636
|
+
if (cachedToken32 && cachedToken32.expiresAt > Date.now() + 6e4) {
|
|
27637
|
+
return cachedToken32.token;
|
|
27664
27638
|
}
|
|
27665
|
-
const
|
|
27666
|
-
|
|
27667
|
-
|
|
27639
|
+
const url = `${config.appApiBaseUrl}/v0/database/${config.projectId}/environment/${config.environmentId}/oauth-request-proxy-token`;
|
|
27640
|
+
const res = await fetch(url, {
|
|
27641
|
+
method: "POST",
|
|
27642
|
+
headers: {
|
|
27643
|
+
"Content-Type": "application/json",
|
|
27644
|
+
"x-api-key": config.appApiKey,
|
|
27645
|
+
"project-id": config.projectId
|
|
27646
|
+
},
|
|
27647
|
+
body: JSON.stringify({
|
|
27648
|
+
sandboxId: config.sandboxId,
|
|
27649
|
+
issuedBy: "coding-agent"
|
|
27650
|
+
})
|
|
27651
|
+
});
|
|
27652
|
+
if (!res.ok) {
|
|
27653
|
+
const errorText = await res.text().catch(() => res.statusText);
|
|
27654
|
+
throw new Error(
|
|
27655
|
+
`Failed to get proxy token: HTTP ${res.status} ${errorText}`
|
|
27656
|
+
);
|
|
27657
|
+
}
|
|
27658
|
+
const data = await res.json();
|
|
27659
|
+
cachedToken32 = {
|
|
27660
|
+
token: data.token,
|
|
27661
|
+
expiresAt: new Date(data.expiresAt).getTime()
|
|
27662
|
+
};
|
|
27663
|
+
return data.token;
|
|
27664
|
+
}
|
|
27665
|
+
var inputSchema97 = z97.object({
|
|
27666
|
+
toolUseIntent: z97.string().optional().describe(
|
|
27667
|
+
"Brief description of what you intend to accomplish with this tool call"
|
|
27668
|
+
),
|
|
27669
|
+
connectionId: z97.string().describe("ID of the Power BI OAuth connection to use"),
|
|
27670
|
+
method: z97.enum(["GET", "POST", "PATCH", "PUT", "DELETE"]).describe(
|
|
27671
|
+
"HTTP method. GET for reading workspaces/datasets/reports, POST for executeQueries / refresh, PATCH/PUT for updates, DELETE for removal."
|
|
27672
|
+
),
|
|
27673
|
+
path: z97.string().describe(
|
|
27674
|
+
"API path appended to https://api.powerbi.com/v1.0/myorg (e.g., '/groups', '/groups/{groupId}/datasets'). The authenticated user must have access to the workspace."
|
|
27675
|
+
),
|
|
27676
|
+
queryParams: z97.record(z97.string(), z97.string()).optional().describe(
|
|
27677
|
+
`Query parameters to append (e.g., { $top: '50', $filter: "name eq 'Sales'" }).`
|
|
27678
|
+
),
|
|
27679
|
+
body: z97.record(z97.string(), z97.unknown()).optional().describe(
|
|
27680
|
+
"JSON request body for POST/PATCH/PUT/DELETE. Example executeQueries body: { queries: [{ query: 'EVALUATE TOPN(10, Sales)' }], serializerSettings: { includeNulls: true } }."
|
|
27681
|
+
)
|
|
27682
|
+
});
|
|
27683
|
+
var outputSchema97 = z97.discriminatedUnion("success", [
|
|
27684
|
+
z97.object({
|
|
27685
|
+
success: z97.literal(true),
|
|
27686
|
+
status: z97.number(),
|
|
27687
|
+
data: z97.unknown()
|
|
27688
|
+
}),
|
|
27689
|
+
z97.object({
|
|
27690
|
+
success: z97.literal(false),
|
|
27691
|
+
error: z97.string()
|
|
27692
|
+
})
|
|
27693
|
+
]);
|
|
27694
|
+
var requestTool56 = new ConnectorTool({
|
|
27695
|
+
name: "request",
|
|
27696
|
+
description: `Send authenticated requests to the Power BI REST API v1.0 using the user's Microsoft Entra OAuth token (proxied automatically).
|
|
27697
|
+
All paths are relative to https://api.powerbi.com/v1.0/myorg. Use the executeQueries endpoint to run DAX against a dataset.
|
|
27698
|
+
The signed-in user must have access to the workspace; unlike Service Principals, OAuth users can also access "My workspace" via the \`/datasets\` (without \`/groups/\`) endpoints.`,
|
|
27699
|
+
inputSchema: inputSchema97,
|
|
27700
|
+
outputSchema: outputSchema97,
|
|
27701
|
+
async execute({ connectionId, method, path: path5, queryParams, body }, connections, config) {
|
|
27702
|
+
const connection = connections.find((c) => c.id === connectionId);
|
|
27703
|
+
if (!connection) {
|
|
27704
|
+
return {
|
|
27705
|
+
success: false,
|
|
27706
|
+
error: `Connection ${connectionId} not found`
|
|
27707
|
+
};
|
|
27708
|
+
}
|
|
27709
|
+
console.log(
|
|
27710
|
+
`[connector-request] powerbi-oauth/${connection.name}: ${method} ${path5}`
|
|
27711
|
+
);
|
|
27712
|
+
try {
|
|
27713
|
+
const normalizedPath = normalizeRequestPath(path5, BASE_PATH_SEGMENT15);
|
|
27714
|
+
let url = `${BASE_URL41}${normalizedPath}`;
|
|
27715
|
+
if (queryParams) {
|
|
27716
|
+
const searchParams = new URLSearchParams(queryParams);
|
|
27717
|
+
url += `?${searchParams.toString()}`;
|
|
27718
|
+
}
|
|
27719
|
+
const token = await getProxyToken32(config.oauthProxy);
|
|
27720
|
+
const proxyUrl = `https://${config.oauthProxy.sandboxId}.${config.oauthProxy.previewBaseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
27721
|
+
const controller = new AbortController();
|
|
27722
|
+
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS74);
|
|
27723
|
+
try {
|
|
27724
|
+
const response = await fetch(proxyUrl, {
|
|
27725
|
+
method: "POST",
|
|
27726
|
+
headers: {
|
|
27727
|
+
"Content-Type": "application/json",
|
|
27728
|
+
Authorization: `Bearer ${token}`
|
|
27729
|
+
},
|
|
27730
|
+
body: JSON.stringify({
|
|
27731
|
+
url,
|
|
27732
|
+
method,
|
|
27733
|
+
...body !== void 0 ? { body } : {}
|
|
27734
|
+
}),
|
|
27735
|
+
signal: controller.signal
|
|
27736
|
+
});
|
|
27737
|
+
const text = await response.text();
|
|
27738
|
+
const data = text ? (() => {
|
|
27739
|
+
try {
|
|
27740
|
+
return JSON.parse(text);
|
|
27741
|
+
} catch {
|
|
27742
|
+
return text;
|
|
27743
|
+
}
|
|
27744
|
+
})() : null;
|
|
27745
|
+
if (!response.ok) {
|
|
27746
|
+
const errorMessage = data && typeof data === "object" && "error" in data ? JSON.stringify(data.error) : typeof data === "string" && data ? data : `HTTP ${response.status} ${response.statusText}`;
|
|
27747
|
+
return { success: false, error: errorMessage };
|
|
27748
|
+
}
|
|
27749
|
+
return { success: true, status: response.status, data };
|
|
27750
|
+
} finally {
|
|
27751
|
+
clearTimeout(timeout);
|
|
27752
|
+
}
|
|
27753
|
+
} catch (err) {
|
|
27754
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
27755
|
+
return { success: false, error: msg };
|
|
27756
|
+
}
|
|
27757
|
+
}
|
|
27758
|
+
});
|
|
27759
|
+
|
|
27760
|
+
// ../connectors/src/connectors/powerbi-oauth/setup.ts
|
|
27761
|
+
var requestToolName13 = `powerbi-oauth_${requestTool56.name}`;
|
|
27762
|
+
var powerbiOauthOnboarding = new ConnectorOnboarding({
|
|
27763
|
+
connectionSetupInstructions: {
|
|
27764
|
+
ja: `Power BI OAuth \u30B3\u30CD\u30AF\u30B7\u30E7\u30F3\u306E\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u306F\u4EE5\u4E0B\u306E\u624B\u9806\u3067\u884C\u3063\u3066\u304F\u3060\u3055\u3044\u3002
|
|
27765
|
+
|
|
27766
|
+
1. \`${requestToolName13}\` \u3092 \`method: "GET"\`\u3001\`path: "/groups"\` \u3067\u547C\u3073\u51FA\u3057\u3001\u30E6\u30FC\u30B6\u30FC\u304C\u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u306A\u30EF\u30FC\u30AF\u30B9\u30DA\u30FC\u30B9\u4E00\u89A7\u3092\u53D6\u5F97\u3059\u308B
|
|
27767
|
+
2. \u30A8\u30E9\u30FC\u304C\u8FD4\u3055\u308C\u305F\u5834\u5408\u3001OAuth \u8A8D\u8A3C\u304C\u6B63\u3057\u304F\u5B8C\u4E86\u3057\u3066\u3044\u308B\u304B\u78BA\u8A8D\u3059\u308B\u3088\u3046\u30E6\u30FC\u30B6\u30FC\u306B\u4F1D\u3048\u308B
|
|
27768
|
+
|
|
27769
|
+
#### \u5236\u7D04
|
|
27770
|
+
- **\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u4E2D\u306B DAX \u30AF\u30A8\u30EA\u306E\u5B9F\u884C\u3084\u30C7\u30FC\u30BF\u30BB\u30C3\u30C8\u306E\u66F4\u65B0\u3092\u884C\u308F\u306A\u3044\u3053\u3068**\u3002\u4E0A\u8A18\u306E\u30EF\u30FC\u30AF\u30B9\u30DA\u30FC\u30B9\u4E00\u89A7\u53D6\u5F97\u306E\u307F\u8A31\u53EF
|
|
27771
|
+
- \u30C4\u30FC\u30EB\u9593\u306F1\u6587\u3060\u3051\u66F8\u3044\u3066\u5373\u6B21\u306E\u30C4\u30FC\u30EB\u547C\u3073\u51FA\u3057`,
|
|
27772
|
+
en: `Follow these steps to set up the Power BI OAuth connection.
|
|
27773
|
+
|
|
27774
|
+
1. Call \`${requestToolName13}\` with \`method: "GET"\` and \`path: "/groups"\` to list the workspaces the user has access to
|
|
27775
|
+
2. If an error is returned, ask the user to verify that OAuth authentication completed correctly
|
|
27776
|
+
|
|
27777
|
+
#### Constraints
|
|
27778
|
+
- **Do NOT execute DAX queries or refresh datasets during setup**. Only the workspace listing above is allowed
|
|
27779
|
+
- Write only 1 sentence between tool calls, then immediately call the next tool`
|
|
27780
|
+
},
|
|
27781
|
+
dataOverviewInstructions: {
|
|
27782
|
+
en: `1. Call powerbi-oauth_request with GET /groups to list accessible workspaces
|
|
27783
|
+
2. For a target workspace, call powerbi-oauth_request with GET /groups/{groupId}/datasets to list datasets
|
|
27784
|
+
3. Call powerbi-oauth_request with GET /groups/{groupId}/reports to list reports
|
|
27785
|
+
4. For each interesting dataset call powerbi-oauth_request with GET /groups/{groupId}/datasets/{datasetId}/tables to inspect tables`,
|
|
27786
|
+
ja: `1. powerbi-oauth_request \u3067 GET /groups \u3092\u547C\u3073\u51FA\u3057\u3001\u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u306A\u30EF\u30FC\u30AF\u30B9\u30DA\u30FC\u30B9\u4E00\u89A7\u3092\u53D6\u5F97
|
|
27787
|
+
2. \u5BFE\u8C61\u30EF\u30FC\u30AF\u30B9\u30DA\u30FC\u30B9\u306B\u5BFE\u3057\u3066 powerbi-oauth_request \u3067 GET /groups/{groupId}/datasets \u3092\u547C\u3073\u51FA\u3057\u3001\u30C7\u30FC\u30BF\u30BB\u30C3\u30C8\u4E00\u89A7\u3092\u53D6\u5F97
|
|
27788
|
+
3. powerbi-oauth_request \u3067 GET /groups/{groupId}/reports \u3092\u547C\u3073\u51FA\u3057\u3001\u30EC\u30DD\u30FC\u30C8\u4E00\u89A7\u3092\u53D6\u5F97
|
|
27789
|
+
4. \u8208\u5473\u306E\u3042\u308B\u30C7\u30FC\u30BF\u30BB\u30C3\u30C8\u306B\u3064\u3044\u3066 powerbi-oauth_request \u3067 GET /groups/{groupId}/datasets/{datasetId}/tables \u3092\u547C\u3073\u51FA\u3057\u3001\u30C6\u30FC\u30D6\u30EB\u69CB\u9020\u3092\u78BA\u8A8D`
|
|
27790
|
+
}
|
|
27791
|
+
});
|
|
27792
|
+
|
|
27793
|
+
// ../connectors/src/connectors/powerbi-oauth/parameters.ts
|
|
27794
|
+
var parameters80 = {};
|
|
27795
|
+
|
|
27796
|
+
// ../connectors/src/connectors/powerbi-oauth/index.ts
|
|
27797
|
+
var tools80 = { request: requestTool56 };
|
|
27798
|
+
var powerbiOauthConnector = new ConnectorPlugin({
|
|
27799
|
+
slug: "powerbi",
|
|
27800
|
+
authType: AUTH_TYPES.OAUTH,
|
|
27801
|
+
name: "Power BI",
|
|
27802
|
+
description: "Connect to Microsoft Power BI using OAuth (Microsoft Entra ID). Use it to enumerate workspaces, datasets, and reports the signed-in user has access to, and to run DAX queries.",
|
|
27803
|
+
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/2vXQCKGpMJ9kGSaqkZl9IS/cc5669c267fc5d11e7b1f8c01723e461/power-bi-icon.png",
|
|
27804
|
+
parameters: parameters80,
|
|
27805
|
+
releaseFlag: { dev1: true, dev2: false, prod: false },
|
|
27806
|
+
categories: ["bi"],
|
|
27807
|
+
onboarding: powerbiOauthOnboarding,
|
|
27808
|
+
proxyPolicy: {
|
|
27809
|
+
allowlist: [
|
|
27810
|
+
{
|
|
27811
|
+
host: "api.powerbi.com",
|
|
27812
|
+
methods: ["GET", "POST", "PATCH", "PUT", "DELETE"]
|
|
27813
|
+
}
|
|
27814
|
+
]
|
|
27815
|
+
},
|
|
27816
|
+
systemPrompt: {
|
|
27817
|
+
en: `### Tools
|
|
27818
|
+
|
|
27819
|
+
- \`powerbi-oauth_request\`: The only way to call the Power BI REST API v1.0. Use it to list workspaces (\`/groups\`), datasets, reports, and to run DAX via the \`executeQueries\` endpoint. Authentication is configured automatically via OAuth (Microsoft Entra ID).
|
|
27820
|
+
|
|
27821
|
+
### Business Logic
|
|
27822
|
+
|
|
27823
|
+
The business logic type for this connector is "typescript". Use the connector SDK in your handler. Do NOT access credentials directly from environment variables and do NOT read \`INTERNAL_SQUADBASE_*\` env vars \u2014 the SDK takes care of OAuth.
|
|
27824
|
+
|
|
27825
|
+
SDK surface (client created via \`connection(connectionId)\`):
|
|
27826
|
+
- \`client.request(path, init?)\` \u2014 low-level authenticated fetch (path appended to \`https://api.powerbi.com/v1.0/myorg\`)
|
|
27827
|
+
- \`client.listGroups(options?)\` \u2014 list workspaces (\`$top\`, \`$skip\`, \`$filter\`)
|
|
27828
|
+
- \`client.listDatasets(groupId)\` / \`client.listReports(groupId)\` \u2014 list datasets / reports in a workspace
|
|
27829
|
+
- \`client.getDataset(groupId, datasetId)\` \u2014 fetch a single dataset
|
|
27830
|
+
- \`client.executeQueries(groupId, datasetId, queries, options?)\` \u2014 run DAX queries
|
|
27831
|
+
- \`client.refreshDataset(groupId, datasetId, options?)\` \u2014 trigger an async refresh
|
|
27832
|
+
|
|
27833
|
+
If a handler test fails with \`Connection proxy is not configured\`, retry \u2014 the sandbox is still initializing. Do NOT abandon the SDK and construct OAuth proxy URLs manually.
|
|
27834
|
+
|
|
27835
|
+
\`\`\`ts
|
|
27836
|
+
import type { Context } from "hono";
|
|
27837
|
+
import { connection } from "@squadbase/vite-server/connectors/powerbi-oauth";
|
|
27838
|
+
|
|
27839
|
+
const powerbi = connection("<connectionId>");
|
|
27840
|
+
|
|
27841
|
+
export default async function handler(c: Context) {
|
|
27842
|
+
const { groupId, datasetId, dax } = await c.req.json<{
|
|
27843
|
+
groupId: string;
|
|
27844
|
+
datasetId: string;
|
|
27845
|
+
dax: string;
|
|
27846
|
+
}>();
|
|
27847
|
+
|
|
27848
|
+
const result = await powerbi.executeQueries(groupId, datasetId, [dax]);
|
|
27849
|
+
const rows = result.results[0]?.tables[0]?.rows ?? [];
|
|
27850
|
+
return c.json({ rows });
|
|
27851
|
+
}
|
|
27852
|
+
\`\`\`
|
|
27853
|
+
|
|
27854
|
+
### Power BI REST API Reference
|
|
27855
|
+
|
|
27856
|
+
- Base URL: \`https://api.powerbi.com/v1.0/myorg\`
|
|
27857
|
+
- Authentication: Microsoft Entra OAuth (delegated; handled automatically)
|
|
27858
|
+
- Unlike Service Principals, OAuth users can also access "My workspace" via the \`/datasets\` (without \`/groups/\`) endpoints
|
|
27859
|
+
|
|
27860
|
+
#### Common Endpoints
|
|
27861
|
+
- GET \`/groups\` \u2014 List workspaces the signed-in user has access to
|
|
27862
|
+
- GET \`/groups/{groupId}/datasets\` \u2014 List datasets in a workspace
|
|
27863
|
+
- GET \`/groups/{groupId}/datasets/{datasetId}\` \u2014 Get dataset metadata
|
|
27864
|
+
- GET \`/groups/{groupId}/reports\` \u2014 List reports
|
|
27865
|
+
- POST \`/groups/{groupId}/datasets/{datasetId}/executeQueries\` \u2014 Run DAX (body: \`{ queries: [{ query: "EVALUATE ..." }], serializerSettings: { includeNulls: true } }\`)
|
|
27866
|
+
- POST \`/groups/{groupId}/datasets/{datasetId}/refreshes\` \u2014 Trigger a dataset refresh
|
|
27867
|
+
- GET \`/groups/{groupId}/datasets/{datasetId}/refreshes\` \u2014 List recent refresh history
|
|
27868
|
+
|
|
27869
|
+
#### DAX Tips
|
|
27870
|
+
- \`EVALUATE TOPN(10, 'TableName')\` \u2014 sample 10 rows from a table
|
|
27871
|
+
- \`EVALUATE SUMMARIZECOLUMNS('Date'[Year], "Sales", SUM('Sales'[Amount]))\` \u2014 aggregate
|
|
27872
|
+
- Each \`executeQueries\` call accepts one query in the \`queries\` array (per current Power BI API limits)`,
|
|
27873
|
+
ja: `### \u30C4\u30FC\u30EB
|
|
27874
|
+
|
|
27875
|
+
- \`powerbi-oauth_request\`: Power BI REST API v1.0 \u3092\u547C\u3073\u51FA\u3059\u552F\u4E00\u306E\u624B\u6BB5\u3067\u3059\u3002\u30EF\u30FC\u30AF\u30B9\u30DA\u30FC\u30B9 (\`/groups\`)\u3001\u30C7\u30FC\u30BF\u30BB\u30C3\u30C8\u3001\u30EC\u30DD\u30FC\u30C8\u306E\u4E00\u89A7\u53D6\u5F97\u3084\u3001\`executeQueries\` \u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8\u306B\u3088\u308B DAX \u306E\u5B9F\u884C\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002OAuth (Microsoft Entra ID) \u7D4C\u7531\u3067\u8A8D\u8A3C\u306F\u81EA\u52D5\u8A2D\u5B9A\u3055\u308C\u307E\u3059\u3002
|
|
27876
|
+
|
|
27877
|
+
### Business Logic
|
|
27878
|
+
|
|
27879
|
+
\u3053\u306E\u30B3\u30CD\u30AF\u30BF\u306E\u30D3\u30B8\u30CD\u30B9\u30ED\u30B8\u30C3\u30AF\u30BF\u30A4\u30D7\u306F "typescript" \u3067\u3059\u3002\u4EE5\u4E0B\u306B\u793A\u3059\u30B3\u30CD\u30AF\u30BF SDK \u3092\u4F7F\u7528\u3057\u3066\u30CF\u30F3\u30C9\u30E9\u30B3\u30FC\u30C9\u3092\u8A18\u8FF0\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u74B0\u5883\u5909\u6570\u304B\u3089\u76F4\u63A5\u8A8D\u8A3C\u60C5\u5831\u306B\u30A2\u30AF\u30BB\u30B9\u3057\u306A\u3044\u3067\u304F\u3060\u3055\u3044\u3002\`INTERNAL_SQUADBASE_*\` \u306E\u74B0\u5883\u5909\u6570\u3092\u4F7F\u3063\u3066\u624B\u52D5\u3067 OAuth \u30D7\u30ED\u30AD\u30B7\u3092\u53E9\u304F\u3053\u3068\u3082\u3057\u306A\u3044\u3067\u304F\u3060\u3055\u3044 \u2014 SDK \u304C OAuth \u3092\u51E6\u7406\u3057\u307E\u3059\u3002
|
|
27880
|
+
|
|
27881
|
+
SDK (\`connection(connectionId)\` \u3067\u4F5C\u6210\u3057\u305F\u30AF\u30E9\u30A4\u30A2\u30F3\u30C8):
|
|
27882
|
+
- \`client.request(path, init?)\` \u2014 \u4F4E\u30EC\u30D9\u30EB\u8A8D\u8A3C\u4ED8\u304D fetch (path \u306F \`https://api.powerbi.com/v1.0/myorg\` \u306B\u8FFD\u52A0\u3055\u308C\u307E\u3059)
|
|
27883
|
+
- \`client.listGroups(options?)\` \u2014 \u30EF\u30FC\u30AF\u30B9\u30DA\u30FC\u30B9\u4E00\u89A7 (\`$top\`, \`$skip\`, \`$filter\`)
|
|
27884
|
+
- \`client.listDatasets(groupId)\` / \`client.listReports(groupId)\` \u2014 \u30EF\u30FC\u30AF\u30B9\u30DA\u30FC\u30B9\u5185\u306E\u30C7\u30FC\u30BF\u30BB\u30C3\u30C8/\u30EC\u30DD\u30FC\u30C8\u4E00\u89A7
|
|
27885
|
+
- \`client.getDataset(groupId, datasetId)\` \u2014 \u30C7\u30FC\u30BF\u30BB\u30C3\u30C8\u5358\u4F53\u53D6\u5F97
|
|
27886
|
+
- \`client.executeQueries(groupId, datasetId, queries, options?)\` \u2014 DAX \u30AF\u30A8\u30EA\u5B9F\u884C
|
|
27887
|
+
- \`client.refreshDataset(groupId, datasetId, options?)\` \u2014 \u30C7\u30FC\u30BF\u30BB\u30C3\u30C8\u66F4\u65B0\u3092\u975E\u540C\u671F\u30C8\u30EA\u30AC\u30FC
|
|
27888
|
+
|
|
27889
|
+
\u30CF\u30F3\u30C9\u30E9\u306E\u30C6\u30B9\u30C8\u304C \`Connection proxy is not configured\` \u3067\u5931\u6557\u3059\u308B\u5834\u5408\u306F\u518D\u8A66\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002SDK \u3092\u8AE6\u3081\u3066 OAuth \u30D7\u30ED\u30AD\u30B7\u306E URL \u3092\u81EA\u5206\u3067\u7D44\u307F\u7ACB\u3066\u308B\u3053\u3068\u306F **\u3057\u306A\u3044\u3067\u304F\u3060\u3055\u3044**\u3002
|
|
27890
|
+
|
|
27891
|
+
\`\`\`ts
|
|
27892
|
+
import type { Context } from "hono";
|
|
27893
|
+
import { connection } from "@squadbase/vite-server/connectors/powerbi-oauth";
|
|
27894
|
+
|
|
27895
|
+
const powerbi = connection("<connectionId>");
|
|
27896
|
+
|
|
27897
|
+
export default async function handler(c: Context) {
|
|
27898
|
+
const { groupId, datasetId, dax } = await c.req.json<{
|
|
27899
|
+
groupId: string;
|
|
27900
|
+
datasetId: string;
|
|
27901
|
+
dax: string;
|
|
27902
|
+
}>();
|
|
27903
|
+
|
|
27904
|
+
const result = await powerbi.executeQueries(groupId, datasetId, [dax]);
|
|
27905
|
+
const rows = result.results[0]?.tables[0]?.rows ?? [];
|
|
27906
|
+
return c.json({ rows });
|
|
27907
|
+
}
|
|
27908
|
+
\`\`\`
|
|
27909
|
+
|
|
27910
|
+
### Power BI REST API \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9
|
|
27911
|
+
|
|
27912
|
+
- \u30D9\u30FC\u30B9 URL: \`https://api.powerbi.com/v1.0/myorg\`
|
|
27913
|
+
- \u8A8D\u8A3C: Microsoft Entra OAuth (\u59D4\u4EFB\u578B\u3001\u81EA\u52D5\u8A2D\u5B9A)
|
|
27914
|
+
- Service Principal \u3068\u7570\u306A\u308A\u3001OAuth \u30E6\u30FC\u30B6\u30FC\u306F \`/datasets\` (\`/groups/\` \u7121\u3057) \u3067\u300C\u30DE\u30A4 \u30EF\u30FC\u30AF\u30B9\u30DA\u30FC\u30B9\u300D\u306B\u3082\u30A2\u30AF\u30BB\u30B9\u53EF\u80FD
|
|
27915
|
+
|
|
27916
|
+
#### \u4E3B\u8981\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8
|
|
27917
|
+
- GET \`/groups\` \u2014 \u30E6\u30FC\u30B6\u30FC\u304C\u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u306A\u30EF\u30FC\u30AF\u30B9\u30DA\u30FC\u30B9\u4E00\u89A7
|
|
27918
|
+
- GET \`/groups/{groupId}/datasets\` \u2014 \u30EF\u30FC\u30AF\u30B9\u30DA\u30FC\u30B9\u5185\u306E\u30C7\u30FC\u30BF\u30BB\u30C3\u30C8\u4E00\u89A7
|
|
27919
|
+
- GET \`/groups/{groupId}/datasets/{datasetId}\` \u2014 \u30C7\u30FC\u30BF\u30BB\u30C3\u30C8 \u30E1\u30BF\u30C7\u30FC\u30BF
|
|
27920
|
+
- GET \`/groups/{groupId}/reports\` \u2014 \u30EC\u30DD\u30FC\u30C8\u4E00\u89A7
|
|
27921
|
+
- POST \`/groups/{groupId}/datasets/{datasetId}/executeQueries\` \u2014 DAX \u5B9F\u884C (body: \`{ queries: [{ query: "EVALUATE ..." }], serializerSettings: { includeNulls: true } }\`)
|
|
27922
|
+
- POST \`/groups/{groupId}/datasets/{datasetId}/refreshes\` \u2014 \u30C7\u30FC\u30BF\u30BB\u30C3\u30C8\u66F4\u65B0\u30C8\u30EA\u30AC\u30FC
|
|
27923
|
+
- GET \`/groups/{groupId}/datasets/{datasetId}/refreshes\` \u2014 \u76F4\u8FD1\u306E\u66F4\u65B0\u5C65\u6B74
|
|
27924
|
+
|
|
27925
|
+
#### DAX Tips
|
|
27926
|
+
- \`EVALUATE TOPN(10, 'TableName')\` \u2014 \u30C6\u30FC\u30D6\u30EB\u304B\u3089 10 \u884C\u30B5\u30F3\u30D7\u30EA\u30F3\u30B0
|
|
27927
|
+
- \`EVALUATE SUMMARIZECOLUMNS('Date'[Year], "Sales", SUM('Sales'[Amount]))\` \u2014 \u96C6\u8A08
|
|
27928
|
+
- \`executeQueries\` \u306F\u73FE\u72B6 1 \u30EA\u30AF\u30A8\u30B9\u30C8\u306B\u3064\u304D 1 \u30AF\u30A8\u30EA\u306E\u307F`
|
|
27929
|
+
},
|
|
27930
|
+
tools: tools80,
|
|
27931
|
+
async checkConnection(_params, config) {
|
|
27932
|
+
const { proxyFetch } = config;
|
|
27933
|
+
const url = "https://api.powerbi.com/v1.0/myorg/groups?$top=1";
|
|
27934
|
+
try {
|
|
27935
|
+
const res = await proxyFetch(url, { method: "GET" });
|
|
27936
|
+
if (!res.ok) {
|
|
27937
|
+
const errorText = await res.text().catch(() => res.statusText);
|
|
27938
|
+
return {
|
|
27939
|
+
success: false,
|
|
27940
|
+
error: `Power BI API failed: HTTP ${res.status} ${errorText}`
|
|
27941
|
+
};
|
|
27942
|
+
}
|
|
27943
|
+
return { success: true };
|
|
27944
|
+
} catch (error) {
|
|
27945
|
+
return {
|
|
27946
|
+
success: false,
|
|
27947
|
+
error: error instanceof Error ? error.message : String(error)
|
|
27948
|
+
};
|
|
27949
|
+
}
|
|
27950
|
+
}
|
|
27951
|
+
});
|
|
27952
|
+
|
|
27953
|
+
// ../connectors/src/connectors/tableau/setup.ts
|
|
27954
|
+
var tableauOnboarding = new ConnectorOnboarding({
|
|
27955
|
+
connectionSetupInstructions: {
|
|
27956
|
+
en: `Follow these steps to verify the Tableau PAT connection.
|
|
27957
|
+
|
|
27958
|
+
1. Call \`tableau_request\` with \`method: "GET"\` and \`path: "/sites/{siteId}/projects?pageSize=5"\` to list a few projects on the signed-in site
|
|
27959
|
+
2. If the call fails with HTTP 401, ask the user to confirm the PAT name/secret and that the Site Content URL matches the site where the PAT was issued (Tableau Cloud sites are case-sensitive)
|
|
27960
|
+
|
|
27961
|
+
#### Constraints
|
|
27962
|
+
- **Do NOT mutate Tableau resources during setup** (no publish/update/delete). Only the project listing above is allowed
|
|
27963
|
+
- The literal placeholder \`{siteId}\` in the path is automatically replaced with the session's site ID \u2014 do NOT hardcode the ID`,
|
|
27964
|
+
ja: `Tableau PAT \u30B3\u30CD\u30AF\u30B7\u30E7\u30F3\u306E\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u306F\u4EE5\u4E0B\u306E\u624B\u9806\u3067\u884C\u3063\u3066\u304F\u3060\u3055\u3044\u3002
|
|
27965
|
+
|
|
27966
|
+
1. \`tableau_request\` \u3092 \`method: "GET"\`\u3001\`path: "/sites/{siteId}/projects?pageSize=5"\` \u3067\u547C\u3073\u51FA\u3057\u3001\u30B5\u30A4\u30F3\u30A4\u30F3\u5148\u30B5\u30A4\u30C8\u306E\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u3092\u3044\u304F\u3064\u304B\u53D6\u5F97\u3059\u308B
|
|
27967
|
+
2. HTTP 401 \u3067\u5931\u6557\u3057\u305F\u5834\u5408\u306F\u3001PAT \u540D/\u30B7\u30FC\u30AF\u30EC\u30C3\u30C8\u304A\u3088\u3073 Site Content URL \u304C PAT \u767A\u884C\u30B5\u30A4\u30C8\u3068\u4E00\u81F4\u3057\u3066\u3044\u308B\u304B\u3092\u30E6\u30FC\u30B6\u30FC\u306B\u78BA\u8A8D\u3059\u308B\u3088\u3046\u4F1D\u3048\u308B\uFF08Tableau Cloud \u306E\u30B5\u30A4\u30C8\u540D\u306F\u5927\u6587\u5B57\u5C0F\u6587\u5B57\u3092\u533A\u5225\uFF09
|
|
27968
|
+
|
|
27969
|
+
#### \u5236\u7D04
|
|
27970
|
+
- **\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u4E2D\u306B Tableau \u30EA\u30BD\u30FC\u30B9\u3092\u5909\u66F4\u3057\u306A\u3044\u3053\u3068**\uFF08publish/update/delete \u4E0D\u53EF\uFF09\u3002\u4E0A\u8A18\u306E\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u4E00\u89A7\u53D6\u5F97\u306E\u307F\u8A31\u53EF
|
|
27971
|
+
- \u30D1\u30B9\u5185\u306E\u30D7\u30EC\u30FC\u30B9\u30DB\u30EB\u30C0\u30FC \`{siteId}\` \u306F\u30BB\u30C3\u30B7\u30E7\u30F3\u306E\u30B5\u30A4\u30C8 ID \u3067\u81EA\u52D5\u7F6E\u63DB\u3055\u308C\u307E\u3059 \u2014 ID \u3092\u30CF\u30FC\u30C9\u30B3\u30FC\u30C9\u3057\u306A\u3044\u3053\u3068`
|
|
27972
|
+
},
|
|
27973
|
+
dataOverviewInstructions: {
|
|
27974
|
+
en: `1. Call tableau_request with GET /sites/{siteId}/projects to list projects
|
|
27975
|
+
2. Call tableau_request with GET /sites/{siteId}/workbooks?pageSize=20 to list workbooks
|
|
27976
|
+
3. For a target workbook, call tableau_request with GET /sites/{siteId}/workbooks/{workbookId}/views to list its views
|
|
27977
|
+
4. Call tableau_request with GET /sites/{siteId}/datasources?pageSize=20 to list published data sources`,
|
|
27978
|
+
ja: `1. tableau_request \u3067 GET /sites/{siteId}/projects \u3092\u547C\u3073\u51FA\u3057\u3001\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u4E00\u89A7\u3092\u53D6\u5F97
|
|
27979
|
+
2. tableau_request \u3067 GET /sites/{siteId}/workbooks?pageSize=20 \u3092\u547C\u3073\u51FA\u3057\u3001\u30EF\u30FC\u30AF\u30D6\u30C3\u30AF\u4E00\u89A7\u3092\u53D6\u5F97
|
|
27980
|
+
3. \u5BFE\u8C61\u30EF\u30FC\u30AF\u30D6\u30C3\u30AF\u306B\u3064\u3044\u3066 tableau_request \u3067 GET /sites/{siteId}/workbooks/{workbookId}/views \u3092\u547C\u3073\u51FA\u3057\u3001\u30D3\u30E5\u30FC\u4E00\u89A7\u3092\u53D6\u5F97
|
|
27981
|
+
4. tableau_request \u3067 GET /sites/{siteId}/datasources?pageSize=20 \u3092\u547C\u3073\u51FA\u3057\u3001\u516C\u958B\u30C7\u30FC\u30BF\u30BD\u30FC\u30B9\u4E00\u89A7\u3092\u53D6\u5F97`
|
|
27982
|
+
}
|
|
27983
|
+
});
|
|
27984
|
+
|
|
27985
|
+
// ../connectors/src/connectors/tableau/parameters.ts
|
|
27986
|
+
var parameters81 = {
|
|
27987
|
+
serverUrl: new ParameterDefinition({
|
|
27988
|
+
slug: "server-url",
|
|
27989
|
+
name: "Tableau Server URL",
|
|
27990
|
+
description: "Base URL of your Tableau Cloud / Server instance (no trailing slash). Examples: https://us-east-1.online.tableau.com, https://prod-useast-a.online.tableau.com, https://tableau.example.com.",
|
|
27991
|
+
envVarBaseKey: "TABLEAU_SERVER_URL",
|
|
27992
|
+
type: "text",
|
|
27993
|
+
secret: false,
|
|
27994
|
+
required: true
|
|
27995
|
+
}),
|
|
27996
|
+
siteContentUrl: new ParameterDefinition({
|
|
27997
|
+
slug: "site-content-url",
|
|
27998
|
+
name: "Site Content URL",
|
|
27999
|
+
description: "The site's content URL (the value after '/site/' in the Tableau URL). On Tableau Cloud this is required (e.g. 'mycompany'). On Tableau Server the Default site uses an empty string \u2014 pass an empty string explicitly.",
|
|
28000
|
+
envVarBaseKey: "TABLEAU_SITE_CONTENT_URL",
|
|
28001
|
+
type: "text",
|
|
28002
|
+
secret: false,
|
|
28003
|
+
required: true
|
|
28004
|
+
}),
|
|
28005
|
+
patName: new ParameterDefinition({
|
|
28006
|
+
slug: "pat-name",
|
|
28007
|
+
name: "Personal Access Token Name",
|
|
28008
|
+
description: "Name of the Personal Access Token (PAT) generated under Account Settings > Personal Access Tokens. The owning user's site role determines the API permissions.",
|
|
28009
|
+
envVarBaseKey: "TABLEAU_PAT_NAME",
|
|
28010
|
+
type: "text",
|
|
28011
|
+
secret: false,
|
|
28012
|
+
required: true
|
|
28013
|
+
}),
|
|
28014
|
+
patSecret: new ParameterDefinition({
|
|
28015
|
+
slug: "pat-secret",
|
|
28016
|
+
name: "Personal Access Token Secret",
|
|
28017
|
+
description: "Secret value shown once when the PAT is created. Tokens expire after 15 days of inactivity (default) and must be rotated regularly.",
|
|
28018
|
+
envVarBaseKey: "TABLEAU_PAT_SECRET",
|
|
28019
|
+
type: "text",
|
|
28020
|
+
secret: true,
|
|
28021
|
+
required: true
|
|
28022
|
+
}),
|
|
28023
|
+
apiVersion: new ParameterDefinition({
|
|
28024
|
+
slug: "api-version",
|
|
28025
|
+
name: "REST API Version",
|
|
28026
|
+
description: "Optional Tableau REST API version (e.g., '3.28'). Defaults to '3.28' which works with current Tableau Cloud and recent Tableau Server releases. Use the version listed at https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_concepts_versions.htm if you need to pin.",
|
|
28027
|
+
envVarBaseKey: "TABLEAU_API_VERSION",
|
|
28028
|
+
type: "text",
|
|
28029
|
+
secret: false,
|
|
28030
|
+
required: false
|
|
28031
|
+
})
|
|
28032
|
+
};
|
|
28033
|
+
|
|
28034
|
+
// ../connectors/src/connectors/tableau/tools/request.ts
|
|
28035
|
+
import { z as z98 } from "zod";
|
|
28036
|
+
var DEFAULT_API_VERSION = "3.28";
|
|
28037
|
+
var REQUEST_TIMEOUT_MS75 = 6e4;
|
|
28038
|
+
var sessionCache = /* @__PURE__ */ new Map();
|
|
28039
|
+
function buildBaseUrl4(serverUrl, apiVersion) {
|
|
28040
|
+
return `${serverUrl.replace(/\/$/, "")}/api/${apiVersion}`;
|
|
28041
|
+
}
|
|
28042
|
+
async function signIn(serverUrl, apiVersion, siteContentUrl, patName, patSecret) {
|
|
28043
|
+
const url = `${buildBaseUrl4(serverUrl, apiVersion)}/auth/signin`;
|
|
28044
|
+
const body = {
|
|
28045
|
+
credentials: {
|
|
28046
|
+
personalAccessTokenName: patName,
|
|
28047
|
+
personalAccessTokenSecret: patSecret,
|
|
28048
|
+
site: { contentUrl: siteContentUrl }
|
|
28049
|
+
}
|
|
28050
|
+
};
|
|
28051
|
+
const res = await fetch(url, {
|
|
28052
|
+
method: "POST",
|
|
28053
|
+
headers: {
|
|
28054
|
+
"Content-Type": "application/json",
|
|
28055
|
+
Accept: "application/json"
|
|
28056
|
+
},
|
|
28057
|
+
body: JSON.stringify(body)
|
|
28058
|
+
});
|
|
28059
|
+
if (!res.ok) {
|
|
28060
|
+
const errorText = await res.text().catch(() => res.statusText);
|
|
28061
|
+
throw new Error(
|
|
28062
|
+
`Tableau sign-in failed: HTTP ${res.status} ${errorText}`
|
|
28063
|
+
);
|
|
28064
|
+
}
|
|
28065
|
+
const data = await res.json();
|
|
28066
|
+
return {
|
|
28067
|
+
authToken: data.credentials.token,
|
|
28068
|
+
siteId: data.credentials.site.id,
|
|
28069
|
+
userId: data.credentials.user.id,
|
|
28070
|
+
expiresAt: Date.now() + 30 * 60 * 1e3
|
|
28071
|
+
};
|
|
28072
|
+
}
|
|
28073
|
+
async function getSession(serverUrl, apiVersion, siteContentUrl, patName, patSecret) {
|
|
28074
|
+
const cacheKey = `${serverUrl}|${siteContentUrl}|${patName}`;
|
|
28075
|
+
const cached = sessionCache.get(cacheKey);
|
|
28076
|
+
if (cached && cached.expiresAt > Date.now() + 6e4) {
|
|
28077
|
+
return cached;
|
|
28078
|
+
}
|
|
28079
|
+
const session = await signIn(
|
|
28080
|
+
serverUrl,
|
|
28081
|
+
apiVersion,
|
|
28082
|
+
siteContentUrl,
|
|
28083
|
+
patName,
|
|
28084
|
+
patSecret
|
|
28085
|
+
);
|
|
28086
|
+
sessionCache.set(cacheKey, session);
|
|
28087
|
+
return session;
|
|
28088
|
+
}
|
|
28089
|
+
var inputSchema98 = z98.object({
|
|
28090
|
+
toolUseIntent: z98.string().optional().describe(
|
|
28091
|
+
"Brief description of what you intend to accomplish with this tool call"
|
|
28092
|
+
),
|
|
28093
|
+
connectionId: z98.string().describe("ID of the Tableau connection to use"),
|
|
28094
|
+
method: z98.enum(["GET", "POST", "PUT", "DELETE"]).describe(
|
|
28095
|
+
"HTTP method. GET for listing/reading, POST for creating, PUT for updates, DELETE for removal."
|
|
28096
|
+
),
|
|
28097
|
+
path: z98.string().describe(
|
|
28098
|
+
"API path appended to {serverUrl}/api/{apiVersion} (e.g., '/sites/{siteId}/projects', '/sites/{siteId}/workbooks/{workbookId}', '/sites/{siteId}/views/{viewId}/data'). The {siteId} placeholder is automatically replaced with the signed-in site ID."
|
|
28099
|
+
),
|
|
28100
|
+
queryParams: z98.record(z98.string(), z98.string()).optional().describe(
|
|
28101
|
+
"Query parameters to append (e.g., { pageSize: '100', filter: 'name:eq:Sales' }). Tableau supports field filtering via 'fields' and sorting via 'sort'."
|
|
28102
|
+
),
|
|
28103
|
+
body: z98.record(z98.string(), z98.unknown()).optional().describe(
|
|
28104
|
+
"JSON request body for POST/PUT (Tableau also accepts XML, but JSON is recommended with Accept: application/json)."
|
|
28105
|
+
)
|
|
28106
|
+
});
|
|
28107
|
+
var outputSchema98 = z98.discriminatedUnion("success", [
|
|
28108
|
+
z98.object({
|
|
28109
|
+
success: z98.literal(true),
|
|
28110
|
+
status: z98.number(),
|
|
28111
|
+
data: z98.unknown()
|
|
28112
|
+
}),
|
|
28113
|
+
z98.object({
|
|
28114
|
+
success: z98.literal(false),
|
|
28115
|
+
error: z98.string()
|
|
28116
|
+
})
|
|
28117
|
+
]);
|
|
28118
|
+
var requestTool57 = new ConnectorTool({
|
|
28119
|
+
name: "request",
|
|
28120
|
+
description: `Send authenticated requests to the Tableau REST API.
|
|
28121
|
+
The tool signs in once with the configured Personal Access Token (PAT) to obtain an X-Tableau-Auth token (cached per connection), then forwards the request with the token attached.
|
|
28122
|
+
All paths are relative to {serverUrl}/api/{apiVersion}. Use the literal placeholder \`{siteId}\` in the path \u2014 it is automatically substituted with the site ID returned from sign-in.
|
|
28123
|
+
Accept and Content-Type headers default to application/json so list responses come back as JSON instead of Tableau's default XML.`,
|
|
28124
|
+
inputSchema: inputSchema98,
|
|
28125
|
+
outputSchema: outputSchema98,
|
|
28126
|
+
async execute({ connectionId, method, path: path5, queryParams, body }, connections) {
|
|
28127
|
+
const connection = connections.find((c) => c.id === connectionId);
|
|
28128
|
+
if (!connection) {
|
|
28129
|
+
return {
|
|
28130
|
+
success: false,
|
|
28131
|
+
error: `Connection ${connectionId} not found`
|
|
28132
|
+
};
|
|
28133
|
+
}
|
|
28134
|
+
console.log(
|
|
28135
|
+
`[connector-request] tableau/${connection.name}: ${method} ${path5}`
|
|
28136
|
+
);
|
|
28137
|
+
try {
|
|
28138
|
+
const serverUrl = parameters81.serverUrl.getValue(connection);
|
|
28139
|
+
const siteContentUrl = parameters81.siteContentUrl.getValue(connection);
|
|
28140
|
+
const patName = parameters81.patName.getValue(connection);
|
|
28141
|
+
const patSecret = parameters81.patSecret.getValue(connection);
|
|
28142
|
+
const apiVersion = parameters81.apiVersion.tryGetValue(connection) || DEFAULT_API_VERSION;
|
|
28143
|
+
const session = await getSession(
|
|
28144
|
+
serverUrl,
|
|
28145
|
+
apiVersion,
|
|
28146
|
+
siteContentUrl,
|
|
28147
|
+
patName,
|
|
28148
|
+
patSecret
|
|
28149
|
+
);
|
|
28150
|
+
const resolvedPath = path5.trim().replace(/\{siteId\}/g, session.siteId).replace(/^([^/])/, "/$1");
|
|
28151
|
+
let url = `${buildBaseUrl4(serverUrl, apiVersion)}${resolvedPath}`;
|
|
28152
|
+
if (queryParams) {
|
|
28153
|
+
const searchParams = new URLSearchParams(queryParams);
|
|
28154
|
+
url += `?${searchParams.toString()}`;
|
|
28155
|
+
}
|
|
28156
|
+
const controller = new AbortController();
|
|
28157
|
+
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS75);
|
|
28158
|
+
try {
|
|
28159
|
+
const init = {
|
|
28160
|
+
method,
|
|
28161
|
+
headers: {
|
|
28162
|
+
"X-Tableau-Auth": session.authToken,
|
|
28163
|
+
Accept: "application/json",
|
|
28164
|
+
"Content-Type": "application/json"
|
|
28165
|
+
},
|
|
28166
|
+
signal: controller.signal
|
|
28167
|
+
};
|
|
28168
|
+
if (body !== void 0) {
|
|
28169
|
+
init.body = JSON.stringify(body);
|
|
28170
|
+
}
|
|
28171
|
+
const response = await fetch(url, init);
|
|
28172
|
+
const text = await response.text();
|
|
28173
|
+
const data = text ? (() => {
|
|
28174
|
+
try {
|
|
28175
|
+
return JSON.parse(text);
|
|
28176
|
+
} catch {
|
|
28177
|
+
return text;
|
|
28178
|
+
}
|
|
28179
|
+
})() : null;
|
|
28180
|
+
if (!response.ok) {
|
|
28181
|
+
const errorMessage = data && typeof data === "object" && "error" in data ? JSON.stringify(data.error) : typeof data === "string" && data ? data : `HTTP ${response.status} ${response.statusText}`;
|
|
28182
|
+
return { success: false, error: errorMessage };
|
|
28183
|
+
}
|
|
28184
|
+
return { success: true, status: response.status, data };
|
|
28185
|
+
} finally {
|
|
28186
|
+
clearTimeout(timeout);
|
|
28187
|
+
}
|
|
28188
|
+
} catch (err) {
|
|
28189
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
28190
|
+
return { success: false, error: msg };
|
|
28191
|
+
}
|
|
28192
|
+
}
|
|
28193
|
+
});
|
|
28194
|
+
|
|
28195
|
+
// ../connectors/src/connectors/tableau/index.ts
|
|
28196
|
+
var tools81 = { request: requestTool57 };
|
|
28197
|
+
var tableauConnector = new ConnectorPlugin({
|
|
28198
|
+
slug: "tableau",
|
|
28199
|
+
authType: AUTH_TYPES.PAT,
|
|
28200
|
+
name: "Tableau",
|
|
28201
|
+
description: "Connect to Tableau Cloud or Tableau Server via a Personal Access Token (PAT). Use it to enumerate projects, workbooks, views, and data sources, and to pull view data.",
|
|
28202
|
+
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/3ejrZvfw7zCDa3FPbUNQx9/d810e117b3a86c45dd96205453bf67a0/tableau-icon.svg",
|
|
28203
|
+
parameters: parameters81,
|
|
28204
|
+
releaseFlag: { dev1: true, dev2: false, prod: false },
|
|
28205
|
+
categories: ["bi"],
|
|
28206
|
+
onboarding: tableauOnboarding,
|
|
28207
|
+
systemPrompt: {
|
|
28208
|
+
en: `### Tools
|
|
28209
|
+
|
|
28210
|
+
- \`tableau_request\`: The only way to call the Tableau REST API. Use it for projects, workbooks, views, data sources, users, and permissions. The tool signs in once with the configured PAT to obtain an \`X-Tableau-Auth\` token (cached), then forwards each request with the token attached. Use the literal \`{siteId}\` placeholder in the path \u2014 it is replaced with the session's site ID automatically.
|
|
28211
|
+
|
|
28212
|
+
### Business Logic
|
|
28213
|
+
|
|
28214
|
+
The business logic type for this connector is "typescript". Use the connector SDK in your handler. Do NOT read credentials from environment variables.
|
|
28215
|
+
|
|
28216
|
+
SDK methods (client created via \`connection(connectionId)\`):
|
|
28217
|
+
- \`client.request(path, init?)\` \u2014 low-level authenticated fetch (path is appended to \`{serverUrl}/api/{apiVersion}\`; \`{siteId}\` is substituted)
|
|
28218
|
+
- \`client.getSession()\` \u2014 sign in (if needed) and return \`{ authToken, siteId, userId }\`
|
|
28219
|
+
- \`client.listProjects(options?)\` / \`client.listWorkbooks(options?)\` / \`client.listDatasources(options?)\`
|
|
28220
|
+
- \`client.listViewsForWorkbook(workbookId)\`
|
|
28221
|
+
- \`client.getViewData(viewId)\` \u2014 returns the view's underlying data as CSV text
|
|
28222
|
+
|
|
28223
|
+
\`\`\`ts
|
|
28224
|
+
import type { Context } from "hono";
|
|
28225
|
+
import { connection } from "@squadbase/vite-server/connectors/tableau";
|
|
28226
|
+
|
|
28227
|
+
const tableau = connection("<connectionId>");
|
|
28228
|
+
|
|
28229
|
+
export default async function handler(c: Context) {
|
|
28230
|
+
const { pageSize = 20 } = await c.req.json<{ pageSize?: number }>();
|
|
28231
|
+
const { workbooks, pagination } = await tableau.listWorkbooks({ pageSize });
|
|
28232
|
+
return c.json({
|
|
28233
|
+
workbooks: workbooks.workbook,
|
|
28234
|
+
totalAvailable: Number(pagination.totalAvailable),
|
|
28235
|
+
});
|
|
28236
|
+
}
|
|
28237
|
+
\`\`\`
|
|
28238
|
+
|
|
28239
|
+
### Tableau REST API Reference
|
|
28240
|
+
|
|
28241
|
+
- Base URL: \`{serverUrl}/api/{apiVersion}\` (default version 3.28; see https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_concepts_versions.htm)
|
|
28242
|
+
- Authentication: Sign-in with a PAT returns \`X-Tableau-Auth\` token, site ID, and user ID. Sessions expire after ~240 minutes idle on Tableau Cloud
|
|
28243
|
+
- Response format: JSON when \`Accept: application/json\` is sent (default); otherwise Tableau returns XML
|
|
28244
|
+
- Pagination: \`?pageSize=&pageNumber=\` query params with \`pagination\` object in response
|
|
28245
|
+
|
|
28246
|
+
#### Common Endpoints
|
|
28247
|
+
- POST \`/auth/signin\` \u2014 sign in (handled automatically)
|
|
28248
|
+
- POST \`/auth/signout\` \u2014 sign out
|
|
28249
|
+
- GET \`/sites/{siteId}/projects\` \u2014 list projects
|
|
28250
|
+
- GET \`/sites/{siteId}/workbooks\` \u2014 list workbooks (supports \`filter\`, \`sort\`)
|
|
28251
|
+
- GET \`/sites/{siteId}/workbooks/{workbookId}\` \u2014 get a workbook
|
|
28252
|
+
- GET \`/sites/{siteId}/workbooks/{workbookId}/views\` \u2014 list views in a workbook
|
|
28253
|
+
- GET \`/sites/{siteId}/views/{viewId}/data\` \u2014 get view data as CSV
|
|
28254
|
+
- GET \`/sites/{siteId}/views/{viewId}/image\` \u2014 get view as PNG
|
|
28255
|
+
- GET \`/sites/{siteId}/views/{viewId}/pdf\` \u2014 get view as PDF
|
|
28256
|
+
- GET \`/sites/{siteId}/datasources\` \u2014 list published data sources
|
|
28257
|
+
- GET \`/sites/{siteId}/users\` \u2014 list users
|
|
28258
|
+
- GET \`/sites/{siteId}/groups\` \u2014 list groups
|
|
28259
|
+
|
|
28260
|
+
#### Filter Syntax
|
|
28261
|
+
- \`filter=name:eq:Sales\` \u2014 exact match
|
|
28262
|
+
- \`filter=name:in:[Sales,Marketing]\` \u2014 set membership
|
|
28263
|
+
- \`filter=updatedAt:gte:2024-01-01T00:00:00Z\` \u2014 comparison operators (gt/gte/lt/lte)
|
|
28264
|
+
- Combine: \`filter=ownerName:eq:alice,tags:in:[finance]\``,
|
|
28265
|
+
ja: `### \u30C4\u30FC\u30EB
|
|
28266
|
+
|
|
28267
|
+
- \`tableau_request\`: Tableau REST API \u3092\u547C\u3073\u51FA\u3059\u552F\u4E00\u306E\u624B\u6BB5\u3067\u3059\u3002\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u3001\u30EF\u30FC\u30AF\u30D6\u30C3\u30AF\u3001\u30D3\u30E5\u30FC\u3001\u30C7\u30FC\u30BF\u30BD\u30FC\u30B9\u3001\u30E6\u30FC\u30B6\u30FC\u3001\u6A29\u9650\u306A\u3069\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002\u8A2D\u5B9A\u3055\u308C\u305F PAT \u3067\u4E00\u5EA6\u30B5\u30A4\u30F3\u30A4\u30F3\u3057\u3066 \`X-Tableau-Auth\` \u30C8\u30FC\u30AF\u30F3\u3092\u53D6\u5F97 (\u30AD\u30E3\u30C3\u30B7\u30E5) \u3057\u3001\u5404\u30EA\u30AF\u30A8\u30B9\u30C8\u306B\u305D\u306E\u30C8\u30FC\u30AF\u30F3\u3092\u4ED8\u3051\u3066\u9001\u4FE1\u3057\u307E\u3059\u3002\u30D1\u30B9\u5185\u306B\u306F \`{siteId}\` \u30D7\u30EC\u30FC\u30B9\u30DB\u30EB\u30C0\u30FC\u3092\u4F7F\u3063\u3066\u304F\u3060\u3055\u3044 \u2014 \u30BB\u30C3\u30B7\u30E7\u30F3\u306E\u30B5\u30A4\u30C8 ID \u3067\u81EA\u52D5\u7F6E\u63DB\u3055\u308C\u307E\u3059\u3002
|
|
28268
|
+
|
|
28269
|
+
### Business Logic
|
|
28270
|
+
|
|
28271
|
+
\u3053\u306E\u30B3\u30CD\u30AF\u30BF\u306E\u30D3\u30B8\u30CD\u30B9\u30ED\u30B8\u30C3\u30AF\u30BF\u30A4\u30D7\u306F "typescript" \u3067\u3059\u3002\u30CF\u30F3\u30C9\u30E9\u5185\u3067\u306F\u30B3\u30CD\u30AF\u30BF SDK \u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u74B0\u5883\u5909\u6570\u304B\u3089\u8A8D\u8A3C\u60C5\u5831\u3092\u8AAD\u307F\u53D6\u3089\u306A\u3044\u3067\u304F\u3060\u3055\u3044\u3002
|
|
28272
|
+
|
|
28273
|
+
SDK \u30E1\u30BD\u30C3\u30C9 (\`connection(connectionId)\` \u3067\u4F5C\u6210\u3057\u305F\u30AF\u30E9\u30A4\u30A2\u30F3\u30C8):
|
|
28274
|
+
- \`client.request(path, init?)\` \u2014 \u4F4E\u30EC\u30D9\u30EB\u8A8D\u8A3C\u4ED8\u304D fetch (path \u306F \`{serverUrl}/api/{apiVersion}\` \u306B\u8FFD\u52A0\u3055\u308C\u3001\`{siteId}\` \u306F\u7F6E\u63DB\u3055\u308C\u307E\u3059)
|
|
28275
|
+
- \`client.getSession()\` \u2014 \u30B5\u30A4\u30F3\u30A4\u30F3 (\u5FC5\u8981\u306A\u3089) \u3057\u3066 \`{ authToken, siteId, userId }\` \u3092\u8FD4\u3059
|
|
28276
|
+
- \`client.listProjects(options?)\` / \`client.listWorkbooks(options?)\` / \`client.listDatasources(options?)\`
|
|
28277
|
+
- \`client.listViewsForWorkbook(workbookId)\`
|
|
28278
|
+
- \`client.getViewData(viewId)\` \u2014 \u30D3\u30E5\u30FC\u306E\u30C7\u30FC\u30BF\u3092 CSV \u30C6\u30AD\u30B9\u30C8\u3067\u8FD4\u3059
|
|
28279
|
+
|
|
28280
|
+
\`\`\`ts
|
|
28281
|
+
import type { Context } from "hono";
|
|
28282
|
+
import { connection } from "@squadbase/vite-server/connectors/tableau";
|
|
28283
|
+
|
|
28284
|
+
const tableau = connection("<connectionId>");
|
|
28285
|
+
|
|
28286
|
+
export default async function handler(c: Context) {
|
|
28287
|
+
const { pageSize = 20 } = await c.req.json<{ pageSize?: number }>();
|
|
28288
|
+
const { workbooks, pagination } = await tableau.listWorkbooks({ pageSize });
|
|
28289
|
+
return c.json({
|
|
28290
|
+
workbooks: workbooks.workbook,
|
|
28291
|
+
totalAvailable: Number(pagination.totalAvailable),
|
|
28292
|
+
});
|
|
28293
|
+
}
|
|
28294
|
+
\`\`\`
|
|
28295
|
+
|
|
28296
|
+
### Tableau REST API \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9
|
|
28297
|
+
|
|
28298
|
+
- \u30D9\u30FC\u30B9 URL: \`{serverUrl}/api/{apiVersion}\` (\u30C7\u30D5\u30A9\u30EB\u30C8\u30D0\u30FC\u30B8\u30E7\u30F3 3.28; https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_concepts_versions.htm)
|
|
28299
|
+
- \u8A8D\u8A3C: PAT \u3067\u30B5\u30A4\u30F3\u30A4\u30F3\u3059\u308B\u3068 \`X-Tableau-Auth\` \u30C8\u30FC\u30AF\u30F3\u3001\u30B5\u30A4\u30C8 ID\u3001\u30E6\u30FC\u30B6\u30FC ID \u304C\u8FD4\u3055\u308C\u308B\u3002Tableau Cloud \u3067\u306F\u7D04 240 \u5206\u306E\u30A2\u30A4\u30C9\u30EB\u3067\u30BB\u30C3\u30B7\u30E7\u30F3\u5931\u52B9
|
|
28300
|
+
- \u30EC\u30B9\u30DD\u30F3\u30B9\u5F62\u5F0F: \`Accept: application/json\` \u3092\u9001\u308B\u3068 JSON (\u30C7\u30D5\u30A9\u30EB\u30C8)\u3002\u9001\u3089\u306A\u3044\u5834\u5408\u306F XML
|
|
28301
|
+
- \u30DA\u30FC\u30B8\u30CD\u30FC\u30B7\u30E7\u30F3: \`?pageSize=&pageNumber=\` \u30AF\u30A8\u30EA\u3002\u30EC\u30B9\u30DD\u30F3\u30B9\u306B \`pagination\` \u30AA\u30D6\u30B8\u30A7\u30AF\u30C8
|
|
28302
|
+
|
|
28303
|
+
#### \u4E3B\u8981\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8
|
|
28304
|
+
- POST \`/auth/signin\` \u2014 \u30B5\u30A4\u30F3\u30A4\u30F3 (\u81EA\u52D5\u51E6\u7406)
|
|
28305
|
+
- POST \`/auth/signout\` \u2014 \u30B5\u30A4\u30F3\u30A2\u30A6\u30C8
|
|
28306
|
+
- GET \`/sites/{siteId}/projects\` \u2014 \u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u4E00\u89A7
|
|
28307
|
+
- GET \`/sites/{siteId}/workbooks\` \u2014 \u30EF\u30FC\u30AF\u30D6\u30C3\u30AF\u4E00\u89A7 (\`filter\`, \`sort\` \u5BFE\u5FDC)
|
|
28308
|
+
- GET \`/sites/{siteId}/workbooks/{workbookId}\` \u2014 \u30EF\u30FC\u30AF\u30D6\u30C3\u30AF\u53D6\u5F97
|
|
28309
|
+
- GET \`/sites/{siteId}/workbooks/{workbookId}/views\` \u2014 \u30EF\u30FC\u30AF\u30D6\u30C3\u30AF\u5185\u306E\u30D3\u30E5\u30FC\u4E00\u89A7
|
|
28310
|
+
- GET \`/sites/{siteId}/views/{viewId}/data\` \u2014 \u30D3\u30E5\u30FC\u30C7\u30FC\u30BF\u3092 CSV \u3067\u53D6\u5F97
|
|
28311
|
+
- GET \`/sites/{siteId}/views/{viewId}/image\` \u2014 \u30D3\u30E5\u30FC\u3092 PNG \u3067\u53D6\u5F97
|
|
28312
|
+
- GET \`/sites/{siteId}/views/{viewId}/pdf\` \u2014 \u30D3\u30E5\u30FC\u3092 PDF \u3067\u53D6\u5F97
|
|
28313
|
+
- GET \`/sites/{siteId}/datasources\` \u2014 \u516C\u958B\u30C7\u30FC\u30BF\u30BD\u30FC\u30B9\u4E00\u89A7
|
|
28314
|
+
- GET \`/sites/{siteId}/users\` \u2014 \u30E6\u30FC\u30B6\u30FC\u4E00\u89A7
|
|
28315
|
+
- GET \`/sites/{siteId}/groups\` \u2014 \u30B0\u30EB\u30FC\u30D7\u4E00\u89A7
|
|
28316
|
+
|
|
28317
|
+
#### \u30D5\u30A3\u30EB\u30BF\u69CB\u6587
|
|
28318
|
+
- \`filter=name:eq:Sales\` \u2014 \u5B8C\u5168\u4E00\u81F4
|
|
28319
|
+
- \`filter=name:in:[Sales,Marketing]\` \u2014 \u96C6\u5408\u306B\u542B\u307E\u308C\u308B
|
|
28320
|
+
- \`filter=updatedAt:gte:2024-01-01T00:00:00Z\` \u2014 \u6BD4\u8F03\u6F14\u7B97\u5B50 (gt/gte/lt/lte)
|
|
28321
|
+
- \u7D44\u307F\u5408\u308F\u305B: \`filter=ownerName:eq:alice,tags:in:[finance]\``
|
|
28322
|
+
},
|
|
28323
|
+
tools: tools81,
|
|
28324
|
+
async checkConnection(params) {
|
|
28325
|
+
const serverUrl = params[parameters81.serverUrl.slug];
|
|
28326
|
+
const siteContentUrl = params[parameters81.siteContentUrl.slug];
|
|
28327
|
+
const patName = params[parameters81.patName.slug];
|
|
28328
|
+
const patSecret = params[parameters81.patSecret.slug];
|
|
28329
|
+
const apiVersion = params[parameters81.apiVersion.slug] || "3.28";
|
|
28330
|
+
if (!serverUrl || siteContentUrl == null || !patName || !patSecret) {
|
|
28331
|
+
return {
|
|
28332
|
+
success: false,
|
|
28333
|
+
error: "Missing required parameters: server-url, site-content-url, pat-name, pat-secret"
|
|
28334
|
+
};
|
|
28335
|
+
}
|
|
28336
|
+
try {
|
|
28337
|
+
const res = await fetch(
|
|
28338
|
+
`${serverUrl.replace(/\/$/, "")}/api/${apiVersion}/auth/signin`,
|
|
28339
|
+
{
|
|
28340
|
+
method: "POST",
|
|
28341
|
+
headers: {
|
|
28342
|
+
"Content-Type": "application/json",
|
|
28343
|
+
Accept: "application/json"
|
|
28344
|
+
},
|
|
28345
|
+
body: JSON.stringify({
|
|
28346
|
+
credentials: {
|
|
28347
|
+
personalAccessTokenName: patName,
|
|
28348
|
+
personalAccessTokenSecret: patSecret,
|
|
28349
|
+
site: { contentUrl: siteContentUrl }
|
|
28350
|
+
}
|
|
28351
|
+
})
|
|
28352
|
+
}
|
|
28353
|
+
);
|
|
28354
|
+
if (!res.ok) {
|
|
28355
|
+
const errorText = await res.text().catch(() => res.statusText);
|
|
28356
|
+
return {
|
|
28357
|
+
success: false,
|
|
28358
|
+
error: `Tableau sign-in failed: HTTP ${res.status} ${errorText}`
|
|
28359
|
+
};
|
|
28360
|
+
}
|
|
28361
|
+
return { success: true };
|
|
28362
|
+
} catch (error) {
|
|
28363
|
+
return {
|
|
28364
|
+
success: false,
|
|
28365
|
+
error: error instanceof Error ? error.message : String(error)
|
|
28366
|
+
};
|
|
28367
|
+
}
|
|
28368
|
+
}
|
|
28369
|
+
});
|
|
28370
|
+
|
|
28371
|
+
// ../connectors/src/connectors/outlook-oauth/tools/request.ts
|
|
28372
|
+
import { z as z99 } from "zod";
|
|
28373
|
+
var BASE_HOST13 = "https://graph.microsoft.com";
|
|
28374
|
+
var BASE_PATH_SEGMENT16 = "/v1.0";
|
|
28375
|
+
var BASE_URL42 = `${BASE_HOST13}${BASE_PATH_SEGMENT16}`;
|
|
28376
|
+
var REQUEST_TIMEOUT_MS76 = 6e4;
|
|
28377
|
+
var cachedToken33 = null;
|
|
28378
|
+
async function getProxyToken33(config) {
|
|
28379
|
+
if (cachedToken33 && cachedToken33.expiresAt > Date.now() + 6e4) {
|
|
28380
|
+
return cachedToken33.token;
|
|
28381
|
+
}
|
|
28382
|
+
const url = `${config.appApiBaseUrl}/v0/database/${config.projectId}/environment/${config.environmentId}/oauth-request-proxy-token`;
|
|
28383
|
+
const res = await fetch(url, {
|
|
28384
|
+
method: "POST",
|
|
28385
|
+
headers: {
|
|
28386
|
+
"Content-Type": "application/json",
|
|
28387
|
+
"x-api-key": config.appApiKey,
|
|
28388
|
+
"project-id": config.projectId
|
|
28389
|
+
},
|
|
28390
|
+
body: JSON.stringify({
|
|
28391
|
+
sandboxId: config.sandboxId,
|
|
28392
|
+
issuedBy: "coding-agent"
|
|
28393
|
+
})
|
|
28394
|
+
});
|
|
28395
|
+
if (!res.ok) {
|
|
28396
|
+
const errorText = await res.text().catch(() => res.statusText);
|
|
28397
|
+
throw new Error(
|
|
28398
|
+
`Failed to get proxy token: HTTP ${res.status} ${errorText}`
|
|
28399
|
+
);
|
|
28400
|
+
}
|
|
28401
|
+
const data = await res.json();
|
|
28402
|
+
cachedToken33 = {
|
|
28403
|
+
token: data.token,
|
|
28404
|
+
expiresAt: new Date(data.expiresAt).getTime()
|
|
28405
|
+
};
|
|
28406
|
+
return data.token;
|
|
28407
|
+
}
|
|
28408
|
+
var inputSchema99 = z99.object({
|
|
28409
|
+
toolUseIntent: z99.string().optional().describe(
|
|
28410
|
+
"Brief description of what you intend to accomplish with this tool call"
|
|
28411
|
+
),
|
|
28412
|
+
connectionId: z99.string().describe("ID of the Outlook OAuth connection to use"),
|
|
28413
|
+
method: z99.enum(["GET"]).describe("HTTP method (read-only, GET only)"),
|
|
28414
|
+
path: z99.string().describe(
|
|
28415
|
+
"Microsoft Graph path appended to https://graph.microsoft.com/v1.0. Covers Outlook Mail (e.g. '/me', '/me/messages', '/me/messages/{id}', '/me/mailFolders', '/me/messages/{id}/attachments') and Outlook Calendar (e.g. '/me/calendars', '/me/events', '/me/events/{id}', '/me/calendarView'). Use '/me' as the user prefix."
|
|
28416
|
+
),
|
|
28417
|
+
queryParams: z99.record(z99.string(), z99.string()).optional().describe(
|
|
28418
|
+
`Query parameters to append. Microsoft Graph supports OData operators ($filter, $orderby, $top, $skip, $select, $expand, $search). Examples: { $top: '10', $select: 'subject,from,receivedDateTime' } for mail; { $filter: "conversationId eq '<id>'", $orderby: 'receivedDateTime asc' } for a thread; { startDateTime: '2025-01-15T00:00:00Z', endDateTime: '2025-01-16T00:00:00Z', $orderby: 'start/dateTime' } for calendarView.`
|
|
28419
|
+
)
|
|
28420
|
+
});
|
|
28421
|
+
var outputSchema99 = z99.discriminatedUnion("success", [
|
|
28422
|
+
z99.object({
|
|
28423
|
+
success: z99.literal(true),
|
|
28424
|
+
status: z99.number(),
|
|
28425
|
+
data: z99.record(z99.string(), z99.unknown())
|
|
28426
|
+
}),
|
|
28427
|
+
z99.object({
|
|
28428
|
+
success: z99.literal(false),
|
|
28429
|
+
error: z99.string()
|
|
28430
|
+
})
|
|
28431
|
+
]);
|
|
28432
|
+
var requestTool58 = new ConnectorTool({
|
|
28433
|
+
name: "request",
|
|
28434
|
+
description: `Send authenticated GET requests to Microsoft Graph for Outlook Mail and Calendar.
|
|
28435
|
+
Authentication is handled automatically via OAuth proxy (Microsoft Entra ID).
|
|
28436
|
+
All paths are relative to https://graph.microsoft.com/v1.0. Use '/me' as the user prefix.
|
|
28437
|
+
Covers mailbox (\`/me/messages\`, \`/me/mailFolders\`), threads (\`/me/messages?$filter=conversationId eq '<id>'\`), attachments (\`/me/messages/{id}/attachments\`), calendars (\`/me/calendars\`), and events (\`/me/events\`, \`/me/calendarView\` for expanded occurrences).
|
|
28438
|
+
For full-text search use the \`$search\` query parameter (must be wrapped in double quotes); for filtering use \`$filter\` with OData syntax (e.g., \`receivedDateTime ge 2025-01-01T00:00:00Z\`).`,
|
|
28439
|
+
inputSchema: inputSchema99,
|
|
28440
|
+
outputSchema: outputSchema99,
|
|
28441
|
+
async execute({ connectionId, method, path: path5, queryParams }, connections, config) {
|
|
28442
|
+
const connection = connections.find((c) => c.id === connectionId);
|
|
28443
|
+
if (!connection) {
|
|
28444
|
+
return {
|
|
28445
|
+
success: false,
|
|
28446
|
+
error: `Connection ${connectionId} not found`
|
|
28447
|
+
};
|
|
28448
|
+
}
|
|
28449
|
+
console.log(
|
|
28450
|
+
`[connector-request] outlook-oauth/${connection.name}: ${method} ${path5}`
|
|
28451
|
+
);
|
|
28452
|
+
try {
|
|
28453
|
+
const normalizedPath = normalizeRequestPath(path5, BASE_PATH_SEGMENT16);
|
|
28454
|
+
let url = `${BASE_URL42}${normalizedPath}`;
|
|
28455
|
+
if (queryParams) {
|
|
28456
|
+
const searchParams = new URLSearchParams(queryParams);
|
|
28457
|
+
url += `?${searchParams.toString()}`;
|
|
28458
|
+
}
|
|
28459
|
+
const token = await getProxyToken33(config.oauthProxy);
|
|
28460
|
+
const proxyUrl = `https://${config.oauthProxy.sandboxId}.${config.oauthProxy.previewBaseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
28461
|
+
const controller = new AbortController();
|
|
28462
|
+
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS76);
|
|
28463
|
+
try {
|
|
28464
|
+
const response = await fetch(proxyUrl, {
|
|
28465
|
+
method: "POST",
|
|
28466
|
+
headers: {
|
|
28467
|
+
"Content-Type": "application/json",
|
|
28468
|
+
Authorization: `Bearer ${token}`
|
|
28469
|
+
},
|
|
28470
|
+
body: JSON.stringify({
|
|
28471
|
+
url,
|
|
28472
|
+
method
|
|
28473
|
+
}),
|
|
28474
|
+
signal: controller.signal
|
|
28475
|
+
});
|
|
28476
|
+
const data = await response.json();
|
|
28477
|
+
if (!response.ok) {
|
|
28478
|
+
const errorMessage = typeof data?.error === "string" ? data.error : typeof data?.message === "string" ? data.message : `HTTP ${response.status} ${response.statusText}`;
|
|
28479
|
+
return { success: false, error: errorMessage };
|
|
28480
|
+
}
|
|
28481
|
+
return { success: true, status: response.status, data };
|
|
28482
|
+
} finally {
|
|
28483
|
+
clearTimeout(timeout);
|
|
28484
|
+
}
|
|
28485
|
+
} catch (err) {
|
|
28486
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
28487
|
+
return { success: false, error: msg };
|
|
28488
|
+
}
|
|
28489
|
+
}
|
|
28490
|
+
});
|
|
28491
|
+
|
|
28492
|
+
// ../connectors/src/connectors/outlook-oauth/setup.ts
|
|
28493
|
+
var requestToolName14 = `outlook-oauth_${requestTool58.name}`;
|
|
28494
|
+
var outlookOnboarding = new ConnectorOnboarding({
|
|
28495
|
+
connectionSetupInstructions: {
|
|
28496
|
+
ja: `\u4EE5\u4E0B\u306E\u624B\u9806\u3067 Outlook \u30B3\u30CD\u30AF\u30B7\u30E7\u30F3\u306E\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u3092\u884C\u3063\u3066\u304F\u3060\u3055\u3044\u3002
|
|
28497
|
+
|
|
28498
|
+
1. \`${requestToolName14}\` \u3092\u547C\u3073\u51FA\u3057\u3066\u8A8D\u8A3C\u6E08\u307F\u30E6\u30FC\u30B6\u30FC\u306E\u30D7\u30ED\u30D5\u30A3\u30FC\u30EB\u3092\u53D6\u5F97\u3059\u308B:
|
|
28499
|
+
- \`method\`: \`"GET"\`
|
|
28500
|
+
- \`path\`: \`"/me"\`
|
|
28501
|
+
2. \u30A8\u30E9\u30FC\u304C\u8FD4\u3055\u308C\u305F\u5834\u5408\u306F\u3001OAuth \u8A8D\u8A3C\u304C\u6B63\u3057\u304F\u5B8C\u4E86\u3057\u3066\u3044\u308B\u304B\u3092\u30E6\u30FC\u30B6\u30FC\u306B\u78BA\u8A8D\u3059\u308B\u3088\u3046\u4F1D\u3048\u308B
|
|
28502
|
+
3. \`${requestToolName14}\` \u3092\u547C\u3073\u51FA\u3057\u3066\u30E1\u30FC\u30EB\u30D5\u30A9\u30EB\u30C0\u4E00\u89A7\u3092\u53D6\u5F97\u3059\u308B:
|
|
28503
|
+
- \`method\`: \`"GET"\`
|
|
28504
|
+
- \`path\`: \`"/me/mailFolders"\`
|
|
28505
|
+
|
|
28506
|
+
#### \u5236\u7D04
|
|
28507
|
+
- **\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u4E2D\u306B\u30E1\u30C3\u30BB\u30FC\u30B8\u672C\u6587\u3092\u8AAD\u307F\u53D6\u3089\u306A\u3044\u3053\u3068**\u3002\u5B9F\u884C\u3057\u3066\u3088\u3044\u306E\u306F\u4E0A\u8A18\u306E\u30D7\u30ED\u30D5\u30A3\u30FC\u30EB\u53D6\u5F97\u3068\u30D5\u30A9\u30EB\u30C0\u4E00\u89A7\u53D6\u5F97\u306E\u307F
|
|
28508
|
+
- \u30C4\u30FC\u30EB\u9593\u306F1\u6587\u3060\u3051\u66F8\u3044\u3066\u5373\u6B21\u306E\u30C4\u30FC\u30EB\u547C\u3073\u51FA\u3057`,
|
|
28509
|
+
en: `Follow these steps to set up the Outlook connection.
|
|
28510
|
+
|
|
28511
|
+
1. Call \`${requestToolName14}\` to get the authenticated user's profile:
|
|
28512
|
+
- \`method\`: \`"GET"\`
|
|
28513
|
+
- \`path\`: \`"/me"\`
|
|
28514
|
+
2. If an error is returned, ask the user to verify that OAuth authentication completed correctly
|
|
28515
|
+
3. Call \`${requestToolName14}\` to get the mail folder list:
|
|
28516
|
+
- \`method\`: \`"GET"\`
|
|
28517
|
+
- \`path\`: \`"/me/mailFolders"\`
|
|
28518
|
+
|
|
28519
|
+
#### Constraints
|
|
28520
|
+
- **Do NOT read message bodies during setup**. Only the profile and mail-folder requests specified above are allowed
|
|
28521
|
+
- Write only 1 sentence between tool calls, then immediately call the next tool`
|
|
28522
|
+
},
|
|
28523
|
+
dataOverviewInstructions: {
|
|
28524
|
+
en: `Mail
|
|
28525
|
+
1. Call outlook-oauth_request with GET /me/mailFolders to list mail folders
|
|
28526
|
+
2. Call outlook-oauth_request with GET /me/messages?$top=5&$select=id,subject,from,receivedDateTime,conversationId to sample recent messages
|
|
28527
|
+
3. Call outlook-oauth_request with GET /me/messages/{id} for an interesting message to inspect the full payload
|
|
28528
|
+
4. Call outlook-oauth_request with GET /me/mailFolders/{folderId}/messages?$top=5 to drill into a specific folder
|
|
28529
|
+
5. For threading, call outlook-oauth_request with GET /me/messages?$filter=conversationId%20eq%20'<id>'&$orderby=receivedDateTime%20asc to pull every message in a conversation
|
|
28530
|
+
|
|
28531
|
+
Calendar
|
|
28532
|
+
6. Call outlook-oauth_request with GET /me/calendars to list calendars (default + shared)
|
|
28533
|
+
7. Call outlook-oauth_request with GET /me/calendarView?startDateTime=<startISO>&endDateTime=<endISO>&$top=5&$select=id,subject,start,end,attendees to sample upcoming occurrences (expands recurring events)
|
|
28534
|
+
8. Call outlook-oauth_request with GET /me/events/{eventId} for an interesting event to inspect attendees, body, and location`,
|
|
28535
|
+
ja: `\u30E1\u30FC\u30EB
|
|
28536
|
+
1. outlook-oauth_request \u3067 GET /me/mailFolders \u3092\u547C\u3073\u51FA\u3057\u3001\u30E1\u30FC\u30EB\u30D5\u30A9\u30EB\u30C0\u4E00\u89A7\u3092\u53D6\u5F97
|
|
28537
|
+
2. outlook-oauth_request \u3067 GET /me/messages?$top=5&$select=id,subject,from,receivedDateTime,conversationId \u3092\u547C\u3073\u51FA\u3057\u3001\u6700\u65B0\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u30B5\u30F3\u30D7\u30EA\u30F3\u30B0
|
|
28538
|
+
3. \u8208\u5473\u306E\u3042\u308B\u30E1\u30C3\u30BB\u30FC\u30B8\u306B\u3064\u3044\u3066 outlook-oauth_request \u3067 GET /me/messages/{id} \u3092\u547C\u3073\u51FA\u3057\u3001\u30DA\u30A4\u30ED\u30FC\u30C9\u5168\u4F53\u3092\u78BA\u8A8D
|
|
28539
|
+
4. outlook-oauth_request \u3067 GET /me/mailFolders/{folderId}/messages?$top=5 \u3092\u547C\u3073\u51FA\u3057\u3001\u7279\u5B9A\u30D5\u30A9\u30EB\u30C0\u306E\u4E2D\u8EAB\u3092\u78BA\u8A8D
|
|
28540
|
+
5. \u30B9\u30EC\u30C3\u30C9\u3092\u8FFD\u3046\u5834\u5408\u306F outlook-oauth_request \u3067 GET /me/messages?$filter=conversationId%20eq%20'<id>'&$orderby=receivedDateTime%20asc \u3092\u547C\u3073\u51FA\u3057\u3001\u4F1A\u8A71\u306B\u542B\u307E\u308C\u308B\u5168\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u53D6\u5F97
|
|
28541
|
+
|
|
28542
|
+
\u30AB\u30EC\u30F3\u30C0\u30FC
|
|
28543
|
+
6. outlook-oauth_request \u3067 GET /me/calendars \u3092\u547C\u3073\u51FA\u3057\u3001\u30AB\u30EC\u30F3\u30C0\u30FC\u4E00\u89A7 (\u30C7\u30D5\u30A9\u30EB\u30C8 + \u5171\u6709) \u3092\u53D6\u5F97
|
|
28544
|
+
7. outlook-oauth_request \u3067 GET /me/calendarView?startDateTime=<startISO>&endDateTime=<endISO>&$top=5&$select=id,subject,start,end,attendees \u3092\u547C\u3073\u51FA\u3057\u3001\u76F4\u8FD1\u306E occurrence \u3092\u30B5\u30F3\u30D7\u30EA\u30F3\u30B0 (\u7E70\u308A\u8FD4\u3057\u30A4\u30D9\u30F3\u30C8\u3092\u5C55\u958B)
|
|
28545
|
+
8. \u8208\u5473\u306E\u3042\u308B\u30A4\u30D9\u30F3\u30C8\u306B\u3064\u3044\u3066 outlook-oauth_request \u3067 GET /me/events/{eventId} \u3092\u547C\u3073\u51FA\u3057\u3001\u53C2\u52A0\u8005\u30FB\u672C\u6587\u30FB\u5834\u6240\u3092\u78BA\u8A8D`
|
|
28546
|
+
}
|
|
28547
|
+
});
|
|
28548
|
+
|
|
28549
|
+
// ../connectors/src/connectors/outlook-oauth/parameters.ts
|
|
28550
|
+
var parameters82 = {};
|
|
28551
|
+
|
|
28552
|
+
// ../connectors/src/connectors/outlook-oauth/index.ts
|
|
28553
|
+
var tools82 = { request: requestTool58 };
|
|
28554
|
+
var outlookOauthConnector = new ConnectorPlugin({
|
|
28555
|
+
slug: "outlook",
|
|
28556
|
+
authType: AUTH_TYPES.OAUTH,
|
|
28557
|
+
name: "Outlook",
|
|
28558
|
+
description: "Connect to Microsoft Outlook (Mail + Calendar) via Microsoft Graph using OAuth. Read-only access to the user's mailbox, mail folders, messages, attachments, calendars, and events.",
|
|
28559
|
+
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/1J1FrRTYJjOh3CcSIqsz3I/6a467b4d926075ff99dc60820e0ae4b1/Microsoft_Outlook_Icon__2025%C3%A2__present_.svg",
|
|
28560
|
+
parameters: parameters82,
|
|
28561
|
+
releaseFlag: { dev1: true, dev2: false, prod: false },
|
|
28562
|
+
categories: ["productivity"],
|
|
28563
|
+
onboarding: outlookOnboarding,
|
|
28564
|
+
proxyPolicy: {
|
|
28565
|
+
allowlist: [
|
|
28566
|
+
{
|
|
28567
|
+
host: "graph.microsoft.com",
|
|
28568
|
+
methods: ["GET"]
|
|
28569
|
+
}
|
|
28570
|
+
]
|
|
28571
|
+
},
|
|
28572
|
+
systemPrompt: {
|
|
28573
|
+
en: `### Tools
|
|
28574
|
+
|
|
28575
|
+
- \`outlook-oauth_request\`: The only way to call Microsoft Graph for Outlook (read-only). Use it to fetch the user profile (\`/me\`), list mail folders (\`/me/mailFolders\`), read messages (\`/me/messages\`, \`/me/messages/{id}\`), fetch attachments (\`/me/messages/{id}/attachments\`), list calendars (\`/me/calendars\`), and read events (\`/me/events\`, \`/me/calendarView\`). Authentication is configured automatically via OAuth.
|
|
28576
|
+
|
|
28577
|
+
### Microsoft Graph Reference (Outlook Mail)
|
|
28578
|
+
|
|
28579
|
+
#### Available Endpoints
|
|
28580
|
+
- GET \`/me\` \u2014 Get the signed-in user's profile (displayName, mail, userPrincipalName)
|
|
28581
|
+
- GET \`/me/mailFolders\` \u2014 List the user's mail folders (Inbox, SentItems, Drafts, etc.)
|
|
28582
|
+
- GET \`/me/mailFolders/{folderId}\` \u2014 Get a specific mail folder
|
|
28583
|
+
- GET \`/me/mailFolders/{folderId}/messages\` \u2014 List messages within a folder
|
|
28584
|
+
- GET \`/me/messages\` \u2014 List messages across all folders
|
|
28585
|
+
- GET \`/me/messages/{id}\` \u2014 Get a specific message with full body
|
|
28586
|
+
- GET \`/me/messages/{id}/attachments\` \u2014 List attachments on a message
|
|
28587
|
+
- GET \`/me/messages/{id}/attachments/{attachmentId}\` \u2014 Get a specific attachment
|
|
28588
|
+
|
|
28589
|
+
#### Well-Known Folder Names (usable in place of {folderId})
|
|
28590
|
+
- \`inbox\`, \`sentitems\`, \`drafts\`, \`deleteditems\`, \`junkemail\`, \`outbox\`, \`archive\`
|
|
28591
|
+
|
|
28592
|
+
#### Conversations (Threads)
|
|
28593
|
+
- Every message has a \`conversationId\`. Fetch all messages in a thread with: GET \`/me/messages?$filter=conversationId eq '<id>'&$orderby=receivedDateTime asc\` (Gmail-style \`getThread\` equivalent).
|
|
28594
|
+
|
|
28595
|
+
### Microsoft Graph Reference (Outlook Calendar)
|
|
28596
|
+
|
|
28597
|
+
#### Available Endpoints
|
|
28598
|
+
- GET \`/me/calendars\` \u2014 List the user's calendars (default + any shared/group calendars)
|
|
28599
|
+
- GET \`/me/calendars/{calendarId}\` \u2014 Get a calendar's metadata
|
|
28600
|
+
- GET \`/me/events\` \u2014 List events on the default calendar (recurring events are returned as series masters \u2014 use \`/me/calendarView\` to expand)
|
|
28601
|
+
- GET \`/me/calendars/{calendarId}/events\` \u2014 List events on a specific calendar
|
|
28602
|
+
- GET \`/me/events/{eventId}\` \u2014 Get a single event
|
|
28603
|
+
- GET \`/me/calendarView?startDateTime=&endDateTime=\` \u2014 List event **occurrences** in a date range (expands recurring events). Equivalent to Google Calendar's \`events?singleEvents=true\`
|
|
28604
|
+
- GET \`/me/calendars/{calendarId}/calendarView?startDateTime=&endDateTime=\` \u2014 Same, scoped to a specific calendar
|
|
28605
|
+
|
|
28606
|
+
#### Calendar Tips
|
|
28607
|
+
- Use \`/me/calendarView\` when you want individual occurrences of recurring events; \`/me/events\` is closer to the raw stored series
|
|
28608
|
+
- \`startDateTime\` / \`endDateTime\` must be ISO-8601 UTC, e.g. \`2025-01-15T00:00:00Z\`
|
|
28609
|
+
- Combine with \`$select=subject,start,end,attendees,location\` and \`$orderby=start/dateTime\` to keep responses small and sorted
|
|
28610
|
+
|
|
28611
|
+
#### Key Query Parameters (OData, shared by Mail + Calendar)
|
|
28612
|
+
- \`$top\` \u2014 Maximum number of results (default 10, max 1000)
|
|
28613
|
+
- \`$skip\` \u2014 Skip the first N results (for paging)
|
|
28614
|
+
- \`$select\` \u2014 Comma-separated list of properties (e.g. \`subject,from,receivedDateTime,bodyPreview\`)
|
|
28615
|
+
- \`$orderby\` \u2014 Sort (e.g. \`receivedDateTime desc\`, \`start/dateTime asc\`)
|
|
28616
|
+
- \`$filter\` \u2014 OData filter (e.g. \`receivedDateTime ge 2025-01-01T00:00:00Z\`, \`from/emailAddress/address eq 'a@b.com'\`, \`isRead eq false\`, \`conversationId eq '<id>'\`, \`start/dateTime ge '2025-01-15T00:00:00'\`)
|
|
28617
|
+
- \`$search\` \u2014 Full-text search; must be wrapped in double quotes (e.g. \`$search="project status"\`). \`$search\` and \`$filter\` cannot be combined
|
|
28618
|
+
- \`$expand\` \u2014 Expand related resources (e.g. \`attachments\`, \`instances\` for recurring events)
|
|
28619
|
+
- \`$count=true\` \u2014 Return total count (requires \`ConsistencyLevel: eventual\` header on some endpoints)
|
|
28620
|
+
|
|
28621
|
+
#### Pagination
|
|
28622
|
+
- Responses include \`@odata.nextLink\` when more results exist; call that URL (or its path) to get the next page
|
|
28623
|
+
|
|
28624
|
+
#### Tips
|
|
28625
|
+
- Use \`/me\` for the signed-in user \u2014 never substitute another user ID
|
|
28626
|
+
- Prefer \`$select\` to avoid huge payloads; the full message body can be MB-sized when HTML
|
|
28627
|
+
- \`bodyPreview\` (first ~255 chars) is included by default and is cheap for triage
|
|
28628
|
+
- Date/time values are ISO-8601; calendar event times also include a \`timeZone\` field
|
|
28629
|
+
|
|
28630
|
+
### Business Logic
|
|
28631
|
+
|
|
28632
|
+
The business logic type for this connector is "typescript". Write handler code using the connector SDK shown below. Do NOT access credentials directly from environment variables and do NOT read \`INTERNAL_SQUADBASE_*\` env vars \u2014 the SDK takes care of OAuth.
|
|
28633
|
+
|
|
28634
|
+
SDK surface (client created via \`connection(connectionId)\`):
|
|
28635
|
+
|
|
28636
|
+
Mail:
|
|
28637
|
+
- \`client.request(path, init?)\` \u2014 low-level authenticated fetch (path appended to \`https://graph.microsoft.com/v1.0\`)
|
|
28638
|
+
- \`client.getProfile()\` \u2014 fetch the authenticated user's profile
|
|
28639
|
+
- \`client.listMailFolders()\` \u2014 list all mail folders
|
|
28640
|
+
- \`client.listMessages(options?)\` \u2014 list messages with optional \`top\`, \`skip\`, \`filter\`, \`orderBy\`, \`select\`, \`search\`
|
|
28641
|
+
- \`client.listMessagesInFolder(folderId, options?)\` \u2014 list messages in a folder (well-known names like \`inbox\` work)
|
|
28642
|
+
- \`client.getMessage(id, options?)\` \u2014 fetch a specific message
|
|
28643
|
+
- \`client.listConversation(conversationId, options?)\` \u2014 fetch every message in a thread (Gmail-style \`getThread\` equivalent; orders oldest-first by default)
|
|
28644
|
+
|
|
28645
|
+
Attachments:
|
|
28646
|
+
- \`client.listAttachments(messageId)\` \u2014 list attachments on a message
|
|
28647
|
+
- \`client.getAttachment(messageId, attachmentId)\` \u2014 fetch a single attachment (file attachments include base64 \`contentBytes\`)
|
|
28648
|
+
|
|
28649
|
+
Calendar:
|
|
28650
|
+
- \`client.listCalendars()\` \u2014 list calendars accessible to the user
|
|
28651
|
+
- \`client.listEvents(options?)\` \u2014 list events on the default calendar (or pass \`{ calendarId }\` for a specific one). Recurring events are returned as series masters
|
|
28652
|
+
- \`client.getEvent(id)\` \u2014 fetch a single event
|
|
28653
|
+
- \`client.listCalendarView(startDateTime, endDateTime, options?)\` \u2014 list event **occurrences** in a date range (recurring events expanded). Equivalent to Google Calendar's \`events?singleEvents=true\`
|
|
28654
|
+
|
|
28655
|
+
If a handler test fails with \`Connection proxy is not configured\`, retry \u2014 the sandbox is still initializing. Do NOT abandon the SDK and construct OAuth proxy URLs manually.
|
|
28656
|
+
|
|
28657
|
+
#### Example
|
|
28658
|
+
|
|
28659
|
+
\`\`\`ts
|
|
28660
|
+
import { connection } from "@squadbase/vite-server/connectors/outlook-oauth";
|
|
28661
|
+
|
|
28662
|
+
const outlook = connection("<connectionId>");
|
|
28663
|
+
|
|
28664
|
+
// Get user profile
|
|
28665
|
+
const profile = await outlook.getProfile();
|
|
28666
|
+
console.log(profile.displayName, profile.mail);
|
|
28667
|
+
|
|
28668
|
+
// List recent unread messages in Inbox
|
|
28669
|
+
const messages = await outlook.listMessagesInFolder("inbox", {
|
|
28670
|
+
top: 10,
|
|
28671
|
+
filter: "isRead eq false",
|
|
28672
|
+
orderBy: "receivedDateTime desc",
|
|
28673
|
+
select: ["id", "subject", "from", "receivedDateTime", "bodyPreview", "conversationId"],
|
|
28674
|
+
});
|
|
28675
|
+
for (const msg of messages.value) {
|
|
28676
|
+
console.log(msg.receivedDateTime, msg.from?.emailAddress.address, msg.subject);
|
|
28677
|
+
}
|
|
28678
|
+
|
|
28679
|
+
// Pull a whole conversation
|
|
28680
|
+
const first = messages.value[0];
|
|
28681
|
+
if (first?.conversationId) {
|
|
28682
|
+
const thread = await outlook.listConversation(first.conversationId);
|
|
28683
|
+
thread.value.forEach(m => console.log(m.receivedDateTime, m.bodyPreview));
|
|
28684
|
+
}
|
|
28685
|
+
|
|
28686
|
+
// Fetch attachments on a message that has them
|
|
28687
|
+
if (first?.hasAttachments) {
|
|
28688
|
+
const atts = await outlook.listAttachments(first.id);
|
|
28689
|
+
for (const a of atts.value) {
|
|
28690
|
+
const full = await outlook.getAttachment(first.id, a.id);
|
|
28691
|
+
console.log(full.name, full.contentType, full.size);
|
|
28692
|
+
// full.contentBytes is base64 for file attachments
|
|
28693
|
+
}
|
|
28694
|
+
}
|
|
28695
|
+
|
|
28696
|
+
// List today's calendar events (expanded occurrences)
|
|
28697
|
+
const todayStart = new Date(); todayStart.setHours(0, 0, 0, 0);
|
|
28698
|
+
const todayEnd = new Date(todayStart); todayEnd.setDate(todayEnd.getDate() + 1);
|
|
28699
|
+
const events = await outlook.listCalendarView(
|
|
28700
|
+
todayStart.toISOString(),
|
|
28701
|
+
todayEnd.toISOString(),
|
|
28702
|
+
{ orderBy: "start/dateTime", select: ["id", "subject", "start", "end", "attendees"] },
|
|
28703
|
+
);
|
|
28704
|
+
events.value.forEach(e => console.log(e.start.dateTime, e.subject));
|
|
28705
|
+
\`\`\``,
|
|
28706
|
+
ja: `### \u30C4\u30FC\u30EB
|
|
28707
|
+
|
|
28708
|
+
- \`outlook-oauth_request\`: Outlook \u5411\u3051\u306E Microsoft Graph \u3092\u547C\u3073\u51FA\u3059\u552F\u4E00\u306E\u624B\u6BB5\u3067\u3059\uFF08\u8AAD\u307F\u53D6\u308A\u5C02\u7528\uFF09\u3002\u30E6\u30FC\u30B6\u30FC\u30D7\u30ED\u30D5\u30A3\u30FC\u30EB (\`/me\`)\u3001\u30E1\u30FC\u30EB\u30D5\u30A9\u30EB\u30C0 (\`/me/mailFolders\`)\u3001\u30E1\u30C3\u30BB\u30FC\u30B8 (\`/me/messages\`)\u3001\u6DFB\u4ED8\u30D5\u30A1\u30A4\u30EB (\`/me/messages/{id}/attachments\`)\u3001\u30AB\u30EC\u30F3\u30C0\u30FC (\`/me/calendars\`)\u3001\u30A4\u30D9\u30F3\u30C8 (\`/me/events\`, \`/me/calendarView\`) \u306E\u53D6\u5F97\u306B\u4F7F\u3044\u307E\u3059\u3002OAuth \u7D4C\u7531\u3067\u8A8D\u8A3C\u306F\u81EA\u52D5\u8A2D\u5B9A\u3055\u308C\u307E\u3059\u3002
|
|
28709
|
+
|
|
28710
|
+
### Microsoft Graph \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9 (Outlook \u30E1\u30FC\u30EB)
|
|
28711
|
+
|
|
28712
|
+
#### \u5229\u7528\u53EF\u80FD\u306A\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8
|
|
28713
|
+
- GET \`/me\` \u2014 \u30B5\u30A4\u30F3\u30A4\u30F3\u30E6\u30FC\u30B6\u30FC\u306E\u30D7\u30ED\u30D5\u30A3\u30FC\u30EB (displayName, mail, userPrincipalName)
|
|
28714
|
+
- GET \`/me/mailFolders\` \u2014 \u30E1\u30FC\u30EB\u30D5\u30A9\u30EB\u30C0\u4E00\u89A7 (Inbox, SentItems, Drafts \u306A\u3069)
|
|
28715
|
+
- GET \`/me/mailFolders/{folderId}\` \u2014 \u7279\u5B9A\u30D5\u30A9\u30EB\u30C0\u306E\u53D6\u5F97
|
|
28716
|
+
- GET \`/me/mailFolders/{folderId}/messages\` \u2014 \u30D5\u30A9\u30EB\u30C0\u5185\u306E\u30E1\u30C3\u30BB\u30FC\u30B8\u4E00\u89A7
|
|
28717
|
+
- GET \`/me/messages\` \u2014 \u5168\u30D5\u30A9\u30EB\u30C0\u6A2A\u65AD\u306E\u30E1\u30C3\u30BB\u30FC\u30B8\u4E00\u89A7
|
|
28718
|
+
- GET \`/me/messages/{id}\` \u2014 \u7279\u5B9A\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u672C\u6587\u8FBC\u307F\u3067\u53D6\u5F97
|
|
28719
|
+
- GET \`/me/messages/{id}/attachments\` \u2014 \u30E1\u30C3\u30BB\u30FC\u30B8\u306E\u6DFB\u4ED8\u30D5\u30A1\u30A4\u30EB\u4E00\u89A7
|
|
28720
|
+
- GET \`/me/messages/{id}/attachments/{attachmentId}\` \u2014 \u6DFB\u4ED8\u30D5\u30A1\u30A4\u30EB\u5358\u4F53\u53D6\u5F97
|
|
28721
|
+
|
|
28722
|
+
#### Well-Known \u30D5\u30A9\u30EB\u30C0\u540D ({folderId} \u306E\u4EE3\u308F\u308A\u306B\u4F7F\u7528\u53EF\u80FD)
|
|
28723
|
+
- \`inbox\`, \`sentitems\`, \`drafts\`, \`deleteditems\`, \`junkemail\`, \`outbox\`, \`archive\`
|
|
28724
|
+
|
|
28725
|
+
#### \u4F1A\u8A71 (\u30B9\u30EC\u30C3\u30C9)
|
|
28726
|
+
- \u3059\u3079\u3066\u306E\u30E1\u30C3\u30BB\u30FC\u30B8\u306F \`conversationId\` \u3092\u6301\u3064\u3002\u30B9\u30EC\u30C3\u30C9\u5185\u306E\u5168\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u53D6\u5F97\u3059\u308B\u306B\u306F: GET \`/me/messages?$filter=conversationId eq '<id>'&$orderby=receivedDateTime asc\` (Gmail \u306E \`getThread\` \u76F8\u5F53)\u3002
|
|
28727
|
+
|
|
28728
|
+
### Microsoft Graph \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9 (Outlook \u30AB\u30EC\u30F3\u30C0\u30FC)
|
|
28729
|
+
|
|
28730
|
+
#### \u5229\u7528\u53EF\u80FD\u306A\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8
|
|
28731
|
+
- GET \`/me/calendars\` \u2014 \u30E6\u30FC\u30B6\u30FC\u306E\u30AB\u30EC\u30F3\u30C0\u30FC\u4E00\u89A7 (\u30C7\u30D5\u30A9\u30EB\u30C8 + \u5171\u6709/\u30B0\u30EB\u30FC\u30D7\u30AB\u30EC\u30F3\u30C0\u30FC)
|
|
28732
|
+
- GET \`/me/calendars/{calendarId}\` \u2014 \u30AB\u30EC\u30F3\u30C0\u30FC\u5358\u4F53\u53D6\u5F97
|
|
28733
|
+
- GET \`/me/events\` \u2014 \u30C7\u30D5\u30A9\u30EB\u30C8\u30AB\u30EC\u30F3\u30C0\u30FC\u306E\u30A4\u30D9\u30F3\u30C8\u4E00\u89A7\uFF08\u7E70\u308A\u8FD4\u3057\u30A4\u30D9\u30F3\u30C8\u306F series master \u306E\u307E\u307E\u8FD4\u308B \u2014 \u5C55\u958B\u3057\u305F\u3044\u5834\u5408\u306F \`/me/calendarView\`\uFF09
|
|
28734
|
+
- GET \`/me/calendars/{calendarId}/events\` \u2014 \u7279\u5B9A\u30AB\u30EC\u30F3\u30C0\u30FC\u306E\u30A4\u30D9\u30F3\u30C8\u4E00\u89A7
|
|
28735
|
+
- GET \`/me/events/{eventId}\` \u2014 \u30A4\u30D9\u30F3\u30C8\u5358\u4F53\u53D6\u5F97
|
|
28736
|
+
- GET \`/me/calendarView?startDateTime=&endDateTime=\` \u2014 \u65E5\u4ED8\u7BC4\u56F2\u5185\u306E\u30A4\u30D9\u30F3\u30C8 **occurrence** \u4E00\u89A7\uFF08\u7E70\u308A\u8FD4\u3057\u3092\u5C55\u958B\uFF09\u3002Google Calendar \u306E \`events?singleEvents=true\` \u76F8\u5F53
|
|
28737
|
+
- GET \`/me/calendars/{calendarId}/calendarView?startDateTime=&endDateTime=\` \u2014 \u540C\u4E0A\u3001\u7279\u5B9A\u30AB\u30EC\u30F3\u30C0\u30FC\u7248
|
|
28738
|
+
|
|
28739
|
+
#### \u30AB\u30EC\u30F3\u30C0\u30FC Tips
|
|
28740
|
+
- \u7E70\u308A\u8FD4\u3057\u30A4\u30D9\u30F3\u30C8\u306E\u500B\u5225 occurrence \u304C\u6B32\u3057\u3044\u5834\u5408\u306F \`/me/calendarView\`\u3001\u751F\u306E\u30B7\u30EA\u30FC\u30BA\u304C\u6B32\u3057\u3044\u5834\u5408\u306F \`/me/events\`
|
|
28741
|
+
- \`startDateTime\` / \`endDateTime\` \u306F ISO-8601 UTC\u3001\u4F8B \`2025-01-15T00:00:00Z\`
|
|
28742
|
+
- \`$select=subject,start,end,attendees,location\` \u3068 \`$orderby=start/dateTime\` \u3092\u7D44\u307F\u5408\u308F\u305B\u308B\u3068\u30DA\u30A4\u30ED\u30FC\u30C9\u6291\u5236 + \u30BD\u30FC\u30C8\u3067\u304D\u308B
|
|
28743
|
+
|
|
28744
|
+
#### \u4E3B\u8981\u30AF\u30A8\u30EA\u30D1\u30E9\u30E1\u30FC\u30BF (OData; Mail \u3068 Calendar \u3067\u5171\u901A)
|
|
28745
|
+
- \`$top\` \u2014 \u6700\u5927\u7D50\u679C\u6570 (\u30C7\u30D5\u30A9\u30EB\u30C8 10\u3001\u6700\u5927 1000)
|
|
28746
|
+
- \`$skip\` \u2014 \u5148\u982D N \u4EF6\u3092\u30B9\u30AD\u30C3\u30D7 (\u30DA\u30FC\u30B8\u30F3\u30B0)
|
|
28747
|
+
- \`$select\` \u2014 \u53D6\u5F97\u3059\u308B\u30D7\u30ED\u30D1\u30C6\u30A3\u3092\u30AB\u30F3\u30DE\u533A\u5207\u308A (\u4F8B \`subject,from,receivedDateTime,bodyPreview\`)
|
|
28748
|
+
- \`$orderby\` \u2014 \u30BD\u30FC\u30C8 (\u4F8B \`receivedDateTime desc\`\u3001\`start/dateTime asc\`)
|
|
28749
|
+
- \`$filter\` \u2014 OData \u30D5\u30A3\u30EB\u30BF (\u4F8B \`receivedDateTime ge 2025-01-01T00:00:00Z\`\u3001\`from/emailAddress/address eq 'a@b.com'\`\u3001\`isRead eq false\`\u3001\`conversationId eq '<id>'\`\u3001\`start/dateTime ge '2025-01-15T00:00:00'\`)
|
|
28750
|
+
- \`$search\` \u2014 \u5168\u6587\u691C\u7D22\u3002\u30C0\u30D6\u30EB\u30AF\u30A9\u30FC\u30C8\u3067\u56F2\u3080\u5FC5\u8981\u3042\u308A (\u4F8B \`$search="project status"\`)\u3002\`$filter\` \u3068\u4F75\u7528\u4E0D\u53EF
|
|
28751
|
+
- \`$expand\` \u2014 \u95A2\u9023\u30EA\u30BD\u30FC\u30B9\u3092\u5C55\u958B (\u4F8B \`attachments\`\u3001\u7E70\u308A\u8FD4\u3057\u30A4\u30D9\u30F3\u30C8\u306E \`instances\`)
|
|
28752
|
+
- \`$count=true\` \u2014 \u7DCF\u4EF6\u6570\u3092\u8FD4\u3059 (\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8\u306B\u3088\u3063\u3066\u306F \`ConsistencyLevel: eventual\` \u30D8\u30C3\u30C0\u30FC\u304C\u5FC5\u8981)
|
|
28753
|
+
|
|
28754
|
+
#### \u30DA\u30FC\u30B8\u30CD\u30FC\u30B7\u30E7\u30F3
|
|
28755
|
+
- \u7D9A\u304D\u304C\u3042\u308B\u5834\u5408\u30EC\u30B9\u30DD\u30F3\u30B9\u306B \`@odata.nextLink\` \u304C\u542B\u307E\u308C\u308B\u3002\u305D\u306E URL (\u307E\u305F\u306F\u30D1\u30B9) \u3092\u547C\u3073\u51FA\u3057\u3066\u6B21\u30DA\u30FC\u30B8\u3092\u53D6\u5F97
|
|
28756
|
+
|
|
28757
|
+
#### Tips
|
|
28758
|
+
- \u30B5\u30A4\u30F3\u30A4\u30F3\u30E6\u30FC\u30B6\u30FC\u306B\u306F\u5FC5\u305A \`/me\` \u3092\u4F7F\u7528 \u2014 \u4ED6\u30E6\u30FC\u30B6\u30FC\u306E ID \u3092\u5165\u308C\u306A\u3044
|
|
28759
|
+
- \u30DA\u30A4\u30ED\u30FC\u30C9\u80A5\u5927\u5316\u3092\u907F\u3051\u308B\u305F\u3081 \`$select\` \u3092\u6D3B\u7528\u3002HTML \u672C\u6587\u8FBC\u307F\u306E\u30E1\u30C3\u30BB\u30FC\u30B8\u306F MB \u5358\u4F4D\u306B\u306A\u308B\u3053\u3068\u304C\u3042\u308B
|
|
28760
|
+
- \`bodyPreview\` (\u5148\u982D\u7D04 255 \u6587\u5B57) \u306F\u30C7\u30D5\u30A9\u30EB\u30C8\u3067\u542B\u307E\u308C\u3066\u304A\u308A\u3001\u30C8\u30EA\u30A2\u30FC\u30B8\u306B\u4FBF\u5229
|
|
28761
|
+
- \u65E5\u6642\u5024\u306F ISO-8601\u3002\u30AB\u30EC\u30F3\u30C0\u30FC\u30A4\u30D9\u30F3\u30C8\u306B\u306F \`timeZone\` \u30D5\u30A3\u30FC\u30EB\u30C9\u3082\u542B\u307E\u308C\u308B
|
|
28762
|
+
|
|
28763
|
+
### Business Logic
|
|
28764
|
+
|
|
28765
|
+
\u3053\u306E\u30B3\u30CD\u30AF\u30BF\u306E\u30D3\u30B8\u30CD\u30B9\u30ED\u30B8\u30C3\u30AF\u30BF\u30A4\u30D7\u306F "typescript" \u3067\u3059\u3002\u4EE5\u4E0B\u306B\u793A\u3059\u30B3\u30CD\u30AF\u30BF SDK \u3092\u4F7F\u7528\u3057\u3066\u30CF\u30F3\u30C9\u30E9\u30B3\u30FC\u30C9\u3092\u8A18\u8FF0\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u74B0\u5883\u5909\u6570\u304B\u3089\u76F4\u63A5\u8A8D\u8A3C\u60C5\u5831\u306B\u30A2\u30AF\u30BB\u30B9\u3057\u306A\u3044\u3067\u304F\u3060\u3055\u3044\u3002\`INTERNAL_SQUADBASE_*\` \u306E\u74B0\u5883\u5909\u6570\u3092\u4F7F\u3063\u3066\u624B\u52D5\u3067 OAuth \u30D7\u30ED\u30AD\u30B7\u3092\u53E9\u304F\u3053\u3068\u3082\u3057\u306A\u3044\u3067\u304F\u3060\u3055\u3044 \u2014 SDK \u304C OAuth \u3092\u51E6\u7406\u3057\u307E\u3059\u3002
|
|
28766
|
+
|
|
28767
|
+
SDK (\`connection(connectionId)\` \u3067\u4F5C\u6210\u3057\u305F\u30AF\u30E9\u30A4\u30A2\u30F3\u30C8):
|
|
28768
|
+
|
|
28769
|
+
\u30E1\u30FC\u30EB:
|
|
28770
|
+
- \`client.request(path, init?)\` \u2014 \u4F4E\u30EC\u30D9\u30EB\u8A8D\u8A3C\u4ED8\u304D fetch (path \u306F \`https://graph.microsoft.com/v1.0\` \u306B\u8FFD\u52A0\u3055\u308C\u307E\u3059)
|
|
28771
|
+
- \`client.getProfile()\` \u2014 \u8A8D\u8A3C\u30E6\u30FC\u30B6\u30FC\u306E\u30D7\u30ED\u30D5\u30A3\u30FC\u30EB\u3092\u53D6\u5F97
|
|
28772
|
+
- \`client.listMailFolders()\` \u2014 \u5168\u30E1\u30FC\u30EB\u30D5\u30A9\u30EB\u30C0\u3092\u4E00\u89A7
|
|
28773
|
+
- \`client.listMessages(options?)\` \u2014 \u30E1\u30C3\u30BB\u30FC\u30B8\u4E00\u89A7 (\`top\`, \`skip\`, \`filter\`, \`orderBy\`, \`select\`, \`search\` \u5BFE\u5FDC)
|
|
28774
|
+
- \`client.listMessagesInFolder(folderId, options?)\` \u2014 \u30D5\u30A9\u30EB\u30C0\u5185\u306E\u30E1\u30C3\u30BB\u30FC\u30B8\u4E00\u89A7 (\`inbox\` \u306A\u3069\u306E well-known \u540D\u3082\u4F7F\u7528\u53EF)
|
|
28775
|
+
- \`client.getMessage(id, options?)\` \u2014 \u7279\u5B9A\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u53D6\u5F97
|
|
28776
|
+
- \`client.listConversation(conversationId, options?)\` \u2014 \u30B9\u30EC\u30C3\u30C9\u5185\u306E\u5168\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u53D6\u5F97 (Gmail \`getThread\` \u76F8\u5F53\u3001\u30C7\u30D5\u30A9\u30EB\u30C8\u3067\u53E4\u3044\u9806)
|
|
28777
|
+
|
|
28778
|
+
\u6DFB\u4ED8\u30D5\u30A1\u30A4\u30EB:
|
|
28779
|
+
- \`client.listAttachments(messageId)\` \u2014 \u30E1\u30C3\u30BB\u30FC\u30B8\u306E\u6DFB\u4ED8\u30D5\u30A1\u30A4\u30EB\u4E00\u89A7
|
|
28780
|
+
- \`client.getAttachment(messageId, attachmentId)\` \u2014 \u6DFB\u4ED8\u30D5\u30A1\u30A4\u30EB\u5358\u4F53\u53D6\u5F97 (file attachment \u306F base64 \u306E \`contentBytes\` \u3092\u542B\u3080)
|
|
28781
|
+
|
|
28782
|
+
\u30AB\u30EC\u30F3\u30C0\u30FC:
|
|
28783
|
+
- \`client.listCalendars()\` \u2014 \u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u306A\u30AB\u30EC\u30F3\u30C0\u30FC\u4E00\u89A7
|
|
28784
|
+
- \`client.listEvents(options?)\` \u2014 \u30C7\u30D5\u30A9\u30EB\u30C8\u30AB\u30EC\u30F3\u30C0\u30FC\u306E\u30A4\u30D9\u30F3\u30C8\u4E00\u89A7 (\`{ calendarId }\` \u3067\u7279\u5B9A\u30AB\u30EC\u30F3\u30C0\u30FC\u6307\u5B9A\u53EF)\u3002\u7E70\u308A\u8FD4\u3057\u30A4\u30D9\u30F3\u30C8\u306F series master \u3068\u3057\u3066\u8FD4\u5374
|
|
28785
|
+
- \`client.getEvent(id)\` \u2014 \u30A4\u30D9\u30F3\u30C8\u5358\u4F53\u53D6\u5F97
|
|
28786
|
+
- \`client.listCalendarView(startDateTime, endDateTime, options?)\` \u2014 \u65E5\u4ED8\u7BC4\u56F2\u5185\u306E\u30A4\u30D9\u30F3\u30C8 **occurrence** \u4E00\u89A7 (\u7E70\u308A\u8FD4\u3057\u3092\u5C55\u958B)\u3002Google Calendar \u306E \`events?singleEvents=true\` \u76F8\u5F53
|
|
28787
|
+
|
|
28788
|
+
\u30CF\u30F3\u30C9\u30E9\u306E\u30C6\u30B9\u30C8\u304C \`Connection proxy is not configured\` \u3067\u5931\u6557\u3059\u308B\u5834\u5408\u306F\u518D\u8A66\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002SDK \u3092\u8AE6\u3081\u3066 OAuth \u30D7\u30ED\u30AD\u30B7\u306E URL \u3092\u81EA\u5206\u3067\u7D44\u307F\u7ACB\u3066\u308B\u3053\u3068\u306F **\u3057\u306A\u3044\u3067\u304F\u3060\u3055\u3044**\u3002
|
|
28789
|
+
|
|
28790
|
+
#### Example
|
|
28791
|
+
|
|
28792
|
+
\`\`\`ts
|
|
28793
|
+
import { connection } from "@squadbase/vite-server/connectors/outlook-oauth";
|
|
28794
|
+
|
|
28795
|
+
const outlook = connection("<connectionId>");
|
|
28796
|
+
|
|
28797
|
+
// \u30D7\u30ED\u30D5\u30A3\u30FC\u30EB\u53D6\u5F97
|
|
28798
|
+
const profile = await outlook.getProfile();
|
|
28799
|
+
console.log(profile.displayName, profile.mail);
|
|
28800
|
+
|
|
28801
|
+
// \u53D7\u4FE1\u30C8\u30EC\u30A4\u306E\u672A\u8AAD\u30E1\u30C3\u30BB\u30FC\u30B8\u6700\u65B010\u4EF6
|
|
28802
|
+
const messages = await outlook.listMessagesInFolder("inbox", {
|
|
28803
|
+
top: 10,
|
|
28804
|
+
filter: "isRead eq false",
|
|
28805
|
+
orderBy: "receivedDateTime desc",
|
|
28806
|
+
select: ["id", "subject", "from", "receivedDateTime", "bodyPreview", "conversationId"],
|
|
28807
|
+
});
|
|
28808
|
+
for (const msg of messages.value) {
|
|
28809
|
+
console.log(msg.receivedDateTime, msg.from?.emailAddress.address, msg.subject);
|
|
28810
|
+
}
|
|
28811
|
+
|
|
28812
|
+
// \u30B9\u30EC\u30C3\u30C9\u5168\u4F53\u3092\u53D6\u5F97
|
|
28813
|
+
const first = messages.value[0];
|
|
28814
|
+
if (first?.conversationId) {
|
|
28815
|
+
const thread = await outlook.listConversation(first.conversationId);
|
|
28816
|
+
thread.value.forEach(m => console.log(m.receivedDateTime, m.bodyPreview));
|
|
28817
|
+
}
|
|
28818
|
+
|
|
28819
|
+
// \u6DFB\u4ED8\u30D5\u30A1\u30A4\u30EB\u3092\u53D6\u5F97
|
|
28820
|
+
if (first?.hasAttachments) {
|
|
28821
|
+
const atts = await outlook.listAttachments(first.id);
|
|
28822
|
+
for (const a of atts.value) {
|
|
28823
|
+
const full = await outlook.getAttachment(first.id, a.id);
|
|
28824
|
+
console.log(full.name, full.contentType, full.size);
|
|
28825
|
+
// full.contentBytes \u306F file attachment \u306E\u5834\u5408 base64
|
|
28826
|
+
}
|
|
28827
|
+
}
|
|
28828
|
+
|
|
28829
|
+
// \u4ECA\u65E5\u306E\u30AB\u30EC\u30F3\u30C0\u30FC\u30A4\u30D9\u30F3\u30C8 (occurrence \u5C55\u958B)
|
|
28830
|
+
const todayStart = new Date(); todayStart.setHours(0, 0, 0, 0);
|
|
28831
|
+
const todayEnd = new Date(todayStart); todayEnd.setDate(todayEnd.getDate() + 1);
|
|
28832
|
+
const events = await outlook.listCalendarView(
|
|
28833
|
+
todayStart.toISOString(),
|
|
28834
|
+
todayEnd.toISOString(),
|
|
28835
|
+
{ orderBy: "start/dateTime", select: ["id", "subject", "start", "end", "attendees"] },
|
|
28836
|
+
);
|
|
28837
|
+
events.value.forEach(e => console.log(e.start.dateTime, e.subject));
|
|
28838
|
+
\`\`\``
|
|
28839
|
+
},
|
|
28840
|
+
tools: tools82,
|
|
28841
|
+
async checkConnection(_params, config) {
|
|
28842
|
+
const { proxyFetch } = config;
|
|
28843
|
+
const url = "https://graph.microsoft.com/v1.0/me";
|
|
28844
|
+
try {
|
|
28845
|
+
const res = await proxyFetch(url, { method: "GET" });
|
|
28846
|
+
if (!res.ok) {
|
|
28847
|
+
const errorText = await res.text().catch(() => res.statusText);
|
|
28848
|
+
return {
|
|
28849
|
+
success: false,
|
|
28850
|
+
error: `Microsoft Graph failed: HTTP ${res.status} ${errorText}`
|
|
28851
|
+
};
|
|
28852
|
+
}
|
|
28853
|
+
return { success: true };
|
|
28854
|
+
} catch (error) {
|
|
28855
|
+
return {
|
|
28856
|
+
success: false,
|
|
28857
|
+
error: error instanceof Error ? error.message : String(error)
|
|
28858
|
+
};
|
|
28859
|
+
}
|
|
28860
|
+
}
|
|
28861
|
+
});
|
|
28862
|
+
|
|
28863
|
+
// ../connectors/src/connectors/registry.ts
|
|
28864
|
+
var plugins = {
|
|
28865
|
+
snowflake: snowflakeConnector,
|
|
28866
|
+
snowflakePat: snowflakePatConnector,
|
|
28867
|
+
bigquery: bigqueryConnector,
|
|
28868
|
+
bigqueryOauth: bigqueryOauthConnector,
|
|
28869
|
+
databricks: databricksConnector,
|
|
28870
|
+
redshift: redshiftConnector,
|
|
28871
|
+
dbt: dbtConnector,
|
|
28872
|
+
awsAthena: awsAthenaConnector,
|
|
28873
|
+
awsBilling: awsBillingConnector,
|
|
28874
|
+
postgresql: postgresqlConnector,
|
|
28875
|
+
mysql: mysqlConnector,
|
|
28876
|
+
googleAds: googleAdsConnector,
|
|
28877
|
+
googleAnalytics: googleAnalyticsConnector,
|
|
28878
|
+
googleAnalyticsOauth: googleAnalyticsOauthConnector,
|
|
28879
|
+
googleCalendar: googleCalendarConnector,
|
|
28880
|
+
googleCalendarOauth: googleCalendarOauthConnector,
|
|
28881
|
+
googleDocs: googleDocsConnector,
|
|
28882
|
+
googleDrive: googleDriveConnector,
|
|
28883
|
+
googleSheets: googleSheetsConnector,
|
|
28884
|
+
googleSlides: googleSlidesConnector,
|
|
28885
|
+
hubspotOauth: hubspotOauthConnector,
|
|
28886
|
+
stripeOauth: stripeOauthConnector,
|
|
28887
|
+
stripeApiKey: stripeApiKeyConnector,
|
|
28888
|
+
airtable: airtableConnector,
|
|
28889
|
+
airtableOauth: airtableOauthConnector,
|
|
28890
|
+
squadbaseDb: squadbaseDbConnector,
|
|
28891
|
+
kintone: kintoneConnector,
|
|
28892
|
+
kintoneApiToken: kintoneApiTokenConnector,
|
|
28893
|
+
wixStore: wixStoreConnector,
|
|
28894
|
+
openai: openaiConnector,
|
|
28895
|
+
gemini: geminiConnector,
|
|
28896
|
+
anthropic: anthropicConnector,
|
|
28897
|
+
amplitude: amplitudeConnector,
|
|
28898
|
+
attio: attioConnector,
|
|
28899
|
+
shopify: shopifyConnector,
|
|
28900
|
+
shopifyOauth: shopifyOauthConnector,
|
|
28901
|
+
hubspot: hubspotConnector,
|
|
28902
|
+
jira: jiraConnector,
|
|
28903
|
+
linear: linearConnector,
|
|
28904
|
+
asana: asanaConnector,
|
|
28905
|
+
clickhouse: clickhouseConnector,
|
|
28906
|
+
mongodb: mongodbConnector,
|
|
28907
|
+
notion: notionConnector,
|
|
28908
|
+
notionOauth: notionOauthConnector,
|
|
28909
|
+
metaAds: metaAdsConnector,
|
|
28910
|
+
metaAdsOauth: metaAdsOauthConnector,
|
|
28911
|
+
tiktokAds: tiktokAdsConnector,
|
|
28912
|
+
mailchimp: mailchimpConnector,
|
|
28913
|
+
mailchimpOauth: mailchimpOauthConnector,
|
|
28914
|
+
customerio: customerioConnector,
|
|
28915
|
+
gmail: gmailConnector,
|
|
28916
|
+
gmailOauth: gmailOauthConnector,
|
|
28917
|
+
googleAuditLog: googleAuditLogConnector,
|
|
28918
|
+
linkedinAds: linkedinAdsConnector,
|
|
28919
|
+
zendesk: zendeskConnector,
|
|
28920
|
+
zendeskOauth: zendeskOauthConnector,
|
|
28921
|
+
intercom: intercomConnector,
|
|
28922
|
+
intercomOauth: intercomOauthConnector,
|
|
28923
|
+
mixpanel: mixpanelConnector,
|
|
28924
|
+
grafana: grafanaConnector,
|
|
28925
|
+
backlog: backlogConnector,
|
|
28926
|
+
gamma: gammaConnector,
|
|
28927
|
+
sentry: sentryConnector,
|
|
28928
|
+
salesforce: salesforceConnector,
|
|
28929
|
+
influxdb: influxdbConnector,
|
|
28930
|
+
monday: mondayConnector,
|
|
28931
|
+
jdbc: jdbcConnector,
|
|
28932
|
+
semrush: semrushConnector,
|
|
28933
|
+
googleSearchConsoleOauth: googleSearchConsoleOauthConnector,
|
|
28934
|
+
supabase: supabaseConnector,
|
|
28935
|
+
clickup: clickupConnector,
|
|
28936
|
+
sqlserver: sqlserverConnector,
|
|
28937
|
+
azureSql: azureSqlConnector,
|
|
28938
|
+
cosmosdb: cosmosdbConnector,
|
|
28939
|
+
oracle: oracleConnector,
|
|
28940
|
+
freshservice: freshserviceConnector,
|
|
28941
|
+
freshdesk: freshdeskConnector,
|
|
28942
|
+
freshsales: freshsalesConnector,
|
|
28943
|
+
github: githubConnector,
|
|
28944
|
+
powerbiOauth: powerbiOauthConnector,
|
|
28945
|
+
tableau: tableauConnector,
|
|
28946
|
+
outlookOauth: outlookOauthConnector
|
|
28947
|
+
};
|
|
28948
|
+
var connectors = {
|
|
28949
|
+
...plugins,
|
|
28950
|
+
/**
|
|
28951
|
+
* Return plugins that have at least one matching connection.
|
|
28952
|
+
*/
|
|
28953
|
+
pluginsFor(connections) {
|
|
28954
|
+
const keys = new Set(
|
|
28955
|
+
connections.map(
|
|
28956
|
+
(c) => ConnectorPlugin.deriveKey(c.connector.slug, c.connector.authType)
|
|
28957
|
+
)
|
|
28958
|
+
);
|
|
28959
|
+
return Object.values(plugins).filter((p) => keys.has(p.connectorKey));
|
|
28960
|
+
},
|
|
28961
|
+
/**
|
|
28962
|
+
* Find a plugin by slug and authType.
|
|
28963
|
+
*/
|
|
28964
|
+
findByKey(slug, authType) {
|
|
28965
|
+
const key = ConnectorPlugin.deriveKey(slug, authType);
|
|
28966
|
+
return Object.values(plugins).find((p) => p.connectorKey === key);
|
|
28967
|
+
}
|
|
28968
|
+
};
|
|
28969
|
+
|
|
28970
|
+
// src/connector-client/env.ts
|
|
28971
|
+
function resolveEnvVar(entry, key, connectionId) {
|
|
28972
|
+
const envVarName = entry.envVars[key];
|
|
28973
|
+
if (!envVarName) {
|
|
28974
|
+
throw new Error(`Connection "${connectionId}" is missing envVars mapping for key "${key}"`);
|
|
28975
|
+
}
|
|
28976
|
+
const value = process.env[envVarName];
|
|
28977
|
+
if (!value) {
|
|
28978
|
+
throw new Error(`Environment variable "${envVarName}" (for connection "${connectionId}", key "${key}") is not set`);
|
|
27668
28979
|
}
|
|
27669
28980
|
return value;
|
|
27670
28981
|
}
|
|
@@ -27859,62 +29170,62 @@ import { watch as fsWatch2 } from "fs";
|
|
|
27859
29170
|
import path2 from "path";
|
|
27860
29171
|
|
|
27861
29172
|
// src/types/server-logic.ts
|
|
27862
|
-
import { z as
|
|
27863
|
-
var parameterMetaSchema =
|
|
27864
|
-
name:
|
|
27865
|
-
type:
|
|
27866
|
-
description:
|
|
27867
|
-
required:
|
|
27868
|
-
default:
|
|
27869
|
-
});
|
|
27870
|
-
var serverLogicCacheConfigSchema =
|
|
27871
|
-
ttl:
|
|
27872
|
-
staleWhileRevalidate:
|
|
27873
|
-
});
|
|
27874
|
-
var serverLogicSchemaObjectSchema =
|
|
27875
|
-
() =>
|
|
27876
|
-
type:
|
|
27877
|
-
format:
|
|
27878
|
-
description:
|
|
27879
|
-
nullable:
|
|
27880
|
-
enum:
|
|
29173
|
+
import { z as z100 } from "zod";
|
|
29174
|
+
var parameterMetaSchema = z100.object({
|
|
29175
|
+
name: z100.string(),
|
|
29176
|
+
type: z100.enum(["string", "number", "boolean"]),
|
|
29177
|
+
description: z100.string(),
|
|
29178
|
+
required: z100.boolean().optional(),
|
|
29179
|
+
default: z100.union([z100.string(), z100.number(), z100.boolean()]).optional()
|
|
29180
|
+
});
|
|
29181
|
+
var serverLogicCacheConfigSchema = z100.object({
|
|
29182
|
+
ttl: z100.number(),
|
|
29183
|
+
staleWhileRevalidate: z100.boolean().optional()
|
|
29184
|
+
});
|
|
29185
|
+
var serverLogicSchemaObjectSchema = z100.lazy(
|
|
29186
|
+
() => z100.object({
|
|
29187
|
+
type: z100.enum(["string", "number", "integer", "boolean", "object", "array", "null"]).optional(),
|
|
29188
|
+
format: z100.string().optional(),
|
|
29189
|
+
description: z100.string().optional(),
|
|
29190
|
+
nullable: z100.boolean().optional(),
|
|
29191
|
+
enum: z100.array(z100.union([z100.string(), z100.number(), z100.boolean(), z100.null()])).optional(),
|
|
27881
29192
|
items: serverLogicSchemaObjectSchema.optional(),
|
|
27882
|
-
properties:
|
|
27883
|
-
required:
|
|
27884
|
-
additionalProperties:
|
|
27885
|
-
minimum:
|
|
27886
|
-
maximum:
|
|
27887
|
-
minLength:
|
|
27888
|
-
maxLength:
|
|
27889
|
-
pattern:
|
|
29193
|
+
properties: z100.record(z100.string(), serverLogicSchemaObjectSchema).optional(),
|
|
29194
|
+
required: z100.array(z100.string()).optional(),
|
|
29195
|
+
additionalProperties: z100.union([z100.boolean(), serverLogicSchemaObjectSchema]).optional(),
|
|
29196
|
+
minimum: z100.number().optional(),
|
|
29197
|
+
maximum: z100.number().optional(),
|
|
29198
|
+
minLength: z100.number().optional(),
|
|
29199
|
+
maxLength: z100.number().optional(),
|
|
29200
|
+
pattern: z100.string().optional()
|
|
27890
29201
|
})
|
|
27891
29202
|
);
|
|
27892
|
-
var serverLogicMediaTypeSchema =
|
|
29203
|
+
var serverLogicMediaTypeSchema = z100.object({
|
|
27893
29204
|
schema: serverLogicSchemaObjectSchema.optional(),
|
|
27894
|
-
example:
|
|
29205
|
+
example: z100.unknown().optional()
|
|
27895
29206
|
});
|
|
27896
|
-
var serverLogicResponseSchema =
|
|
27897
|
-
description:
|
|
27898
|
-
content:
|
|
29207
|
+
var serverLogicResponseSchema = z100.object({
|
|
29208
|
+
description: z100.string().optional(),
|
|
29209
|
+
content: z100.record(z100.string(), serverLogicMediaTypeSchema).optional()
|
|
27899
29210
|
});
|
|
27900
29211
|
var jsonBaseFields = {
|
|
27901
|
-
description:
|
|
27902
|
-
parameters:
|
|
29212
|
+
description: z100.string(),
|
|
29213
|
+
parameters: z100.array(parameterMetaSchema).optional(),
|
|
27903
29214
|
response: serverLogicResponseSchema.optional(),
|
|
27904
29215
|
cache: serverLogicCacheConfigSchema.optional()
|
|
27905
29216
|
};
|
|
27906
|
-
var jsonSqlServerLogicSchema =
|
|
29217
|
+
var jsonSqlServerLogicSchema = z100.object({
|
|
27907
29218
|
...jsonBaseFields,
|
|
27908
|
-
type:
|
|
27909
|
-
query:
|
|
27910
|
-
connectionId:
|
|
29219
|
+
type: z100.literal("sql").optional(),
|
|
29220
|
+
query: z100.string(),
|
|
29221
|
+
connectionId: z100.string()
|
|
27911
29222
|
});
|
|
27912
|
-
var jsonTypeScriptServerLogicSchema =
|
|
29223
|
+
var jsonTypeScriptServerLogicSchema = z100.object({
|
|
27913
29224
|
...jsonBaseFields,
|
|
27914
|
-
type:
|
|
27915
|
-
handlerPath:
|
|
29225
|
+
type: z100.literal("typescript"),
|
|
29226
|
+
handlerPath: z100.string()
|
|
27916
29227
|
});
|
|
27917
|
-
var anyJsonServerLogicSchema =
|
|
29228
|
+
var anyJsonServerLogicSchema = z100.union([
|
|
27918
29229
|
jsonTypeScriptServerLogicSchema,
|
|
27919
29230
|
jsonSqlServerLogicSchema
|
|
27920
29231
|
]);
|