@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/index.js
CHANGED
|
@@ -363,6 +363,37 @@ import { z } from "zod";
|
|
|
363
363
|
|
|
364
364
|
// ../connectors/src/connectors/snowflake/utils.ts
|
|
365
365
|
import crypto from "crypto";
|
|
366
|
+
|
|
367
|
+
// ../connectors/src/lib/approx-bytes.ts
|
|
368
|
+
function approxBytes(value, acc, limit) {
|
|
369
|
+
if (acc > limit) return acc;
|
|
370
|
+
if (value == null) return acc;
|
|
371
|
+
const t = typeof value;
|
|
372
|
+
if (t === "string") return acc + value.length;
|
|
373
|
+
if (t === "number" || t === "boolean") return acc + 8;
|
|
374
|
+
if (t === "bigint") return acc + 16;
|
|
375
|
+
if (value instanceof Date) return acc + 8;
|
|
376
|
+
if (Buffer.isBuffer(value)) return acc + value.byteLength;
|
|
377
|
+
if (Array.isArray(value)) {
|
|
378
|
+
for (const item of value) {
|
|
379
|
+
acc = approxBytes(item, acc, limit);
|
|
380
|
+
if (acc > limit) return acc;
|
|
381
|
+
}
|
|
382
|
+
return acc;
|
|
383
|
+
}
|
|
384
|
+
if (t === "object") {
|
|
385
|
+
const obj = value;
|
|
386
|
+
for (const k in obj) {
|
|
387
|
+
acc += k.length;
|
|
388
|
+
acc = approxBytes(obj[k], acc, limit);
|
|
389
|
+
if (acc > limit) return acc;
|
|
390
|
+
}
|
|
391
|
+
return acc;
|
|
392
|
+
}
|
|
393
|
+
return acc;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
// ../connectors/src/connectors/snowflake/utils.ts
|
|
366
397
|
function decryptPrivateKey(pem, passphrase) {
|
|
367
398
|
if (!passphrase) return pem;
|
|
368
399
|
return crypto.createPrivateKey({
|
|
@@ -371,10 +402,46 @@ function decryptPrivateKey(pem, passphrase) {
|
|
|
371
402
|
passphrase
|
|
372
403
|
}).export({ type: "pkcs8", format: "pem" });
|
|
373
404
|
}
|
|
405
|
+
async function executeWithSizeLimit(conn, sql, options) {
|
|
406
|
+
const rows = [];
|
|
407
|
+
let acc = 0;
|
|
408
|
+
let exceeded = false;
|
|
409
|
+
await new Promise((resolve, reject) => {
|
|
410
|
+
const stmt = conn.execute({
|
|
411
|
+
sqlText: sql,
|
|
412
|
+
streamResult: true
|
|
413
|
+
});
|
|
414
|
+
const stream = stmt.streamRows();
|
|
415
|
+
stream.on("data", (row) => {
|
|
416
|
+
if (exceeded) return;
|
|
417
|
+
acc = approxBytes(row, acc, options.maxBytes);
|
|
418
|
+
if (acc > options.maxBytes) {
|
|
419
|
+
exceeded = true;
|
|
420
|
+
stream.destroy();
|
|
421
|
+
stmt.cancel(() => {
|
|
422
|
+
});
|
|
423
|
+
resolve();
|
|
424
|
+
return;
|
|
425
|
+
}
|
|
426
|
+
rows.push(row);
|
|
427
|
+
});
|
|
428
|
+
stream.on("end", () => {
|
|
429
|
+
resolve();
|
|
430
|
+
});
|
|
431
|
+
stream.on("error", (err) => {
|
|
432
|
+
if (exceeded) return;
|
|
433
|
+
reject(new Error(`Snowflake query failed: ${err.message}`));
|
|
434
|
+
});
|
|
435
|
+
});
|
|
436
|
+
if (exceeded) {
|
|
437
|
+
return { exceeded: true };
|
|
438
|
+
}
|
|
439
|
+
return { exceeded: false, rows };
|
|
440
|
+
}
|
|
374
441
|
|
|
375
442
|
// ../connectors/src/connectors/snowflake/tools/execute-query.ts
|
|
376
|
-
var
|
|
377
|
-
var
|
|
443
|
+
var MAX_RESULT_BYTES = 5 * 1024 * 1024;
|
|
444
|
+
var STATEMENT_TIMEOUT_SECONDS = 60;
|
|
378
445
|
var inputSchema = z.object({
|
|
379
446
|
toolUseIntent: z.string().optional().describe(
|
|
380
447
|
"Brief description of what you intend to accomplish with this tool call"
|
|
@@ -388,7 +455,6 @@ var outputSchema = z.discriminatedUnion("success", [
|
|
|
388
455
|
z.object({
|
|
389
456
|
success: z.literal(true),
|
|
390
457
|
rowCount: z.number(),
|
|
391
|
-
truncated: z.boolean(),
|
|
392
458
|
rows: z.array(z.record(z.string(), z.unknown()))
|
|
393
459
|
}),
|
|
394
460
|
z.object({
|
|
@@ -398,9 +464,12 @@ var outputSchema = z.discriminatedUnion("success", [
|
|
|
398
464
|
]);
|
|
399
465
|
var executeQueryTool = new ConnectorTool({
|
|
400
466
|
name: "executeQuery",
|
|
401
|
-
description: `Execute SQL against Snowflake.
|
|
402
|
-
Use for: schema exploration (SHOW DATABASES/SCHEMAS/TABLES, DESCRIBE TABLE, INFORMATION_SCHEMA),
|
|
403
|
-
|
|
467
|
+
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).
|
|
468
|
+
Use for: schema exploration (SHOW DATABASES/SCHEMAS/TABLES, DESCRIBE TABLE, INFORMATION_SCHEMA), sampling (LIMIT, SAMPLE), and analytical queries.
|
|
469
|
+
Memory guidance:
|
|
470
|
+
- 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).
|
|
471
|
+
- For full-dataset analysis, do the aggregation inside Snowflake (COUNT, SUM, GROUP BY, APPROX_TOP_K, HISTOGRAM) instead of returning raw rows.
|
|
472
|
+
- Exploration is iterative: start with a small LIMIT to inspect shape, then refine.`,
|
|
404
473
|
inputSchema,
|
|
405
474
|
outputSchema,
|
|
406
475
|
async execute({ connectionId, sql }, connections) {
|
|
@@ -442,39 +511,43 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
442
511
|
else resolve();
|
|
443
512
|
});
|
|
444
513
|
});
|
|
445
|
-
|
|
446
|
-
(resolve, reject) => {
|
|
447
|
-
const timeoutId = setTimeout(() => {
|
|
448
|
-
reject(
|
|
449
|
-
new Error(
|
|
450
|
-
"Snowflake query timeout: query exceeded 60 seconds"
|
|
451
|
-
)
|
|
452
|
-
);
|
|
453
|
-
}, QUERY_TIMEOUT_MS);
|
|
514
|
+
try {
|
|
515
|
+
await new Promise((resolve, reject) => {
|
|
454
516
|
conn.execute({
|
|
455
|
-
sqlText:
|
|
456
|
-
complete: (err
|
|
457
|
-
clearTimeout(timeoutId);
|
|
517
|
+
sqlText: `ALTER SESSION SET STATEMENT_TIMEOUT_IN_SECONDS = ${STATEMENT_TIMEOUT_SECONDS}`,
|
|
518
|
+
complete: (err) => {
|
|
458
519
|
if (err)
|
|
459
|
-
reject(
|
|
460
|
-
|
|
520
|
+
reject(
|
|
521
|
+
new Error(
|
|
522
|
+
`Failed to set Snowflake statement timeout: ${err.message}`
|
|
523
|
+
)
|
|
524
|
+
);
|
|
525
|
+
else resolve();
|
|
461
526
|
}
|
|
462
527
|
});
|
|
528
|
+
});
|
|
529
|
+
const result = await executeWithSizeLimit(conn, sql, {
|
|
530
|
+
maxBytes: MAX_RESULT_BYTES
|
|
531
|
+
});
|
|
532
|
+
if (result.exceeded) {
|
|
533
|
+
return {
|
|
534
|
+
success: false,
|
|
535
|
+
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)."
|
|
536
|
+
};
|
|
463
537
|
}
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
};
|
|
538
|
+
return {
|
|
539
|
+
success: true,
|
|
540
|
+
rowCount: result.rows.length,
|
|
541
|
+
rows: result.rows
|
|
542
|
+
};
|
|
543
|
+
} finally {
|
|
544
|
+
conn.destroy((err) => {
|
|
545
|
+
if (err)
|
|
546
|
+
console.warn(
|
|
547
|
+
`[connector-query] Snowflake destroy error: ${err.message}`
|
|
548
|
+
);
|
|
549
|
+
});
|
|
550
|
+
}
|
|
478
551
|
} catch (err) {
|
|
479
552
|
const msg = err instanceof Error ? err.message : String(err);
|
|
480
553
|
return { success: false, error: msg };
|
|
@@ -663,8 +736,8 @@ var parameters2 = {
|
|
|
663
736
|
|
|
664
737
|
// ../connectors/src/connectors/snowflake-pat/tools/execute-query.ts
|
|
665
738
|
import { z as z2 } from "zod";
|
|
666
|
-
var
|
|
667
|
-
var
|
|
739
|
+
var MAX_ROWS = 500;
|
|
740
|
+
var QUERY_TIMEOUT_MS = 6e4;
|
|
668
741
|
var inputSchema2 = z2.object({
|
|
669
742
|
toolUseIntent: z2.string().optional().describe(
|
|
670
743
|
"Brief description of what you intend to accomplish with this tool call"
|
|
@@ -688,7 +761,7 @@ var outputSchema2 = z2.discriminatedUnion("success", [
|
|
|
688
761
|
]);
|
|
689
762
|
var executeQueryTool2 = new ConnectorTool({
|
|
690
763
|
name: "executeQuery",
|
|
691
|
-
description: `Execute SQL against Snowflake. Returns up to ${
|
|
764
|
+
description: `Execute SQL against Snowflake. Returns up to ${MAX_ROWS} rows.
|
|
692
765
|
Use for: schema exploration (SHOW DATABASES/SCHEMAS/TABLES, DESCRIBE TABLE, INFORMATION_SCHEMA), data sampling, analytical queries.
|
|
693
766
|
Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
694
767
|
inputSchema: inputSchema2,
|
|
@@ -734,7 +807,7 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
734
807
|
"Snowflake query timeout: query exceeded 60 seconds"
|
|
735
808
|
)
|
|
736
809
|
);
|
|
737
|
-
},
|
|
810
|
+
}, QUERY_TIMEOUT_MS);
|
|
738
811
|
conn.execute({
|
|
739
812
|
sqlText: sql,
|
|
740
813
|
complete: (err, _stmt, rows) => {
|
|
@@ -752,12 +825,12 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
752
825
|
`[connector-query] Snowflake destroy error: ${err.message}`
|
|
753
826
|
);
|
|
754
827
|
});
|
|
755
|
-
const truncated = allRows.length >
|
|
828
|
+
const truncated = allRows.length > MAX_ROWS;
|
|
756
829
|
return {
|
|
757
830
|
success: true,
|
|
758
|
-
rowCount: Math.min(allRows.length,
|
|
831
|
+
rowCount: Math.min(allRows.length, MAX_ROWS),
|
|
759
832
|
truncated,
|
|
760
|
-
rows: allRows.slice(0,
|
|
833
|
+
rows: allRows.slice(0, MAX_ROWS)
|
|
761
834
|
};
|
|
762
835
|
} catch (err) {
|
|
763
836
|
const msg = err instanceof Error ? err.message : String(err);
|
|
@@ -1091,7 +1164,7 @@ var POSTGRES_DEFAULT_PORT = 5432;
|
|
|
1091
1164
|
|
|
1092
1165
|
// ../connectors/src/connectors/postgresql/tools/execute-query.ts
|
|
1093
1166
|
import { z as z3 } from "zod";
|
|
1094
|
-
var
|
|
1167
|
+
var MAX_ROWS2 = 500;
|
|
1095
1168
|
var CONNECT_TIMEOUT_MS = 1e4;
|
|
1096
1169
|
var STATEMENT_TIMEOUT_MS = 6e4;
|
|
1097
1170
|
var inputSchema3 = z3.object({
|
|
@@ -1115,7 +1188,7 @@ var outputSchema3 = z3.discriminatedUnion("success", [
|
|
|
1115
1188
|
]);
|
|
1116
1189
|
var executeQueryTool3 = new ConnectorTool({
|
|
1117
1190
|
name: "executeQuery",
|
|
1118
|
-
description: `Execute SQL against PostgreSQL. Returns up to ${
|
|
1191
|
+
description: `Execute SQL against PostgreSQL. Returns up to ${MAX_ROWS2} rows.
|
|
1119
1192
|
Use for: schema exploration (information_schema), data sampling, analytical queries.
|
|
1120
1193
|
Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
1121
1194
|
inputSchema: inputSchema3,
|
|
@@ -1153,12 +1226,12 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
1153
1226
|
STATEMENT_TIMEOUT_MS
|
|
1154
1227
|
);
|
|
1155
1228
|
const rows = result.rows;
|
|
1156
|
-
const truncated = rows.length >
|
|
1229
|
+
const truncated = rows.length > MAX_ROWS2;
|
|
1157
1230
|
return {
|
|
1158
1231
|
success: true,
|
|
1159
|
-
rowCount: Math.min(rows.length,
|
|
1232
|
+
rowCount: Math.min(rows.length, MAX_ROWS2),
|
|
1160
1233
|
truncated,
|
|
1161
|
-
rows: rows.slice(0,
|
|
1234
|
+
rows: rows.slice(0, MAX_ROWS2)
|
|
1162
1235
|
};
|
|
1163
1236
|
} finally {
|
|
1164
1237
|
await pool.end();
|
|
@@ -1295,9 +1368,9 @@ var MYSQL_DEFAULT_PORT = 3306;
|
|
|
1295
1368
|
|
|
1296
1369
|
// ../connectors/src/connectors/mysql/tools/execute-query.ts
|
|
1297
1370
|
import { z as z4 } from "zod";
|
|
1298
|
-
var
|
|
1371
|
+
var MAX_ROWS3 = 500;
|
|
1299
1372
|
var CONNECT_TIMEOUT_MS2 = 1e4;
|
|
1300
|
-
var
|
|
1373
|
+
var QUERY_TIMEOUT_MS2 = 6e4;
|
|
1301
1374
|
var inputSchema4 = z4.object({
|
|
1302
1375
|
toolUseIntent: z4.string().optional().describe(
|
|
1303
1376
|
"Brief description of what you intend to accomplish with this tool call"
|
|
@@ -1319,7 +1392,7 @@ var outputSchema4 = z4.discriminatedUnion("success", [
|
|
|
1319
1392
|
]);
|
|
1320
1393
|
var executeQueryTool4 = new ConnectorTool({
|
|
1321
1394
|
name: "executeQuery",
|
|
1322
|
-
description: `Execute SQL against MySQL. Returns up to ${
|
|
1395
|
+
description: `Execute SQL against MySQL. Returns up to ${MAX_ROWS3} rows.
|
|
1323
1396
|
Use for: schema exploration (information_schema), data sampling, analytical queries.
|
|
1324
1397
|
Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
1325
1398
|
inputSchema: inputSchema4,
|
|
@@ -1352,16 +1425,16 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
1352
1425
|
try {
|
|
1353
1426
|
const queryPromise = pool.query(sql);
|
|
1354
1427
|
const timeoutPromise = new Promise(
|
|
1355
|
-
(_, reject) => setTimeout(() => reject(new Error("Query timed out after 60 seconds")),
|
|
1428
|
+
(_, reject) => setTimeout(() => reject(new Error("Query timed out after 60 seconds")), QUERY_TIMEOUT_MS2)
|
|
1356
1429
|
);
|
|
1357
1430
|
const [rows] = await Promise.race([queryPromise, timeoutPromise]);
|
|
1358
1431
|
const resultRows = Array.isArray(rows) ? rows : [];
|
|
1359
|
-
const truncated = resultRows.length >
|
|
1432
|
+
const truncated = resultRows.length > MAX_ROWS3;
|
|
1360
1433
|
return {
|
|
1361
1434
|
success: true,
|
|
1362
|
-
rowCount: Math.min(resultRows.length,
|
|
1435
|
+
rowCount: Math.min(resultRows.length, MAX_ROWS3),
|
|
1363
1436
|
truncated,
|
|
1364
|
-
rows: resultRows.slice(0,
|
|
1437
|
+
rows: resultRows.slice(0, MAX_ROWS3)
|
|
1365
1438
|
};
|
|
1366
1439
|
} finally {
|
|
1367
1440
|
await pool.end();
|
|
@@ -1688,7 +1761,7 @@ var bigqueryOnboarding = new ConnectorOnboarding({
|
|
|
1688
1761
|
|
|
1689
1762
|
// ../connectors/src/connectors/bigquery/tools/execute-query.ts
|
|
1690
1763
|
import { z as z7 } from "zod";
|
|
1691
|
-
var
|
|
1764
|
+
var MAX_ROWS4 = 500;
|
|
1692
1765
|
var inputSchema7 = z7.object({
|
|
1693
1766
|
toolUseIntent: z7.string().optional().describe(
|
|
1694
1767
|
"Brief description of what you intend to accomplish with this tool call"
|
|
@@ -1712,7 +1785,7 @@ var outputSchema7 = z7.discriminatedUnion("success", [
|
|
|
1712
1785
|
]);
|
|
1713
1786
|
var executeQueryTool5 = new ConnectorTool({
|
|
1714
1787
|
name: "executeQuery",
|
|
1715
|
-
description: `Execute SQL against BigQuery. Returns up to ${
|
|
1788
|
+
description: `Execute SQL against BigQuery. Returns up to ${MAX_ROWS4} rows.
|
|
1716
1789
|
Use for: schema exploration (INFORMATION_SCHEMA), data sampling, analytical queries.
|
|
1717
1790
|
Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
1718
1791
|
inputSchema: inputSchema7,
|
|
@@ -1739,12 +1812,12 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
1739
1812
|
const [job] = await bq.createQueryJob({ query: sql });
|
|
1740
1813
|
const [rows] = await job.getQueryResults();
|
|
1741
1814
|
const allRows = rows;
|
|
1742
|
-
const truncated = allRows.length >
|
|
1815
|
+
const truncated = allRows.length > MAX_ROWS4;
|
|
1743
1816
|
return {
|
|
1744
1817
|
success: true,
|
|
1745
|
-
rowCount: Math.min(allRows.length,
|
|
1818
|
+
rowCount: Math.min(allRows.length, MAX_ROWS4),
|
|
1746
1819
|
truncated,
|
|
1747
|
-
rows: allRows.slice(0,
|
|
1820
|
+
rows: allRows.slice(0, MAX_ROWS4)
|
|
1748
1821
|
};
|
|
1749
1822
|
} catch (err) {
|
|
1750
1823
|
const msg = err instanceof Error ? err.message : String(err);
|
|
@@ -2145,7 +2218,7 @@ var bigqueryOnboarding2 = new ConnectorOnboarding({
|
|
|
2145
2218
|
|
|
2146
2219
|
// ../connectors/src/connectors/bigquery-oauth/tools/execute-query.ts
|
|
2147
2220
|
import { z as z10 } from "zod";
|
|
2148
|
-
var
|
|
2221
|
+
var MAX_ROWS5 = 500;
|
|
2149
2222
|
var REQUEST_TIMEOUT_MS3 = 6e4;
|
|
2150
2223
|
var cachedToken3 = null;
|
|
2151
2224
|
async function getProxyToken3(config) {
|
|
@@ -2212,7 +2285,7 @@ function parseQueryResponse(data) {
|
|
|
2212
2285
|
}
|
|
2213
2286
|
var executeQueryTool6 = new ConnectorTool({
|
|
2214
2287
|
name: "executeQuery",
|
|
2215
|
-
description: `Execute SQL against BigQuery via OAuth. Returns up to ${
|
|
2288
|
+
description: `Execute SQL against BigQuery via OAuth. Returns up to ${MAX_ROWS5} rows.
|
|
2216
2289
|
Use for: schema exploration (INFORMATION_SCHEMA), data sampling, analytical queries.
|
|
2217
2290
|
Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
2218
2291
|
inputSchema: inputSchema10,
|
|
@@ -2245,7 +2318,7 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
2245
2318
|
body: JSON.stringify({
|
|
2246
2319
|
url: queryUrl,
|
|
2247
2320
|
method: "POST",
|
|
2248
|
-
body: { query: sql, useLegacySql: false, maxResults:
|
|
2321
|
+
body: { query: sql, useLegacySql: false, maxResults: MAX_ROWS5 }
|
|
2249
2322
|
}),
|
|
2250
2323
|
signal: controller.signal
|
|
2251
2324
|
});
|
|
@@ -2255,12 +2328,12 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
2255
2328
|
return { success: false, error: errorMessage };
|
|
2256
2329
|
}
|
|
2257
2330
|
const rows = parseQueryResponse(data);
|
|
2258
|
-
const truncated = rows.length >
|
|
2331
|
+
const truncated = rows.length > MAX_ROWS5;
|
|
2259
2332
|
return {
|
|
2260
2333
|
success: true,
|
|
2261
|
-
rowCount: Math.min(rows.length,
|
|
2334
|
+
rowCount: Math.min(rows.length, MAX_ROWS5),
|
|
2262
2335
|
truncated,
|
|
2263
|
-
rows: rows.slice(0,
|
|
2336
|
+
rows: rows.slice(0, MAX_ROWS5)
|
|
2264
2337
|
};
|
|
2265
2338
|
} finally {
|
|
2266
2339
|
clearTimeout(timeout);
|
|
@@ -2440,7 +2513,7 @@ var parameters7 = {
|
|
|
2440
2513
|
|
|
2441
2514
|
// ../connectors/src/connectors/aws-athena/tools/execute-query.ts
|
|
2442
2515
|
import { z as z11 } from "zod";
|
|
2443
|
-
var
|
|
2516
|
+
var MAX_ROWS6 = 500;
|
|
2444
2517
|
var POLL_INTERVAL_MS = 1e3;
|
|
2445
2518
|
var POLL_TIMEOUT_MS = 12e4;
|
|
2446
2519
|
var inputSchema11 = z11.object({
|
|
@@ -2464,7 +2537,7 @@ var outputSchema11 = z11.discriminatedUnion("success", [
|
|
|
2464
2537
|
]);
|
|
2465
2538
|
var executeQueryTool7 = new ConnectorTool({
|
|
2466
2539
|
name: "executeQuery",
|
|
2467
|
-
description: `Execute SQL against AWS Athena. Returns up to ${
|
|
2540
|
+
description: `Execute SQL against AWS Athena. Returns up to ${MAX_ROWS6} rows.
|
|
2468
2541
|
Use for: schema exploration (SHOW DATABASES/TABLES, DESCRIBE TABLE), data sampling, analytical queries on S3 data.
|
|
2469
2542
|
Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
2470
2543
|
inputSchema: inputSchema11,
|
|
@@ -2541,12 +2614,12 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
2541
2614
|
});
|
|
2542
2615
|
return obj;
|
|
2543
2616
|
});
|
|
2544
|
-
const truncated = dataRows.length >
|
|
2617
|
+
const truncated = dataRows.length > MAX_ROWS6;
|
|
2545
2618
|
return {
|
|
2546
2619
|
success: true,
|
|
2547
|
-
rowCount: Math.min(dataRows.length,
|
|
2620
|
+
rowCount: Math.min(dataRows.length, MAX_ROWS6),
|
|
2548
2621
|
truncated,
|
|
2549
|
-
rows: dataRows.slice(0,
|
|
2622
|
+
rows: dataRows.slice(0, MAX_ROWS6)
|
|
2550
2623
|
};
|
|
2551
2624
|
} catch (err) {
|
|
2552
2625
|
const msg = err instanceof Error ? err.message : String(err);
|
|
@@ -3461,7 +3534,7 @@ var parameters9 = {
|
|
|
3461
3534
|
|
|
3462
3535
|
// ../connectors/src/connectors/redshift/tools/execute-query.ts
|
|
3463
3536
|
import { z as z15 } from "zod";
|
|
3464
|
-
var
|
|
3537
|
+
var MAX_ROWS7 = 500;
|
|
3465
3538
|
var POLL_INTERVAL_MS2 = 1e3;
|
|
3466
3539
|
var POLL_TIMEOUT_MS2 = 12e4;
|
|
3467
3540
|
var inputSchema15 = z15.object({
|
|
@@ -3487,7 +3560,7 @@ var outputSchema15 = z15.discriminatedUnion("success", [
|
|
|
3487
3560
|
]);
|
|
3488
3561
|
var executeQueryTool8 = new ConnectorTool({
|
|
3489
3562
|
name: "executeQuery",
|
|
3490
|
-
description: `Execute SQL against Amazon Redshift. Returns up to ${
|
|
3563
|
+
description: `Execute SQL against Amazon Redshift. Returns up to ${MAX_ROWS7} rows.
|
|
3491
3564
|
Use for: schema exploration, data sampling, analytical queries.
|
|
3492
3565
|
Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
3493
3566
|
inputSchema: inputSchema15,
|
|
@@ -3566,12 +3639,12 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
3566
3639
|
});
|
|
3567
3640
|
return row;
|
|
3568
3641
|
});
|
|
3569
|
-
const truncated = allRows.length >
|
|
3642
|
+
const truncated = allRows.length > MAX_ROWS7;
|
|
3570
3643
|
return {
|
|
3571
3644
|
success: true,
|
|
3572
|
-
rowCount: Math.min(allRows.length,
|
|
3645
|
+
rowCount: Math.min(allRows.length, MAX_ROWS7),
|
|
3573
3646
|
truncated,
|
|
3574
|
-
rows: allRows.slice(0,
|
|
3647
|
+
rows: allRows.slice(0, MAX_ROWS7)
|
|
3575
3648
|
};
|
|
3576
3649
|
} catch (err) {
|
|
3577
3650
|
const msg = err instanceof Error ? err.message : String(err);
|
|
@@ -3792,7 +3865,7 @@ var parameters10 = {
|
|
|
3792
3865
|
|
|
3793
3866
|
// ../connectors/src/connectors/databricks/tools/execute-query.ts
|
|
3794
3867
|
import { z as z16 } from "zod";
|
|
3795
|
-
var
|
|
3868
|
+
var MAX_ROWS8 = 500;
|
|
3796
3869
|
var inputSchema16 = z16.object({
|
|
3797
3870
|
toolUseIntent: z16.string().optional().describe(
|
|
3798
3871
|
"Brief description of what you intend to accomplish with this tool call"
|
|
@@ -3814,7 +3887,7 @@ var outputSchema16 = z16.discriminatedUnion("success", [
|
|
|
3814
3887
|
]);
|
|
3815
3888
|
var executeQueryTool9 = new ConnectorTool({
|
|
3816
3889
|
name: "executeQuery",
|
|
3817
|
-
description: `Execute SQL against Databricks. Returns up to ${
|
|
3890
|
+
description: `Execute SQL against Databricks. Returns up to ${MAX_ROWS8} rows.
|
|
3818
3891
|
Use for: schema exploration (SHOW CATALOGS/DATABASES/TABLES, DESCRIBE TABLE), data sampling, analytical queries.
|
|
3819
3892
|
Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
3820
3893
|
inputSchema: inputSchema16,
|
|
@@ -3845,12 +3918,12 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
3845
3918
|
runAsync: true
|
|
3846
3919
|
});
|
|
3847
3920
|
const allRows = await operation.fetchAll();
|
|
3848
|
-
const truncated = allRows.length >
|
|
3921
|
+
const truncated = allRows.length > MAX_ROWS8;
|
|
3849
3922
|
return {
|
|
3850
3923
|
success: true,
|
|
3851
|
-
rowCount: Math.min(allRows.length,
|
|
3924
|
+
rowCount: Math.min(allRows.length, MAX_ROWS8),
|
|
3852
3925
|
truncated,
|
|
3853
|
-
rows: allRows.slice(0,
|
|
3926
|
+
rows: allRows.slice(0, MAX_ROWS8)
|
|
3854
3927
|
};
|
|
3855
3928
|
} finally {
|
|
3856
3929
|
if (operation) await operation.close().catch(() => {
|
|
@@ -10795,7 +10868,7 @@ var parameters29 = {
|
|
|
10795
10868
|
|
|
10796
10869
|
// ../connectors/src/connectors/squadbase-db/tools/execute-query.ts
|
|
10797
10870
|
import { z as z40 } from "zod";
|
|
10798
|
-
var
|
|
10871
|
+
var MAX_ROWS9 = 500;
|
|
10799
10872
|
var CONNECT_TIMEOUT_MS3 = 1e4;
|
|
10800
10873
|
var STATEMENT_TIMEOUT_MS2 = 6e4;
|
|
10801
10874
|
var inputSchema40 = z40.object({
|
|
@@ -10819,7 +10892,7 @@ var outputSchema40 = z40.discriminatedUnion("success", [
|
|
|
10819
10892
|
]);
|
|
10820
10893
|
var executeQueryTool10 = new ConnectorTool({
|
|
10821
10894
|
name: "executeQuery",
|
|
10822
|
-
description: `Execute SQL against Squadbase DB (PostgreSQL). Returns up to ${
|
|
10895
|
+
description: `Execute SQL against Squadbase DB (PostgreSQL). Returns up to ${MAX_ROWS9} rows.
|
|
10823
10896
|
Use for: schema exploration (information_schema), data sampling, analytical queries.
|
|
10824
10897
|
Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
10825
10898
|
inputSchema: inputSchema40,
|
|
@@ -10848,12 +10921,12 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
10848
10921
|
try {
|
|
10849
10922
|
const result = await pool.query(sql);
|
|
10850
10923
|
const rows = result.rows;
|
|
10851
|
-
const truncated = rows.length >
|
|
10924
|
+
const truncated = rows.length > MAX_ROWS9;
|
|
10852
10925
|
return {
|
|
10853
10926
|
success: true,
|
|
10854
|
-
rowCount: Math.min(rows.length,
|
|
10927
|
+
rowCount: Math.min(rows.length, MAX_ROWS9),
|
|
10855
10928
|
truncated,
|
|
10856
|
-
rows: rows.slice(0,
|
|
10929
|
+
rows: rows.slice(0, MAX_ROWS9)
|
|
10857
10930
|
};
|
|
10858
10931
|
} finally {
|
|
10859
10932
|
await pool.end();
|
|
@@ -13627,8 +13700,8 @@ var parameters41 = {
|
|
|
13627
13700
|
|
|
13628
13701
|
// ../connectors/src/connectors/clickhouse/tools/execute-query.ts
|
|
13629
13702
|
import { z as z49 } from "zod";
|
|
13630
|
-
var
|
|
13631
|
-
var
|
|
13703
|
+
var MAX_ROWS10 = 500;
|
|
13704
|
+
var QUERY_TIMEOUT_MS3 = 6e4;
|
|
13632
13705
|
var inputSchema49 = z49.object({
|
|
13633
13706
|
toolUseIntent: z49.string().optional().describe(
|
|
13634
13707
|
"Brief description of what you intend to accomplish with this tool call"
|
|
@@ -13650,7 +13723,7 @@ var outputSchema49 = z49.discriminatedUnion("success", [
|
|
|
13650
13723
|
]);
|
|
13651
13724
|
var executeQueryTool11 = new ConnectorTool({
|
|
13652
13725
|
name: "executeQuery",
|
|
13653
|
-
description: `Execute SQL against ClickHouse. Returns up to ${
|
|
13726
|
+
description: `Execute SQL against ClickHouse. Returns up to ${MAX_ROWS10} rows.
|
|
13654
13727
|
Use for: schema exploration (SHOW DATABASES, SHOW TABLES, DESCRIBE TABLE), data sampling, analytical queries on large-scale columnar data.
|
|
13655
13728
|
Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
13656
13729
|
inputSchema: inputSchema49,
|
|
@@ -13678,7 +13751,7 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
13678
13751
|
username,
|
|
13679
13752
|
password: password || "",
|
|
13680
13753
|
database: database || "default",
|
|
13681
|
-
request_timeout:
|
|
13754
|
+
request_timeout: QUERY_TIMEOUT_MS3
|
|
13682
13755
|
});
|
|
13683
13756
|
try {
|
|
13684
13757
|
const resultSet = await client.query({
|
|
@@ -13686,12 +13759,12 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
13686
13759
|
format: "JSONEachRow"
|
|
13687
13760
|
});
|
|
13688
13761
|
const allRows = await resultSet.json();
|
|
13689
|
-
const truncated = allRows.length >
|
|
13762
|
+
const truncated = allRows.length > MAX_ROWS10;
|
|
13690
13763
|
return {
|
|
13691
13764
|
success: true,
|
|
13692
|
-
rowCount: Math.min(allRows.length,
|
|
13765
|
+
rowCount: Math.min(allRows.length, MAX_ROWS10),
|
|
13693
13766
|
truncated,
|
|
13694
|
-
rows: allRows.slice(0,
|
|
13767
|
+
rows: allRows.slice(0, MAX_ROWS10)
|
|
13695
13768
|
};
|
|
13696
13769
|
} finally {
|
|
13697
13770
|
await client.close();
|
|
@@ -13847,7 +13920,7 @@ var parameters42 = {
|
|
|
13847
13920
|
import { z as z50 } from "zod";
|
|
13848
13921
|
var MAX_DOCUMENTS = 500;
|
|
13849
13922
|
var CONNECT_TIMEOUT_MS4 = 1e4;
|
|
13850
|
-
var
|
|
13923
|
+
var QUERY_TIMEOUT_MS4 = 6e4;
|
|
13851
13924
|
var inputSchema50 = z50.object({
|
|
13852
13925
|
toolUseIntent: z50.string().optional().describe(
|
|
13853
13926
|
"Brief description of what you intend to accomplish with this tool call"
|
|
@@ -13906,7 +13979,7 @@ For listing collections, use the aggregate tool with an empty pipeline on the sp
|
|
|
13906
13979
|
const client = new MongoClient(connectionUrl, {
|
|
13907
13980
|
connectTimeoutMS: CONNECT_TIMEOUT_MS4,
|
|
13908
13981
|
serverSelectionTimeoutMS: CONNECT_TIMEOUT_MS4,
|
|
13909
|
-
socketTimeoutMS:
|
|
13982
|
+
socketTimeoutMS: QUERY_TIMEOUT_MS4
|
|
13910
13983
|
});
|
|
13911
13984
|
try {
|
|
13912
13985
|
await client.connect();
|
|
@@ -13952,7 +14025,7 @@ For listing collections, use the aggregate tool with an empty pipeline on the sp
|
|
|
13952
14025
|
import { z as z51 } from "zod";
|
|
13953
14026
|
var MAX_DOCUMENTS2 = 500;
|
|
13954
14027
|
var CONNECT_TIMEOUT_MS5 = 1e4;
|
|
13955
|
-
var
|
|
14028
|
+
var QUERY_TIMEOUT_MS5 = 6e4;
|
|
13956
14029
|
var inputSchema51 = z51.object({
|
|
13957
14030
|
toolUseIntent: z51.string().optional().describe(
|
|
13958
14031
|
"Brief description of what you intend to accomplish with this tool call"
|
|
@@ -14003,7 +14076,7 @@ Common stages: $match (filter), $group (aggregate), $sort (order), $project (res
|
|
|
14003
14076
|
const client = new MongoClient(connectionUrl, {
|
|
14004
14077
|
connectTimeoutMS: CONNECT_TIMEOUT_MS5,
|
|
14005
14078
|
serverSelectionTimeoutMS: CONNECT_TIMEOUT_MS5,
|
|
14006
|
-
socketTimeoutMS:
|
|
14079
|
+
socketTimeoutMS: QUERY_TIMEOUT_MS5
|
|
14007
14080
|
});
|
|
14008
14081
|
try {
|
|
14009
14082
|
await client.connect();
|
|
@@ -23232,7 +23305,7 @@ function redactJdbcUrl(jdbcUrl) {
|
|
|
23232
23305
|
}
|
|
23233
23306
|
|
|
23234
23307
|
// ../connectors/src/connectors/jdbc/tools/execute-query.ts
|
|
23235
|
-
var
|
|
23308
|
+
var MAX_ROWS11 = 500;
|
|
23236
23309
|
var CONNECT_TIMEOUT_MS7 = 1e4;
|
|
23237
23310
|
var STATEMENT_TIMEOUT_MS3 = 6e4;
|
|
23238
23311
|
var inputSchema82 = z82.object({
|
|
@@ -23258,7 +23331,7 @@ var outputSchema82 = z82.discriminatedUnion("success", [
|
|
|
23258
23331
|
]);
|
|
23259
23332
|
var executeQueryTool12 = new ConnectorTool({
|
|
23260
23333
|
name: "executeQuery",
|
|
23261
|
-
description: `Execute a SQL query through the JDBC connector. Returns up to ${
|
|
23334
|
+
description: `Execute a SQL query through the JDBC connector. Returns up to ${MAX_ROWS11} rows.
|
|
23262
23335
|
Use for: schema exploration via \`information_schema\` (or USER_TABLES on Oracle), data sampling, analytical queries.
|
|
23263
23336
|
The connector dispatches by JDBC URL prefix to the matching driver
|
|
23264
23337
|
(PostgreSQL / Redshift / MySQL / MariaDB / SQL Server / Oracle), so use the dialect that matches the connection.
|
|
@@ -23299,9 +23372,9 @@ Always bound results: LIMIT for PG/MySQL/Redshift, TOP for SQL Server, FETCH FIR
|
|
|
23299
23372
|
const rows = result.rows;
|
|
23300
23373
|
return {
|
|
23301
23374
|
success: true,
|
|
23302
|
-
rowCount: Math.min(rows.length,
|
|
23303
|
-
truncated: rows.length >
|
|
23304
|
-
rows: rows.slice(0,
|
|
23375
|
+
rowCount: Math.min(rows.length, MAX_ROWS11),
|
|
23376
|
+
truncated: rows.length > MAX_ROWS11,
|
|
23377
|
+
rows: rows.slice(0, MAX_ROWS11)
|
|
23305
23378
|
};
|
|
23306
23379
|
}
|
|
23307
23380
|
if (parsed.driver === "oracle") {
|
|
@@ -23316,9 +23389,9 @@ Always bound results: LIMIT for PG/MySQL/Redshift, TOP for SQL Server, FETCH FIR
|
|
|
23316
23389
|
const rows = result.rows;
|
|
23317
23390
|
return {
|
|
23318
23391
|
success: true,
|
|
23319
|
-
rowCount: Math.min(rows.length,
|
|
23320
|
-
truncated: rows.length >
|
|
23321
|
-
rows: rows.slice(0,
|
|
23392
|
+
rowCount: Math.min(rows.length, MAX_ROWS11),
|
|
23393
|
+
truncated: rows.length > MAX_ROWS11,
|
|
23394
|
+
rows: rows.slice(0, MAX_ROWS11)
|
|
23322
23395
|
};
|
|
23323
23396
|
}
|
|
23324
23397
|
let tunnel;
|
|
@@ -23342,12 +23415,12 @@ Always bound results: LIMIT for PG/MySQL/Redshift, TOP for SQL Server, FETCH FIR
|
|
|
23342
23415
|
STATEMENT_TIMEOUT_MS3
|
|
23343
23416
|
);
|
|
23344
23417
|
const rows = result.rows;
|
|
23345
|
-
const truncated = rows.length >
|
|
23418
|
+
const truncated = rows.length > MAX_ROWS11;
|
|
23346
23419
|
return {
|
|
23347
23420
|
success: true,
|
|
23348
|
-
rowCount: Math.min(rows.length,
|
|
23421
|
+
rowCount: Math.min(rows.length, MAX_ROWS11),
|
|
23349
23422
|
truncated,
|
|
23350
|
-
rows: rows.slice(0,
|
|
23423
|
+
rows: rows.slice(0, MAX_ROWS11)
|
|
23351
23424
|
};
|
|
23352
23425
|
} finally {
|
|
23353
23426
|
await pool2.end();
|
|
@@ -23368,12 +23441,12 @@ Always bound results: LIMIT for PG/MySQL/Redshift, TOP for SQL Server, FETCH FIR
|
|
|
23368
23441
|
);
|
|
23369
23442
|
const [rows] = await Promise.race([queryPromise, timeoutPromise]);
|
|
23370
23443
|
const resultRows = Array.isArray(rows) ? rows : [];
|
|
23371
|
-
const truncated = resultRows.length >
|
|
23444
|
+
const truncated = resultRows.length > MAX_ROWS11;
|
|
23372
23445
|
return {
|
|
23373
23446
|
success: true,
|
|
23374
|
-
rowCount: Math.min(resultRows.length,
|
|
23447
|
+
rowCount: Math.min(resultRows.length, MAX_ROWS11),
|
|
23375
23448
|
truncated,
|
|
23376
|
-
rows: resultRows.slice(0,
|
|
23449
|
+
rows: resultRows.slice(0, MAX_ROWS11)
|
|
23377
23450
|
};
|
|
23378
23451
|
} finally {
|
|
23379
23452
|
await pool.end();
|
|
@@ -24642,7 +24715,7 @@ var parameters70 = {
|
|
|
24642
24715
|
|
|
24643
24716
|
// ../connectors/src/connectors/supabase/tools/execute-query.ts
|
|
24644
24717
|
import { z as z86 } from "zod";
|
|
24645
|
-
var
|
|
24718
|
+
var MAX_ROWS12 = 500;
|
|
24646
24719
|
var CONNECT_TIMEOUT_MS8 = 1e4;
|
|
24647
24720
|
var STATEMENT_TIMEOUT_MS4 = 6e4;
|
|
24648
24721
|
var inputSchema86 = z86.object({
|
|
@@ -24668,7 +24741,7 @@ var outputSchema86 = z86.discriminatedUnion("success", [
|
|
|
24668
24741
|
]);
|
|
24669
24742
|
var executeQueryTool13 = new ConnectorTool({
|
|
24670
24743
|
name: "executeQuery",
|
|
24671
|
-
description: `Execute SQL against a Supabase Postgres database. Returns up to ${
|
|
24744
|
+
description: `Execute SQL against a Supabase Postgres database. Returns up to ${MAX_ROWS12} rows.
|
|
24672
24745
|
Use for: schema exploration (information_schema), data sampling, and analytical queries against Supabase tables.
|
|
24673
24746
|
User tables live in the \`public\` schema by default; Supabase-managed metadata lives in \`auth\` and \`storage\`.
|
|
24674
24747
|
Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
@@ -24698,12 +24771,12 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
24698
24771
|
try {
|
|
24699
24772
|
const result = await pool.query(sql);
|
|
24700
24773
|
const rows = result.rows;
|
|
24701
|
-
const truncated = rows.length >
|
|
24774
|
+
const truncated = rows.length > MAX_ROWS12;
|
|
24702
24775
|
return {
|
|
24703
24776
|
success: true,
|
|
24704
|
-
rowCount: Math.min(rows.length,
|
|
24777
|
+
rowCount: Math.min(rows.length, MAX_ROWS12),
|
|
24705
24778
|
truncated,
|
|
24706
|
-
rows: rows.slice(0,
|
|
24779
|
+
rows: rows.slice(0, MAX_ROWS12)
|
|
24707
24780
|
};
|
|
24708
24781
|
} finally {
|
|
24709
24782
|
await pool.end();
|
|
@@ -25182,7 +25255,7 @@ var parameters72 = {
|
|
|
25182
25255
|
|
|
25183
25256
|
// ../connectors/src/connectors/sqlserver/tools/execute-query.ts
|
|
25184
25257
|
import { z as z88 } from "zod";
|
|
25185
|
-
var
|
|
25258
|
+
var MAX_ROWS13 = 500;
|
|
25186
25259
|
var inputSchema88 = z88.object({
|
|
25187
25260
|
toolUseIntent: z88.string().optional().describe(
|
|
25188
25261
|
"Brief description of what you intend to accomplish with this tool call"
|
|
@@ -25206,7 +25279,7 @@ var outputSchema88 = z88.discriminatedUnion("success", [
|
|
|
25206
25279
|
]);
|
|
25207
25280
|
var executeQueryTool14 = new ConnectorTool({
|
|
25208
25281
|
name: "executeQuery",
|
|
25209
|
-
description: `Execute a T-SQL query against Microsoft SQL Server. Returns up to ${
|
|
25282
|
+
description: `Execute a T-SQL query against Microsoft SQL Server. Returns up to ${MAX_ROWS13} rows.
|
|
25210
25283
|
Use for: schema exploration via \`INFORMATION_SCHEMA\`, data sampling, and analytical queries.
|
|
25211
25284
|
SQL Server uses \`TOP n\` instead of \`LIMIT n\`. Identifiers can be wrapped in square brackets (\`[schema].[table]\`).
|
|
25212
25285
|
Avoid loading large amounts of data; always include \`TOP\` in queries.`,
|
|
@@ -25239,12 +25312,12 @@ Avoid loading large amounts of data; always include \`TOP\` in queries.`,
|
|
|
25239
25312
|
const { rows } = await runMssqlQuery(parsed, sql, {
|
|
25240
25313
|
tunnelParams: connectionParamsToRecord(connection2)
|
|
25241
25314
|
});
|
|
25242
|
-
const truncated = rows.length >
|
|
25315
|
+
const truncated = rows.length > MAX_ROWS13;
|
|
25243
25316
|
return {
|
|
25244
25317
|
success: true,
|
|
25245
|
-
rowCount: Math.min(rows.length,
|
|
25318
|
+
rowCount: Math.min(rows.length, MAX_ROWS13),
|
|
25246
25319
|
truncated,
|
|
25247
|
-
rows: rows.slice(0,
|
|
25320
|
+
rows: rows.slice(0, MAX_ROWS13)
|
|
25248
25321
|
};
|
|
25249
25322
|
} catch (err) {
|
|
25250
25323
|
let msg = err instanceof Error ? err.message : String(err);
|
|
@@ -25377,7 +25450,7 @@ var parameters73 = {
|
|
|
25377
25450
|
|
|
25378
25451
|
// ../connectors/src/connectors/azure-sql/tools/execute-query.ts
|
|
25379
25452
|
import { z as z89 } from "zod";
|
|
25380
|
-
var
|
|
25453
|
+
var MAX_ROWS14 = 500;
|
|
25381
25454
|
var inputSchema89 = z89.object({
|
|
25382
25455
|
toolUseIntent: z89.string().optional().describe(
|
|
25383
25456
|
"Brief description of what you intend to accomplish with this tool call"
|
|
@@ -25401,7 +25474,7 @@ var outputSchema89 = z89.discriminatedUnion("success", [
|
|
|
25401
25474
|
]);
|
|
25402
25475
|
var executeQueryTool15 = new ConnectorTool({
|
|
25403
25476
|
name: "executeQuery",
|
|
25404
|
-
description: `Execute a T-SQL query against Azure SQL Database. Returns up to ${
|
|
25477
|
+
description: `Execute a T-SQL query against Azure SQL Database. Returns up to ${MAX_ROWS14} rows.
|
|
25405
25478
|
Use for: schema exploration via \`INFORMATION_SCHEMA\`, data sampling, and analytical queries.
|
|
25406
25479
|
Azure SQL is T-SQL: use \`TOP n\` instead of \`LIMIT n\`. Identifiers can be wrapped in square brackets.
|
|
25407
25480
|
Avoid loading large amounts of data; always include \`TOP\` in queries.`,
|
|
@@ -25435,12 +25508,12 @@ Avoid loading large amounts of data; always include \`TOP\` in queries.`,
|
|
|
25435
25508
|
forceEncrypt: true,
|
|
25436
25509
|
tunnelParams: connectionParamsToRecord(connection2)
|
|
25437
25510
|
});
|
|
25438
|
-
const truncated = rows.length >
|
|
25511
|
+
const truncated = rows.length > MAX_ROWS14;
|
|
25439
25512
|
return {
|
|
25440
25513
|
success: true,
|
|
25441
|
-
rowCount: Math.min(rows.length,
|
|
25514
|
+
rowCount: Math.min(rows.length, MAX_ROWS14),
|
|
25442
25515
|
truncated,
|
|
25443
|
-
rows: rows.slice(0,
|
|
25516
|
+
rows: rows.slice(0, MAX_ROWS14)
|
|
25444
25517
|
};
|
|
25445
25518
|
} catch (err) {
|
|
25446
25519
|
let msg = err instanceof Error ? err.message : String(err);
|
|
@@ -25917,7 +25990,7 @@ var parameters75 = {
|
|
|
25917
25990
|
|
|
25918
25991
|
// ../connectors/src/connectors/oracle/tools/execute-query.ts
|
|
25919
25992
|
import { z as z92 } from "zod";
|
|
25920
|
-
var
|
|
25993
|
+
var MAX_ROWS15 = 500;
|
|
25921
25994
|
var inputSchema92 = z92.object({
|
|
25922
25995
|
toolUseIntent: z92.string().optional().describe(
|
|
25923
25996
|
"Brief description of what you intend to accomplish with this tool call"
|
|
@@ -25941,7 +26014,7 @@ var outputSchema92 = z92.discriminatedUnion("success", [
|
|
|
25941
26014
|
]);
|
|
25942
26015
|
var executeQueryTool16 = new ConnectorTool({
|
|
25943
26016
|
name: "executeQuery",
|
|
25944
|
-
description: `Execute a query against an Oracle Database. Returns up to ${
|
|
26017
|
+
description: `Execute a query against an Oracle Database. Returns up to ${MAX_ROWS15} rows.
|
|
25945
26018
|
Use for: schema exploration via \`USER_TABLES\` / \`USER_TAB_COLUMNS\` / \`ALL_TABLES\`, data sampling, and analytical queries.
|
|
25946
26019
|
Oracle uses \`FETCH FIRST n ROWS ONLY\` (12c+) or \`ROWNUM\` for row limiting \u2014 there is no \`LIMIT\` keyword.
|
|
25947
26020
|
Unquoted identifiers are stored upper-case (\`SELECT * FROM employees\` resolves to \`EMPLOYEES\`).
|
|
@@ -25976,12 +26049,12 @@ Do NOT terminate statements with a semicolon; the driver rejects trailing termin
|
|
|
25976
26049
|
const { rows } = await runOracleQuery(parsed, cleanSql, {
|
|
25977
26050
|
tunnelParams: connectionParamsToRecord(connection2)
|
|
25978
26051
|
});
|
|
25979
|
-
const truncated = rows.length >
|
|
26052
|
+
const truncated = rows.length > MAX_ROWS15;
|
|
25980
26053
|
return {
|
|
25981
26054
|
success: true,
|
|
25982
|
-
rowCount: Math.min(rows.length,
|
|
26055
|
+
rowCount: Math.min(rows.length, MAX_ROWS15),
|
|
25983
26056
|
truncated,
|
|
25984
|
-
rows: rows.slice(0,
|
|
26057
|
+
rows: rows.slice(0, MAX_ROWS15)
|
|
25985
26058
|
};
|
|
25986
26059
|
} catch (err) {
|
|
25987
26060
|
let msg = err instanceof Error ? err.message : String(err);
|
|
@@ -26000,7 +26073,7 @@ var oracleConnector = new ConnectorPlugin({
|
|
|
26000
26073
|
description: "Connect to Oracle Database using a JDBC-style URL via the pure-JS Thin driver (no Oracle Instant Client required).",
|
|
26001
26074
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/3iGEdzvGHncU5bYqFOROiV/9e7bdda7230d7ca6b34e7f6a862de876/oracle-icon.webp",
|
|
26002
26075
|
parameters: parameters75,
|
|
26003
|
-
releaseFlag: { dev1: true, dev2:
|
|
26076
|
+
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
26004
26077
|
categories: ["database"],
|
|
26005
26078
|
onboarding: oracleOnboarding,
|
|
26006
26079
|
systemPrompt: {
|
|
@@ -27477,118 +27550,1356 @@ export default async function handler(c: Context) {
|
|
|
27477
27550
|
tools: tools79
|
|
27478
27551
|
});
|
|
27479
27552
|
|
|
27480
|
-
// ../connectors/src/connectors/
|
|
27481
|
-
|
|
27482
|
-
|
|
27483
|
-
|
|
27484
|
-
|
|
27485
|
-
|
|
27486
|
-
|
|
27487
|
-
|
|
27488
|
-
|
|
27489
|
-
|
|
27490
|
-
awsBilling: awsBillingConnector,
|
|
27491
|
-
postgresql: postgresqlConnector,
|
|
27492
|
-
mysql: mysqlConnector,
|
|
27493
|
-
googleAds: googleAdsConnector,
|
|
27494
|
-
googleAnalytics: googleAnalyticsConnector,
|
|
27495
|
-
googleAnalyticsOauth: googleAnalyticsOauthConnector,
|
|
27496
|
-
googleCalendar: googleCalendarConnector,
|
|
27497
|
-
googleCalendarOauth: googleCalendarOauthConnector,
|
|
27498
|
-
googleDocs: googleDocsConnector,
|
|
27499
|
-
googleDrive: googleDriveConnector,
|
|
27500
|
-
googleSheets: googleSheetsConnector,
|
|
27501
|
-
googleSlides: googleSlidesConnector,
|
|
27502
|
-
hubspotOauth: hubspotOauthConnector,
|
|
27503
|
-
stripeOauth: stripeOauthConnector,
|
|
27504
|
-
stripeApiKey: stripeApiKeyConnector,
|
|
27505
|
-
airtable: airtableConnector,
|
|
27506
|
-
airtableOauth: airtableOauthConnector,
|
|
27507
|
-
squadbaseDb: squadbaseDbConnector,
|
|
27508
|
-
kintone: kintoneConnector,
|
|
27509
|
-
kintoneApiToken: kintoneApiTokenConnector,
|
|
27510
|
-
wixStore: wixStoreConnector,
|
|
27511
|
-
openai: openaiConnector,
|
|
27512
|
-
gemini: geminiConnector,
|
|
27513
|
-
anthropic: anthropicConnector,
|
|
27514
|
-
amplitude: amplitudeConnector,
|
|
27515
|
-
attio: attioConnector,
|
|
27516
|
-
shopify: shopifyConnector,
|
|
27517
|
-
shopifyOauth: shopifyOauthConnector,
|
|
27518
|
-
hubspot: hubspotConnector,
|
|
27519
|
-
jira: jiraConnector,
|
|
27520
|
-
linear: linearConnector,
|
|
27521
|
-
asana: asanaConnector,
|
|
27522
|
-
clickhouse: clickhouseConnector,
|
|
27523
|
-
mongodb: mongodbConnector,
|
|
27524
|
-
notion: notionConnector,
|
|
27525
|
-
notionOauth: notionOauthConnector,
|
|
27526
|
-
metaAds: metaAdsConnector,
|
|
27527
|
-
metaAdsOauth: metaAdsOauthConnector,
|
|
27528
|
-
tiktokAds: tiktokAdsConnector,
|
|
27529
|
-
mailchimp: mailchimpConnector,
|
|
27530
|
-
mailchimpOauth: mailchimpOauthConnector,
|
|
27531
|
-
customerio: customerioConnector,
|
|
27532
|
-
gmail: gmailConnector,
|
|
27533
|
-
gmailOauth: gmailOauthConnector,
|
|
27534
|
-
googleAuditLog: googleAuditLogConnector,
|
|
27535
|
-
linkedinAds: linkedinAdsConnector,
|
|
27536
|
-
zendesk: zendeskConnector,
|
|
27537
|
-
zendeskOauth: zendeskOauthConnector,
|
|
27538
|
-
intercom: intercomConnector,
|
|
27539
|
-
intercomOauth: intercomOauthConnector,
|
|
27540
|
-
mixpanel: mixpanelConnector,
|
|
27541
|
-
grafana: grafanaConnector,
|
|
27542
|
-
backlog: backlogConnector,
|
|
27543
|
-
gamma: gammaConnector,
|
|
27544
|
-
sentry: sentryConnector,
|
|
27545
|
-
salesforce: salesforceConnector,
|
|
27546
|
-
influxdb: influxdbConnector,
|
|
27547
|
-
monday: mondayConnector,
|
|
27548
|
-
jdbc: jdbcConnector,
|
|
27549
|
-
semrush: semrushConnector,
|
|
27550
|
-
googleSearchConsoleOauth: googleSearchConsoleOauthConnector,
|
|
27551
|
-
supabase: supabaseConnector,
|
|
27552
|
-
clickup: clickupConnector,
|
|
27553
|
-
sqlserver: sqlserverConnector,
|
|
27554
|
-
azureSql: azureSqlConnector,
|
|
27555
|
-
cosmosdb: cosmosdbConnector,
|
|
27556
|
-
oracle: oracleConnector,
|
|
27557
|
-
freshservice: freshserviceConnector,
|
|
27558
|
-
freshdesk: freshdeskConnector,
|
|
27559
|
-
freshsales: freshsalesConnector,
|
|
27560
|
-
github: githubConnector
|
|
27561
|
-
};
|
|
27562
|
-
var connectors = {
|
|
27563
|
-
...plugins,
|
|
27564
|
-
/**
|
|
27565
|
-
* Return plugins that have at least one matching connection.
|
|
27566
|
-
*/
|
|
27567
|
-
pluginsFor(connections) {
|
|
27568
|
-
const keys = new Set(
|
|
27569
|
-
connections.map(
|
|
27570
|
-
(c) => ConnectorPlugin.deriveKey(c.connector.slug, c.connector.authType)
|
|
27571
|
-
)
|
|
27572
|
-
);
|
|
27573
|
-
return Object.values(plugins).filter((p) => keys.has(p.connectorKey));
|
|
27574
|
-
},
|
|
27575
|
-
/**
|
|
27576
|
-
* Find a plugin by slug and authType.
|
|
27577
|
-
*/
|
|
27578
|
-
findByKey(slug, authType) {
|
|
27579
|
-
const key = ConnectorPlugin.deriveKey(slug, authType);
|
|
27580
|
-
return Object.values(plugins).find((p) => p.connectorKey === key);
|
|
27553
|
+
// ../connectors/src/connectors/powerbi-oauth/tools/request.ts
|
|
27554
|
+
import { z as z97 } from "zod";
|
|
27555
|
+
var BASE_HOST12 = "https://api.powerbi.com";
|
|
27556
|
+
var BASE_PATH_SEGMENT15 = "/v1.0/myorg";
|
|
27557
|
+
var BASE_URL41 = `${BASE_HOST12}${BASE_PATH_SEGMENT15}`;
|
|
27558
|
+
var REQUEST_TIMEOUT_MS74 = 6e4;
|
|
27559
|
+
var cachedToken32 = null;
|
|
27560
|
+
async function getProxyToken32(config) {
|
|
27561
|
+
if (cachedToken32 && cachedToken32.expiresAt > Date.now() + 6e4) {
|
|
27562
|
+
return cachedToken32.token;
|
|
27581
27563
|
}
|
|
27582
|
-
}
|
|
27583
|
-
|
|
27584
|
-
|
|
27585
|
-
|
|
27586
|
-
|
|
27587
|
-
|
|
27588
|
-
|
|
27564
|
+
const url = `${config.appApiBaseUrl}/v0/database/${config.projectId}/environment/${config.environmentId}/oauth-request-proxy-token`;
|
|
27565
|
+
const res = await fetch(url, {
|
|
27566
|
+
method: "POST",
|
|
27567
|
+
headers: {
|
|
27568
|
+
"Content-Type": "application/json",
|
|
27569
|
+
"x-api-key": config.appApiKey,
|
|
27570
|
+
"project-id": config.projectId
|
|
27571
|
+
},
|
|
27572
|
+
body: JSON.stringify({
|
|
27573
|
+
sandboxId: config.sandboxId,
|
|
27574
|
+
issuedBy: "coding-agent"
|
|
27575
|
+
})
|
|
27576
|
+
});
|
|
27577
|
+
if (!res.ok) {
|
|
27578
|
+
const errorText = await res.text().catch(() => res.statusText);
|
|
27579
|
+
throw new Error(
|
|
27580
|
+
`Failed to get proxy token: HTTP ${res.status} ${errorText}`
|
|
27581
|
+
);
|
|
27589
27582
|
}
|
|
27590
|
-
const
|
|
27591
|
-
|
|
27583
|
+
const data = await res.json();
|
|
27584
|
+
cachedToken32 = {
|
|
27585
|
+
token: data.token,
|
|
27586
|
+
expiresAt: new Date(data.expiresAt).getTime()
|
|
27587
|
+
};
|
|
27588
|
+
return data.token;
|
|
27589
|
+
}
|
|
27590
|
+
var inputSchema97 = z97.object({
|
|
27591
|
+
toolUseIntent: z97.string().optional().describe(
|
|
27592
|
+
"Brief description of what you intend to accomplish with this tool call"
|
|
27593
|
+
),
|
|
27594
|
+
connectionId: z97.string().describe("ID of the Power BI OAuth connection to use"),
|
|
27595
|
+
method: z97.enum(["GET", "POST", "PATCH", "PUT", "DELETE"]).describe(
|
|
27596
|
+
"HTTP method. GET for reading workspaces/datasets/reports, POST for executeQueries / refresh, PATCH/PUT for updates, DELETE for removal."
|
|
27597
|
+
),
|
|
27598
|
+
path: z97.string().describe(
|
|
27599
|
+
"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."
|
|
27600
|
+
),
|
|
27601
|
+
queryParams: z97.record(z97.string(), z97.string()).optional().describe(
|
|
27602
|
+
`Query parameters to append (e.g., { $top: '50', $filter: "name eq 'Sales'" }).`
|
|
27603
|
+
),
|
|
27604
|
+
body: z97.record(z97.string(), z97.unknown()).optional().describe(
|
|
27605
|
+
"JSON request body for POST/PATCH/PUT/DELETE. Example executeQueries body: { queries: [{ query: 'EVALUATE TOPN(10, Sales)' }], serializerSettings: { includeNulls: true } }."
|
|
27606
|
+
)
|
|
27607
|
+
});
|
|
27608
|
+
var outputSchema97 = z97.discriminatedUnion("success", [
|
|
27609
|
+
z97.object({
|
|
27610
|
+
success: z97.literal(true),
|
|
27611
|
+
status: z97.number(),
|
|
27612
|
+
data: z97.unknown()
|
|
27613
|
+
}),
|
|
27614
|
+
z97.object({
|
|
27615
|
+
success: z97.literal(false),
|
|
27616
|
+
error: z97.string()
|
|
27617
|
+
})
|
|
27618
|
+
]);
|
|
27619
|
+
var requestTool56 = new ConnectorTool({
|
|
27620
|
+
name: "request",
|
|
27621
|
+
description: `Send authenticated requests to the Power BI REST API v1.0 using the user's Microsoft Entra OAuth token (proxied automatically).
|
|
27622
|
+
All paths are relative to https://api.powerbi.com/v1.0/myorg. Use the executeQueries endpoint to run DAX against a dataset.
|
|
27623
|
+
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.`,
|
|
27624
|
+
inputSchema: inputSchema97,
|
|
27625
|
+
outputSchema: outputSchema97,
|
|
27626
|
+
async execute({ connectionId, method, path: path5, queryParams, body }, connections, config) {
|
|
27627
|
+
const connection2 = connections.find((c) => c.id === connectionId);
|
|
27628
|
+
if (!connection2) {
|
|
27629
|
+
return {
|
|
27630
|
+
success: false,
|
|
27631
|
+
error: `Connection ${connectionId} not found`
|
|
27632
|
+
};
|
|
27633
|
+
}
|
|
27634
|
+
console.log(
|
|
27635
|
+
`[connector-request] powerbi-oauth/${connection2.name}: ${method} ${path5}`
|
|
27636
|
+
);
|
|
27637
|
+
try {
|
|
27638
|
+
const normalizedPath = normalizeRequestPath(path5, BASE_PATH_SEGMENT15);
|
|
27639
|
+
let url = `${BASE_URL41}${normalizedPath}`;
|
|
27640
|
+
if (queryParams) {
|
|
27641
|
+
const searchParams = new URLSearchParams(queryParams);
|
|
27642
|
+
url += `?${searchParams.toString()}`;
|
|
27643
|
+
}
|
|
27644
|
+
const token = await getProxyToken32(config.oauthProxy);
|
|
27645
|
+
const proxyUrl = `https://${config.oauthProxy.sandboxId}.${config.oauthProxy.previewBaseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
27646
|
+
const controller = new AbortController();
|
|
27647
|
+
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS74);
|
|
27648
|
+
try {
|
|
27649
|
+
const response = await fetch(proxyUrl, {
|
|
27650
|
+
method: "POST",
|
|
27651
|
+
headers: {
|
|
27652
|
+
"Content-Type": "application/json",
|
|
27653
|
+
Authorization: `Bearer ${token}`
|
|
27654
|
+
},
|
|
27655
|
+
body: JSON.stringify({
|
|
27656
|
+
url,
|
|
27657
|
+
method,
|
|
27658
|
+
...body !== void 0 ? { body } : {}
|
|
27659
|
+
}),
|
|
27660
|
+
signal: controller.signal
|
|
27661
|
+
});
|
|
27662
|
+
const text = await response.text();
|
|
27663
|
+
const data = text ? (() => {
|
|
27664
|
+
try {
|
|
27665
|
+
return JSON.parse(text);
|
|
27666
|
+
} catch {
|
|
27667
|
+
return text;
|
|
27668
|
+
}
|
|
27669
|
+
})() : null;
|
|
27670
|
+
if (!response.ok) {
|
|
27671
|
+
const errorMessage = data && typeof data === "object" && "error" in data ? JSON.stringify(data.error) : typeof data === "string" && data ? data : `HTTP ${response.status} ${response.statusText}`;
|
|
27672
|
+
return { success: false, error: errorMessage };
|
|
27673
|
+
}
|
|
27674
|
+
return { success: true, status: response.status, data };
|
|
27675
|
+
} finally {
|
|
27676
|
+
clearTimeout(timeout);
|
|
27677
|
+
}
|
|
27678
|
+
} catch (err) {
|
|
27679
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
27680
|
+
return { success: false, error: msg };
|
|
27681
|
+
}
|
|
27682
|
+
}
|
|
27683
|
+
});
|
|
27684
|
+
|
|
27685
|
+
// ../connectors/src/connectors/powerbi-oauth/setup.ts
|
|
27686
|
+
var requestToolName13 = `powerbi-oauth_${requestTool56.name}`;
|
|
27687
|
+
var powerbiOauthOnboarding = new ConnectorOnboarding({
|
|
27688
|
+
connectionSetupInstructions: {
|
|
27689
|
+
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
|
|
27690
|
+
|
|
27691
|
+
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
|
|
27692
|
+
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
|
|
27693
|
+
|
|
27694
|
+
#### \u5236\u7D04
|
|
27695
|
+
- **\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
|
|
27696
|
+
- \u30C4\u30FC\u30EB\u9593\u306F1\u6587\u3060\u3051\u66F8\u3044\u3066\u5373\u6B21\u306E\u30C4\u30FC\u30EB\u547C\u3073\u51FA\u3057`,
|
|
27697
|
+
en: `Follow these steps to set up the Power BI OAuth connection.
|
|
27698
|
+
|
|
27699
|
+
1. Call \`${requestToolName13}\` with \`method: "GET"\` and \`path: "/groups"\` to list the workspaces the user has access to
|
|
27700
|
+
2. If an error is returned, ask the user to verify that OAuth authentication completed correctly
|
|
27701
|
+
|
|
27702
|
+
#### Constraints
|
|
27703
|
+
- **Do NOT execute DAX queries or refresh datasets during setup**. Only the workspace listing above is allowed
|
|
27704
|
+
- Write only 1 sentence between tool calls, then immediately call the next tool`
|
|
27705
|
+
},
|
|
27706
|
+
dataOverviewInstructions: {
|
|
27707
|
+
en: `1. Call powerbi-oauth_request with GET /groups to list accessible workspaces
|
|
27708
|
+
2. For a target workspace, call powerbi-oauth_request with GET /groups/{groupId}/datasets to list datasets
|
|
27709
|
+
3. Call powerbi-oauth_request with GET /groups/{groupId}/reports to list reports
|
|
27710
|
+
4. For each interesting dataset call powerbi-oauth_request with GET /groups/{groupId}/datasets/{datasetId}/tables to inspect tables`,
|
|
27711
|
+
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
|
|
27712
|
+
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
|
|
27713
|
+
3. powerbi-oauth_request \u3067 GET /groups/{groupId}/reports \u3092\u547C\u3073\u51FA\u3057\u3001\u30EC\u30DD\u30FC\u30C8\u4E00\u89A7\u3092\u53D6\u5F97
|
|
27714
|
+
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`
|
|
27715
|
+
}
|
|
27716
|
+
});
|
|
27717
|
+
|
|
27718
|
+
// ../connectors/src/connectors/powerbi-oauth/parameters.ts
|
|
27719
|
+
var parameters80 = {};
|
|
27720
|
+
|
|
27721
|
+
// ../connectors/src/connectors/powerbi-oauth/index.ts
|
|
27722
|
+
var tools80 = { request: requestTool56 };
|
|
27723
|
+
var powerbiOauthConnector = new ConnectorPlugin({
|
|
27724
|
+
slug: "powerbi",
|
|
27725
|
+
authType: AUTH_TYPES.OAUTH,
|
|
27726
|
+
name: "Power BI",
|
|
27727
|
+
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.",
|
|
27728
|
+
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/2vXQCKGpMJ9kGSaqkZl9IS/cc5669c267fc5d11e7b1f8c01723e461/power-bi-icon.png",
|
|
27729
|
+
parameters: parameters80,
|
|
27730
|
+
releaseFlag: { dev1: true, dev2: false, prod: false },
|
|
27731
|
+
categories: ["bi"],
|
|
27732
|
+
onboarding: powerbiOauthOnboarding,
|
|
27733
|
+
proxyPolicy: {
|
|
27734
|
+
allowlist: [
|
|
27735
|
+
{
|
|
27736
|
+
host: "api.powerbi.com",
|
|
27737
|
+
methods: ["GET", "POST", "PATCH", "PUT", "DELETE"]
|
|
27738
|
+
}
|
|
27739
|
+
]
|
|
27740
|
+
},
|
|
27741
|
+
systemPrompt: {
|
|
27742
|
+
en: `### Tools
|
|
27743
|
+
|
|
27744
|
+
- \`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).
|
|
27745
|
+
|
|
27746
|
+
### Business Logic
|
|
27747
|
+
|
|
27748
|
+
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.
|
|
27749
|
+
|
|
27750
|
+
SDK surface (client created via \`connection(connectionId)\`):
|
|
27751
|
+
- \`client.request(path, init?)\` \u2014 low-level authenticated fetch (path appended to \`https://api.powerbi.com/v1.0/myorg\`)
|
|
27752
|
+
- \`client.listGroups(options?)\` \u2014 list workspaces (\`$top\`, \`$skip\`, \`$filter\`)
|
|
27753
|
+
- \`client.listDatasets(groupId)\` / \`client.listReports(groupId)\` \u2014 list datasets / reports in a workspace
|
|
27754
|
+
- \`client.getDataset(groupId, datasetId)\` \u2014 fetch a single dataset
|
|
27755
|
+
- \`client.executeQueries(groupId, datasetId, queries, options?)\` \u2014 run DAX queries
|
|
27756
|
+
- \`client.refreshDataset(groupId, datasetId, options?)\` \u2014 trigger an async refresh
|
|
27757
|
+
|
|
27758
|
+
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.
|
|
27759
|
+
|
|
27760
|
+
\`\`\`ts
|
|
27761
|
+
import type { Context } from "hono";
|
|
27762
|
+
import { connection } from "@squadbase/vite-server/connectors/powerbi-oauth";
|
|
27763
|
+
|
|
27764
|
+
const powerbi = connection("<connectionId>");
|
|
27765
|
+
|
|
27766
|
+
export default async function handler(c: Context) {
|
|
27767
|
+
const { groupId, datasetId, dax } = await c.req.json<{
|
|
27768
|
+
groupId: string;
|
|
27769
|
+
datasetId: string;
|
|
27770
|
+
dax: string;
|
|
27771
|
+
}>();
|
|
27772
|
+
|
|
27773
|
+
const result = await powerbi.executeQueries(groupId, datasetId, [dax]);
|
|
27774
|
+
const rows = result.results[0]?.tables[0]?.rows ?? [];
|
|
27775
|
+
return c.json({ rows });
|
|
27776
|
+
}
|
|
27777
|
+
\`\`\`
|
|
27778
|
+
|
|
27779
|
+
### Power BI REST API Reference
|
|
27780
|
+
|
|
27781
|
+
- Base URL: \`https://api.powerbi.com/v1.0/myorg\`
|
|
27782
|
+
- Authentication: Microsoft Entra OAuth (delegated; handled automatically)
|
|
27783
|
+
- Unlike Service Principals, OAuth users can also access "My workspace" via the \`/datasets\` (without \`/groups/\`) endpoints
|
|
27784
|
+
|
|
27785
|
+
#### Common Endpoints
|
|
27786
|
+
- GET \`/groups\` \u2014 List workspaces the signed-in user has access to
|
|
27787
|
+
- GET \`/groups/{groupId}/datasets\` \u2014 List datasets in a workspace
|
|
27788
|
+
- GET \`/groups/{groupId}/datasets/{datasetId}\` \u2014 Get dataset metadata
|
|
27789
|
+
- GET \`/groups/{groupId}/reports\` \u2014 List reports
|
|
27790
|
+
- POST \`/groups/{groupId}/datasets/{datasetId}/executeQueries\` \u2014 Run DAX (body: \`{ queries: [{ query: "EVALUATE ..." }], serializerSettings: { includeNulls: true } }\`)
|
|
27791
|
+
- POST \`/groups/{groupId}/datasets/{datasetId}/refreshes\` \u2014 Trigger a dataset refresh
|
|
27792
|
+
- GET \`/groups/{groupId}/datasets/{datasetId}/refreshes\` \u2014 List recent refresh history
|
|
27793
|
+
|
|
27794
|
+
#### DAX Tips
|
|
27795
|
+
- \`EVALUATE TOPN(10, 'TableName')\` \u2014 sample 10 rows from a table
|
|
27796
|
+
- \`EVALUATE SUMMARIZECOLUMNS('Date'[Year], "Sales", SUM('Sales'[Amount]))\` \u2014 aggregate
|
|
27797
|
+
- Each \`executeQueries\` call accepts one query in the \`queries\` array (per current Power BI API limits)`,
|
|
27798
|
+
ja: `### \u30C4\u30FC\u30EB
|
|
27799
|
+
|
|
27800
|
+
- \`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
|
|
27801
|
+
|
|
27802
|
+
### Business Logic
|
|
27803
|
+
|
|
27804
|
+
\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
|
|
27805
|
+
|
|
27806
|
+
SDK (\`connection(connectionId)\` \u3067\u4F5C\u6210\u3057\u305F\u30AF\u30E9\u30A4\u30A2\u30F3\u30C8):
|
|
27807
|
+
- \`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)
|
|
27808
|
+
- \`client.listGroups(options?)\` \u2014 \u30EF\u30FC\u30AF\u30B9\u30DA\u30FC\u30B9\u4E00\u89A7 (\`$top\`, \`$skip\`, \`$filter\`)
|
|
27809
|
+
- \`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
|
|
27810
|
+
- \`client.getDataset(groupId, datasetId)\` \u2014 \u30C7\u30FC\u30BF\u30BB\u30C3\u30C8\u5358\u4F53\u53D6\u5F97
|
|
27811
|
+
- \`client.executeQueries(groupId, datasetId, queries, options?)\` \u2014 DAX \u30AF\u30A8\u30EA\u5B9F\u884C
|
|
27812
|
+
- \`client.refreshDataset(groupId, datasetId, options?)\` \u2014 \u30C7\u30FC\u30BF\u30BB\u30C3\u30C8\u66F4\u65B0\u3092\u975E\u540C\u671F\u30C8\u30EA\u30AC\u30FC
|
|
27813
|
+
|
|
27814
|
+
\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
|
|
27815
|
+
|
|
27816
|
+
\`\`\`ts
|
|
27817
|
+
import type { Context } from "hono";
|
|
27818
|
+
import { connection } from "@squadbase/vite-server/connectors/powerbi-oauth";
|
|
27819
|
+
|
|
27820
|
+
const powerbi = connection("<connectionId>");
|
|
27821
|
+
|
|
27822
|
+
export default async function handler(c: Context) {
|
|
27823
|
+
const { groupId, datasetId, dax } = await c.req.json<{
|
|
27824
|
+
groupId: string;
|
|
27825
|
+
datasetId: string;
|
|
27826
|
+
dax: string;
|
|
27827
|
+
}>();
|
|
27828
|
+
|
|
27829
|
+
const result = await powerbi.executeQueries(groupId, datasetId, [dax]);
|
|
27830
|
+
const rows = result.results[0]?.tables[0]?.rows ?? [];
|
|
27831
|
+
return c.json({ rows });
|
|
27832
|
+
}
|
|
27833
|
+
\`\`\`
|
|
27834
|
+
|
|
27835
|
+
### Power BI REST API \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9
|
|
27836
|
+
|
|
27837
|
+
- \u30D9\u30FC\u30B9 URL: \`https://api.powerbi.com/v1.0/myorg\`
|
|
27838
|
+
- \u8A8D\u8A3C: Microsoft Entra OAuth (\u59D4\u4EFB\u578B\u3001\u81EA\u52D5\u8A2D\u5B9A)
|
|
27839
|
+
- 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
|
|
27840
|
+
|
|
27841
|
+
#### \u4E3B\u8981\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8
|
|
27842
|
+
- GET \`/groups\` \u2014 \u30E6\u30FC\u30B6\u30FC\u304C\u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u306A\u30EF\u30FC\u30AF\u30B9\u30DA\u30FC\u30B9\u4E00\u89A7
|
|
27843
|
+
- GET \`/groups/{groupId}/datasets\` \u2014 \u30EF\u30FC\u30AF\u30B9\u30DA\u30FC\u30B9\u5185\u306E\u30C7\u30FC\u30BF\u30BB\u30C3\u30C8\u4E00\u89A7
|
|
27844
|
+
- GET \`/groups/{groupId}/datasets/{datasetId}\` \u2014 \u30C7\u30FC\u30BF\u30BB\u30C3\u30C8 \u30E1\u30BF\u30C7\u30FC\u30BF
|
|
27845
|
+
- GET \`/groups/{groupId}/reports\` \u2014 \u30EC\u30DD\u30FC\u30C8\u4E00\u89A7
|
|
27846
|
+
- POST \`/groups/{groupId}/datasets/{datasetId}/executeQueries\` \u2014 DAX \u5B9F\u884C (body: \`{ queries: [{ query: "EVALUATE ..." }], serializerSettings: { includeNulls: true } }\`)
|
|
27847
|
+
- POST \`/groups/{groupId}/datasets/{datasetId}/refreshes\` \u2014 \u30C7\u30FC\u30BF\u30BB\u30C3\u30C8\u66F4\u65B0\u30C8\u30EA\u30AC\u30FC
|
|
27848
|
+
- GET \`/groups/{groupId}/datasets/{datasetId}/refreshes\` \u2014 \u76F4\u8FD1\u306E\u66F4\u65B0\u5C65\u6B74
|
|
27849
|
+
|
|
27850
|
+
#### DAX Tips
|
|
27851
|
+
- \`EVALUATE TOPN(10, 'TableName')\` \u2014 \u30C6\u30FC\u30D6\u30EB\u304B\u3089 10 \u884C\u30B5\u30F3\u30D7\u30EA\u30F3\u30B0
|
|
27852
|
+
- \`EVALUATE SUMMARIZECOLUMNS('Date'[Year], "Sales", SUM('Sales'[Amount]))\` \u2014 \u96C6\u8A08
|
|
27853
|
+
- \`executeQueries\` \u306F\u73FE\u72B6 1 \u30EA\u30AF\u30A8\u30B9\u30C8\u306B\u3064\u304D 1 \u30AF\u30A8\u30EA\u306E\u307F`
|
|
27854
|
+
},
|
|
27855
|
+
tools: tools80,
|
|
27856
|
+
async checkConnection(_params, config) {
|
|
27857
|
+
const { proxyFetch } = config;
|
|
27858
|
+
const url = "https://api.powerbi.com/v1.0/myorg/groups?$top=1";
|
|
27859
|
+
try {
|
|
27860
|
+
const res = await proxyFetch(url, { method: "GET" });
|
|
27861
|
+
if (!res.ok) {
|
|
27862
|
+
const errorText = await res.text().catch(() => res.statusText);
|
|
27863
|
+
return {
|
|
27864
|
+
success: false,
|
|
27865
|
+
error: `Power BI API failed: HTTP ${res.status} ${errorText}`
|
|
27866
|
+
};
|
|
27867
|
+
}
|
|
27868
|
+
return { success: true };
|
|
27869
|
+
} catch (error) {
|
|
27870
|
+
return {
|
|
27871
|
+
success: false,
|
|
27872
|
+
error: error instanceof Error ? error.message : String(error)
|
|
27873
|
+
};
|
|
27874
|
+
}
|
|
27875
|
+
}
|
|
27876
|
+
});
|
|
27877
|
+
|
|
27878
|
+
// ../connectors/src/connectors/tableau/setup.ts
|
|
27879
|
+
var tableauOnboarding = new ConnectorOnboarding({
|
|
27880
|
+
connectionSetupInstructions: {
|
|
27881
|
+
en: `Follow these steps to verify the Tableau PAT connection.
|
|
27882
|
+
|
|
27883
|
+
1. Call \`tableau_request\` with \`method: "GET"\` and \`path: "/sites/{siteId}/projects?pageSize=5"\` to list a few projects on the signed-in site
|
|
27884
|
+
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)
|
|
27885
|
+
|
|
27886
|
+
#### Constraints
|
|
27887
|
+
- **Do NOT mutate Tableau resources during setup** (no publish/update/delete). Only the project listing above is allowed
|
|
27888
|
+
- The literal placeholder \`{siteId}\` in the path is automatically replaced with the session's site ID \u2014 do NOT hardcode the ID`,
|
|
27889
|
+
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
|
|
27890
|
+
|
|
27891
|
+
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
|
|
27892
|
+
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
|
|
27893
|
+
|
|
27894
|
+
#### \u5236\u7D04
|
|
27895
|
+
- **\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
|
|
27896
|
+
- \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`
|
|
27897
|
+
},
|
|
27898
|
+
dataOverviewInstructions: {
|
|
27899
|
+
en: `1. Call tableau_request with GET /sites/{siteId}/projects to list projects
|
|
27900
|
+
2. Call tableau_request with GET /sites/{siteId}/workbooks?pageSize=20 to list workbooks
|
|
27901
|
+
3. For a target workbook, call tableau_request with GET /sites/{siteId}/workbooks/{workbookId}/views to list its views
|
|
27902
|
+
4. Call tableau_request with GET /sites/{siteId}/datasources?pageSize=20 to list published data sources`,
|
|
27903
|
+
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
|
|
27904
|
+
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
|
|
27905
|
+
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
|
|
27906
|
+
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`
|
|
27907
|
+
}
|
|
27908
|
+
});
|
|
27909
|
+
|
|
27910
|
+
// ../connectors/src/connectors/tableau/parameters.ts
|
|
27911
|
+
var parameters81 = {
|
|
27912
|
+
serverUrl: new ParameterDefinition({
|
|
27913
|
+
slug: "server-url",
|
|
27914
|
+
name: "Tableau Server URL",
|
|
27915
|
+
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.",
|
|
27916
|
+
envVarBaseKey: "TABLEAU_SERVER_URL",
|
|
27917
|
+
type: "text",
|
|
27918
|
+
secret: false,
|
|
27919
|
+
required: true
|
|
27920
|
+
}),
|
|
27921
|
+
siteContentUrl: new ParameterDefinition({
|
|
27922
|
+
slug: "site-content-url",
|
|
27923
|
+
name: "Site Content URL",
|
|
27924
|
+
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.",
|
|
27925
|
+
envVarBaseKey: "TABLEAU_SITE_CONTENT_URL",
|
|
27926
|
+
type: "text",
|
|
27927
|
+
secret: false,
|
|
27928
|
+
required: true
|
|
27929
|
+
}),
|
|
27930
|
+
patName: new ParameterDefinition({
|
|
27931
|
+
slug: "pat-name",
|
|
27932
|
+
name: "Personal Access Token Name",
|
|
27933
|
+
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.",
|
|
27934
|
+
envVarBaseKey: "TABLEAU_PAT_NAME",
|
|
27935
|
+
type: "text",
|
|
27936
|
+
secret: false,
|
|
27937
|
+
required: true
|
|
27938
|
+
}),
|
|
27939
|
+
patSecret: new ParameterDefinition({
|
|
27940
|
+
slug: "pat-secret",
|
|
27941
|
+
name: "Personal Access Token Secret",
|
|
27942
|
+
description: "Secret value shown once when the PAT is created. Tokens expire after 15 days of inactivity (default) and must be rotated regularly.",
|
|
27943
|
+
envVarBaseKey: "TABLEAU_PAT_SECRET",
|
|
27944
|
+
type: "text",
|
|
27945
|
+
secret: true,
|
|
27946
|
+
required: true
|
|
27947
|
+
}),
|
|
27948
|
+
apiVersion: new ParameterDefinition({
|
|
27949
|
+
slug: "api-version",
|
|
27950
|
+
name: "REST API Version",
|
|
27951
|
+
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.",
|
|
27952
|
+
envVarBaseKey: "TABLEAU_API_VERSION",
|
|
27953
|
+
type: "text",
|
|
27954
|
+
secret: false,
|
|
27955
|
+
required: false
|
|
27956
|
+
})
|
|
27957
|
+
};
|
|
27958
|
+
|
|
27959
|
+
// ../connectors/src/connectors/tableau/tools/request.ts
|
|
27960
|
+
import { z as z98 } from "zod";
|
|
27961
|
+
var DEFAULT_API_VERSION = "3.28";
|
|
27962
|
+
var REQUEST_TIMEOUT_MS75 = 6e4;
|
|
27963
|
+
var sessionCache = /* @__PURE__ */ new Map();
|
|
27964
|
+
function buildBaseUrl4(serverUrl, apiVersion) {
|
|
27965
|
+
return `${serverUrl.replace(/\/$/, "")}/api/${apiVersion}`;
|
|
27966
|
+
}
|
|
27967
|
+
async function signIn(serverUrl, apiVersion, siteContentUrl, patName, patSecret) {
|
|
27968
|
+
const url = `${buildBaseUrl4(serverUrl, apiVersion)}/auth/signin`;
|
|
27969
|
+
const body = {
|
|
27970
|
+
credentials: {
|
|
27971
|
+
personalAccessTokenName: patName,
|
|
27972
|
+
personalAccessTokenSecret: patSecret,
|
|
27973
|
+
site: { contentUrl: siteContentUrl }
|
|
27974
|
+
}
|
|
27975
|
+
};
|
|
27976
|
+
const res = await fetch(url, {
|
|
27977
|
+
method: "POST",
|
|
27978
|
+
headers: {
|
|
27979
|
+
"Content-Type": "application/json",
|
|
27980
|
+
Accept: "application/json"
|
|
27981
|
+
},
|
|
27982
|
+
body: JSON.stringify(body)
|
|
27983
|
+
});
|
|
27984
|
+
if (!res.ok) {
|
|
27985
|
+
const errorText = await res.text().catch(() => res.statusText);
|
|
27986
|
+
throw new Error(
|
|
27987
|
+
`Tableau sign-in failed: HTTP ${res.status} ${errorText}`
|
|
27988
|
+
);
|
|
27989
|
+
}
|
|
27990
|
+
const data = await res.json();
|
|
27991
|
+
return {
|
|
27992
|
+
authToken: data.credentials.token,
|
|
27993
|
+
siteId: data.credentials.site.id,
|
|
27994
|
+
userId: data.credentials.user.id,
|
|
27995
|
+
expiresAt: Date.now() + 30 * 60 * 1e3
|
|
27996
|
+
};
|
|
27997
|
+
}
|
|
27998
|
+
async function getSession(serverUrl, apiVersion, siteContentUrl, patName, patSecret) {
|
|
27999
|
+
const cacheKey = `${serverUrl}|${siteContentUrl}|${patName}`;
|
|
28000
|
+
const cached = sessionCache.get(cacheKey);
|
|
28001
|
+
if (cached && cached.expiresAt > Date.now() + 6e4) {
|
|
28002
|
+
return cached;
|
|
28003
|
+
}
|
|
28004
|
+
const session = await signIn(
|
|
28005
|
+
serverUrl,
|
|
28006
|
+
apiVersion,
|
|
28007
|
+
siteContentUrl,
|
|
28008
|
+
patName,
|
|
28009
|
+
patSecret
|
|
28010
|
+
);
|
|
28011
|
+
sessionCache.set(cacheKey, session);
|
|
28012
|
+
return session;
|
|
28013
|
+
}
|
|
28014
|
+
var inputSchema98 = z98.object({
|
|
28015
|
+
toolUseIntent: z98.string().optional().describe(
|
|
28016
|
+
"Brief description of what you intend to accomplish with this tool call"
|
|
28017
|
+
),
|
|
28018
|
+
connectionId: z98.string().describe("ID of the Tableau connection to use"),
|
|
28019
|
+
method: z98.enum(["GET", "POST", "PUT", "DELETE"]).describe(
|
|
28020
|
+
"HTTP method. GET for listing/reading, POST for creating, PUT for updates, DELETE for removal."
|
|
28021
|
+
),
|
|
28022
|
+
path: z98.string().describe(
|
|
28023
|
+
"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."
|
|
28024
|
+
),
|
|
28025
|
+
queryParams: z98.record(z98.string(), z98.string()).optional().describe(
|
|
28026
|
+
"Query parameters to append (e.g., { pageSize: '100', filter: 'name:eq:Sales' }). Tableau supports field filtering via 'fields' and sorting via 'sort'."
|
|
28027
|
+
),
|
|
28028
|
+
body: z98.record(z98.string(), z98.unknown()).optional().describe(
|
|
28029
|
+
"JSON request body for POST/PUT (Tableau also accepts XML, but JSON is recommended with Accept: application/json)."
|
|
28030
|
+
)
|
|
28031
|
+
});
|
|
28032
|
+
var outputSchema98 = z98.discriminatedUnion("success", [
|
|
28033
|
+
z98.object({
|
|
28034
|
+
success: z98.literal(true),
|
|
28035
|
+
status: z98.number(),
|
|
28036
|
+
data: z98.unknown()
|
|
28037
|
+
}),
|
|
28038
|
+
z98.object({
|
|
28039
|
+
success: z98.literal(false),
|
|
28040
|
+
error: z98.string()
|
|
28041
|
+
})
|
|
28042
|
+
]);
|
|
28043
|
+
var requestTool57 = new ConnectorTool({
|
|
28044
|
+
name: "request",
|
|
28045
|
+
description: `Send authenticated requests to the Tableau REST API.
|
|
28046
|
+
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.
|
|
28047
|
+
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.
|
|
28048
|
+
Accept and Content-Type headers default to application/json so list responses come back as JSON instead of Tableau's default XML.`,
|
|
28049
|
+
inputSchema: inputSchema98,
|
|
28050
|
+
outputSchema: outputSchema98,
|
|
28051
|
+
async execute({ connectionId, method, path: path5, queryParams, body }, connections) {
|
|
28052
|
+
const connection2 = connections.find((c) => c.id === connectionId);
|
|
28053
|
+
if (!connection2) {
|
|
28054
|
+
return {
|
|
28055
|
+
success: false,
|
|
28056
|
+
error: `Connection ${connectionId} not found`
|
|
28057
|
+
};
|
|
28058
|
+
}
|
|
28059
|
+
console.log(
|
|
28060
|
+
`[connector-request] tableau/${connection2.name}: ${method} ${path5}`
|
|
28061
|
+
);
|
|
28062
|
+
try {
|
|
28063
|
+
const serverUrl = parameters81.serverUrl.getValue(connection2);
|
|
28064
|
+
const siteContentUrl = parameters81.siteContentUrl.getValue(connection2);
|
|
28065
|
+
const patName = parameters81.patName.getValue(connection2);
|
|
28066
|
+
const patSecret = parameters81.patSecret.getValue(connection2);
|
|
28067
|
+
const apiVersion = parameters81.apiVersion.tryGetValue(connection2) || DEFAULT_API_VERSION;
|
|
28068
|
+
const session = await getSession(
|
|
28069
|
+
serverUrl,
|
|
28070
|
+
apiVersion,
|
|
28071
|
+
siteContentUrl,
|
|
28072
|
+
patName,
|
|
28073
|
+
patSecret
|
|
28074
|
+
);
|
|
28075
|
+
const resolvedPath = path5.trim().replace(/\{siteId\}/g, session.siteId).replace(/^([^/])/, "/$1");
|
|
28076
|
+
let url = `${buildBaseUrl4(serverUrl, apiVersion)}${resolvedPath}`;
|
|
28077
|
+
if (queryParams) {
|
|
28078
|
+
const searchParams = new URLSearchParams(queryParams);
|
|
28079
|
+
url += `?${searchParams.toString()}`;
|
|
28080
|
+
}
|
|
28081
|
+
const controller = new AbortController();
|
|
28082
|
+
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS75);
|
|
28083
|
+
try {
|
|
28084
|
+
const init = {
|
|
28085
|
+
method,
|
|
28086
|
+
headers: {
|
|
28087
|
+
"X-Tableau-Auth": session.authToken,
|
|
28088
|
+
Accept: "application/json",
|
|
28089
|
+
"Content-Type": "application/json"
|
|
28090
|
+
},
|
|
28091
|
+
signal: controller.signal
|
|
28092
|
+
};
|
|
28093
|
+
if (body !== void 0) {
|
|
28094
|
+
init.body = JSON.stringify(body);
|
|
28095
|
+
}
|
|
28096
|
+
const response = await fetch(url, init);
|
|
28097
|
+
const text = await response.text();
|
|
28098
|
+
const data = text ? (() => {
|
|
28099
|
+
try {
|
|
28100
|
+
return JSON.parse(text);
|
|
28101
|
+
} catch {
|
|
28102
|
+
return text;
|
|
28103
|
+
}
|
|
28104
|
+
})() : null;
|
|
28105
|
+
if (!response.ok) {
|
|
28106
|
+
const errorMessage = data && typeof data === "object" && "error" in data ? JSON.stringify(data.error) : typeof data === "string" && data ? data : `HTTP ${response.status} ${response.statusText}`;
|
|
28107
|
+
return { success: false, error: errorMessage };
|
|
28108
|
+
}
|
|
28109
|
+
return { success: true, status: response.status, data };
|
|
28110
|
+
} finally {
|
|
28111
|
+
clearTimeout(timeout);
|
|
28112
|
+
}
|
|
28113
|
+
} catch (err) {
|
|
28114
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
28115
|
+
return { success: false, error: msg };
|
|
28116
|
+
}
|
|
28117
|
+
}
|
|
28118
|
+
});
|
|
28119
|
+
|
|
28120
|
+
// ../connectors/src/connectors/tableau/index.ts
|
|
28121
|
+
var tools81 = { request: requestTool57 };
|
|
28122
|
+
var tableauConnector = new ConnectorPlugin({
|
|
28123
|
+
slug: "tableau",
|
|
28124
|
+
authType: AUTH_TYPES.PAT,
|
|
28125
|
+
name: "Tableau",
|
|
28126
|
+
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.",
|
|
28127
|
+
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/3ejrZvfw7zCDa3FPbUNQx9/d810e117b3a86c45dd96205453bf67a0/tableau-icon.svg",
|
|
28128
|
+
parameters: parameters81,
|
|
28129
|
+
releaseFlag: { dev1: true, dev2: false, prod: false },
|
|
28130
|
+
categories: ["bi"],
|
|
28131
|
+
onboarding: tableauOnboarding,
|
|
28132
|
+
systemPrompt: {
|
|
28133
|
+
en: `### Tools
|
|
28134
|
+
|
|
28135
|
+
- \`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.
|
|
28136
|
+
|
|
28137
|
+
### Business Logic
|
|
28138
|
+
|
|
28139
|
+
The business logic type for this connector is "typescript". Use the connector SDK in your handler. Do NOT read credentials from environment variables.
|
|
28140
|
+
|
|
28141
|
+
SDK methods (client created via \`connection(connectionId)\`):
|
|
28142
|
+
- \`client.request(path, init?)\` \u2014 low-level authenticated fetch (path is appended to \`{serverUrl}/api/{apiVersion}\`; \`{siteId}\` is substituted)
|
|
28143
|
+
- \`client.getSession()\` \u2014 sign in (if needed) and return \`{ authToken, siteId, userId }\`
|
|
28144
|
+
- \`client.listProjects(options?)\` / \`client.listWorkbooks(options?)\` / \`client.listDatasources(options?)\`
|
|
28145
|
+
- \`client.listViewsForWorkbook(workbookId)\`
|
|
28146
|
+
- \`client.getViewData(viewId)\` \u2014 returns the view's underlying data as CSV text
|
|
28147
|
+
|
|
28148
|
+
\`\`\`ts
|
|
28149
|
+
import type { Context } from "hono";
|
|
28150
|
+
import { connection } from "@squadbase/vite-server/connectors/tableau";
|
|
28151
|
+
|
|
28152
|
+
const tableau = connection("<connectionId>");
|
|
28153
|
+
|
|
28154
|
+
export default async function handler(c: Context) {
|
|
28155
|
+
const { pageSize = 20 } = await c.req.json<{ pageSize?: number }>();
|
|
28156
|
+
const { workbooks, pagination } = await tableau.listWorkbooks({ pageSize });
|
|
28157
|
+
return c.json({
|
|
28158
|
+
workbooks: workbooks.workbook,
|
|
28159
|
+
totalAvailable: Number(pagination.totalAvailable),
|
|
28160
|
+
});
|
|
28161
|
+
}
|
|
28162
|
+
\`\`\`
|
|
28163
|
+
|
|
28164
|
+
### Tableau REST API Reference
|
|
28165
|
+
|
|
28166
|
+
- 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)
|
|
28167
|
+
- 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
|
|
28168
|
+
- Response format: JSON when \`Accept: application/json\` is sent (default); otherwise Tableau returns XML
|
|
28169
|
+
- Pagination: \`?pageSize=&pageNumber=\` query params with \`pagination\` object in response
|
|
28170
|
+
|
|
28171
|
+
#### Common Endpoints
|
|
28172
|
+
- POST \`/auth/signin\` \u2014 sign in (handled automatically)
|
|
28173
|
+
- POST \`/auth/signout\` \u2014 sign out
|
|
28174
|
+
- GET \`/sites/{siteId}/projects\` \u2014 list projects
|
|
28175
|
+
- GET \`/sites/{siteId}/workbooks\` \u2014 list workbooks (supports \`filter\`, \`sort\`)
|
|
28176
|
+
- GET \`/sites/{siteId}/workbooks/{workbookId}\` \u2014 get a workbook
|
|
28177
|
+
- GET \`/sites/{siteId}/workbooks/{workbookId}/views\` \u2014 list views in a workbook
|
|
28178
|
+
- GET \`/sites/{siteId}/views/{viewId}/data\` \u2014 get view data as CSV
|
|
28179
|
+
- GET \`/sites/{siteId}/views/{viewId}/image\` \u2014 get view as PNG
|
|
28180
|
+
- GET \`/sites/{siteId}/views/{viewId}/pdf\` \u2014 get view as PDF
|
|
28181
|
+
- GET \`/sites/{siteId}/datasources\` \u2014 list published data sources
|
|
28182
|
+
- GET \`/sites/{siteId}/users\` \u2014 list users
|
|
28183
|
+
- GET \`/sites/{siteId}/groups\` \u2014 list groups
|
|
28184
|
+
|
|
28185
|
+
#### Filter Syntax
|
|
28186
|
+
- \`filter=name:eq:Sales\` \u2014 exact match
|
|
28187
|
+
- \`filter=name:in:[Sales,Marketing]\` \u2014 set membership
|
|
28188
|
+
- \`filter=updatedAt:gte:2024-01-01T00:00:00Z\` \u2014 comparison operators (gt/gte/lt/lte)
|
|
28189
|
+
- Combine: \`filter=ownerName:eq:alice,tags:in:[finance]\``,
|
|
28190
|
+
ja: `### \u30C4\u30FC\u30EB
|
|
28191
|
+
|
|
28192
|
+
- \`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
|
|
28193
|
+
|
|
28194
|
+
### Business Logic
|
|
28195
|
+
|
|
28196
|
+
\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
|
|
28197
|
+
|
|
28198
|
+
SDK \u30E1\u30BD\u30C3\u30C9 (\`connection(connectionId)\` \u3067\u4F5C\u6210\u3057\u305F\u30AF\u30E9\u30A4\u30A2\u30F3\u30C8):
|
|
28199
|
+
- \`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)
|
|
28200
|
+
- \`client.getSession()\` \u2014 \u30B5\u30A4\u30F3\u30A4\u30F3 (\u5FC5\u8981\u306A\u3089) \u3057\u3066 \`{ authToken, siteId, userId }\` \u3092\u8FD4\u3059
|
|
28201
|
+
- \`client.listProjects(options?)\` / \`client.listWorkbooks(options?)\` / \`client.listDatasources(options?)\`
|
|
28202
|
+
- \`client.listViewsForWorkbook(workbookId)\`
|
|
28203
|
+
- \`client.getViewData(viewId)\` \u2014 \u30D3\u30E5\u30FC\u306E\u30C7\u30FC\u30BF\u3092 CSV \u30C6\u30AD\u30B9\u30C8\u3067\u8FD4\u3059
|
|
28204
|
+
|
|
28205
|
+
\`\`\`ts
|
|
28206
|
+
import type { Context } from "hono";
|
|
28207
|
+
import { connection } from "@squadbase/vite-server/connectors/tableau";
|
|
28208
|
+
|
|
28209
|
+
const tableau = connection("<connectionId>");
|
|
28210
|
+
|
|
28211
|
+
export default async function handler(c: Context) {
|
|
28212
|
+
const { pageSize = 20 } = await c.req.json<{ pageSize?: number }>();
|
|
28213
|
+
const { workbooks, pagination } = await tableau.listWorkbooks({ pageSize });
|
|
28214
|
+
return c.json({
|
|
28215
|
+
workbooks: workbooks.workbook,
|
|
28216
|
+
totalAvailable: Number(pagination.totalAvailable),
|
|
28217
|
+
});
|
|
28218
|
+
}
|
|
28219
|
+
\`\`\`
|
|
28220
|
+
|
|
28221
|
+
### Tableau REST API \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9
|
|
28222
|
+
|
|
28223
|
+
- \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)
|
|
28224
|
+
- \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
|
|
28225
|
+
- \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
|
|
28226
|
+
- \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
|
|
28227
|
+
|
|
28228
|
+
#### \u4E3B\u8981\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8
|
|
28229
|
+
- POST \`/auth/signin\` \u2014 \u30B5\u30A4\u30F3\u30A4\u30F3 (\u81EA\u52D5\u51E6\u7406)
|
|
28230
|
+
- POST \`/auth/signout\` \u2014 \u30B5\u30A4\u30F3\u30A2\u30A6\u30C8
|
|
28231
|
+
- GET \`/sites/{siteId}/projects\` \u2014 \u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u4E00\u89A7
|
|
28232
|
+
- GET \`/sites/{siteId}/workbooks\` \u2014 \u30EF\u30FC\u30AF\u30D6\u30C3\u30AF\u4E00\u89A7 (\`filter\`, \`sort\` \u5BFE\u5FDC)
|
|
28233
|
+
- GET \`/sites/{siteId}/workbooks/{workbookId}\` \u2014 \u30EF\u30FC\u30AF\u30D6\u30C3\u30AF\u53D6\u5F97
|
|
28234
|
+
- GET \`/sites/{siteId}/workbooks/{workbookId}/views\` \u2014 \u30EF\u30FC\u30AF\u30D6\u30C3\u30AF\u5185\u306E\u30D3\u30E5\u30FC\u4E00\u89A7
|
|
28235
|
+
- GET \`/sites/{siteId}/views/{viewId}/data\` \u2014 \u30D3\u30E5\u30FC\u30C7\u30FC\u30BF\u3092 CSV \u3067\u53D6\u5F97
|
|
28236
|
+
- GET \`/sites/{siteId}/views/{viewId}/image\` \u2014 \u30D3\u30E5\u30FC\u3092 PNG \u3067\u53D6\u5F97
|
|
28237
|
+
- GET \`/sites/{siteId}/views/{viewId}/pdf\` \u2014 \u30D3\u30E5\u30FC\u3092 PDF \u3067\u53D6\u5F97
|
|
28238
|
+
- GET \`/sites/{siteId}/datasources\` \u2014 \u516C\u958B\u30C7\u30FC\u30BF\u30BD\u30FC\u30B9\u4E00\u89A7
|
|
28239
|
+
- GET \`/sites/{siteId}/users\` \u2014 \u30E6\u30FC\u30B6\u30FC\u4E00\u89A7
|
|
28240
|
+
- GET \`/sites/{siteId}/groups\` \u2014 \u30B0\u30EB\u30FC\u30D7\u4E00\u89A7
|
|
28241
|
+
|
|
28242
|
+
#### \u30D5\u30A3\u30EB\u30BF\u69CB\u6587
|
|
28243
|
+
- \`filter=name:eq:Sales\` \u2014 \u5B8C\u5168\u4E00\u81F4
|
|
28244
|
+
- \`filter=name:in:[Sales,Marketing]\` \u2014 \u96C6\u5408\u306B\u542B\u307E\u308C\u308B
|
|
28245
|
+
- \`filter=updatedAt:gte:2024-01-01T00:00:00Z\` \u2014 \u6BD4\u8F03\u6F14\u7B97\u5B50 (gt/gte/lt/lte)
|
|
28246
|
+
- \u7D44\u307F\u5408\u308F\u305B: \`filter=ownerName:eq:alice,tags:in:[finance]\``
|
|
28247
|
+
},
|
|
28248
|
+
tools: tools81,
|
|
28249
|
+
async checkConnection(params) {
|
|
28250
|
+
const serverUrl = params[parameters81.serverUrl.slug];
|
|
28251
|
+
const siteContentUrl = params[parameters81.siteContentUrl.slug];
|
|
28252
|
+
const patName = params[parameters81.patName.slug];
|
|
28253
|
+
const patSecret = params[parameters81.patSecret.slug];
|
|
28254
|
+
const apiVersion = params[parameters81.apiVersion.slug] || "3.28";
|
|
28255
|
+
if (!serverUrl || siteContentUrl == null || !patName || !patSecret) {
|
|
28256
|
+
return {
|
|
28257
|
+
success: false,
|
|
28258
|
+
error: "Missing required parameters: server-url, site-content-url, pat-name, pat-secret"
|
|
28259
|
+
};
|
|
28260
|
+
}
|
|
28261
|
+
try {
|
|
28262
|
+
const res = await fetch(
|
|
28263
|
+
`${serverUrl.replace(/\/$/, "")}/api/${apiVersion}/auth/signin`,
|
|
28264
|
+
{
|
|
28265
|
+
method: "POST",
|
|
28266
|
+
headers: {
|
|
28267
|
+
"Content-Type": "application/json",
|
|
28268
|
+
Accept: "application/json"
|
|
28269
|
+
},
|
|
28270
|
+
body: JSON.stringify({
|
|
28271
|
+
credentials: {
|
|
28272
|
+
personalAccessTokenName: patName,
|
|
28273
|
+
personalAccessTokenSecret: patSecret,
|
|
28274
|
+
site: { contentUrl: siteContentUrl }
|
|
28275
|
+
}
|
|
28276
|
+
})
|
|
28277
|
+
}
|
|
28278
|
+
);
|
|
28279
|
+
if (!res.ok) {
|
|
28280
|
+
const errorText = await res.text().catch(() => res.statusText);
|
|
28281
|
+
return {
|
|
28282
|
+
success: false,
|
|
28283
|
+
error: `Tableau sign-in failed: HTTP ${res.status} ${errorText}`
|
|
28284
|
+
};
|
|
28285
|
+
}
|
|
28286
|
+
return { success: true };
|
|
28287
|
+
} catch (error) {
|
|
28288
|
+
return {
|
|
28289
|
+
success: false,
|
|
28290
|
+
error: error instanceof Error ? error.message : String(error)
|
|
28291
|
+
};
|
|
28292
|
+
}
|
|
28293
|
+
}
|
|
28294
|
+
});
|
|
28295
|
+
|
|
28296
|
+
// ../connectors/src/connectors/outlook-oauth/tools/request.ts
|
|
28297
|
+
import { z as z99 } from "zod";
|
|
28298
|
+
var BASE_HOST13 = "https://graph.microsoft.com";
|
|
28299
|
+
var BASE_PATH_SEGMENT16 = "/v1.0";
|
|
28300
|
+
var BASE_URL42 = `${BASE_HOST13}${BASE_PATH_SEGMENT16}`;
|
|
28301
|
+
var REQUEST_TIMEOUT_MS76 = 6e4;
|
|
28302
|
+
var cachedToken33 = null;
|
|
28303
|
+
async function getProxyToken33(config) {
|
|
28304
|
+
if (cachedToken33 && cachedToken33.expiresAt > Date.now() + 6e4) {
|
|
28305
|
+
return cachedToken33.token;
|
|
28306
|
+
}
|
|
28307
|
+
const url = `${config.appApiBaseUrl}/v0/database/${config.projectId}/environment/${config.environmentId}/oauth-request-proxy-token`;
|
|
28308
|
+
const res = await fetch(url, {
|
|
28309
|
+
method: "POST",
|
|
28310
|
+
headers: {
|
|
28311
|
+
"Content-Type": "application/json",
|
|
28312
|
+
"x-api-key": config.appApiKey,
|
|
28313
|
+
"project-id": config.projectId
|
|
28314
|
+
},
|
|
28315
|
+
body: JSON.stringify({
|
|
28316
|
+
sandboxId: config.sandboxId,
|
|
28317
|
+
issuedBy: "coding-agent"
|
|
28318
|
+
})
|
|
28319
|
+
});
|
|
28320
|
+
if (!res.ok) {
|
|
28321
|
+
const errorText = await res.text().catch(() => res.statusText);
|
|
28322
|
+
throw new Error(
|
|
28323
|
+
`Failed to get proxy token: HTTP ${res.status} ${errorText}`
|
|
28324
|
+
);
|
|
28325
|
+
}
|
|
28326
|
+
const data = await res.json();
|
|
28327
|
+
cachedToken33 = {
|
|
28328
|
+
token: data.token,
|
|
28329
|
+
expiresAt: new Date(data.expiresAt).getTime()
|
|
28330
|
+
};
|
|
28331
|
+
return data.token;
|
|
28332
|
+
}
|
|
28333
|
+
var inputSchema99 = z99.object({
|
|
28334
|
+
toolUseIntent: z99.string().optional().describe(
|
|
28335
|
+
"Brief description of what you intend to accomplish with this tool call"
|
|
28336
|
+
),
|
|
28337
|
+
connectionId: z99.string().describe("ID of the Outlook OAuth connection to use"),
|
|
28338
|
+
method: z99.enum(["GET"]).describe("HTTP method (read-only, GET only)"),
|
|
28339
|
+
path: z99.string().describe(
|
|
28340
|
+
"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."
|
|
28341
|
+
),
|
|
28342
|
+
queryParams: z99.record(z99.string(), z99.string()).optional().describe(
|
|
28343
|
+
`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.`
|
|
28344
|
+
)
|
|
28345
|
+
});
|
|
28346
|
+
var outputSchema99 = z99.discriminatedUnion("success", [
|
|
28347
|
+
z99.object({
|
|
28348
|
+
success: z99.literal(true),
|
|
28349
|
+
status: z99.number(),
|
|
28350
|
+
data: z99.record(z99.string(), z99.unknown())
|
|
28351
|
+
}),
|
|
28352
|
+
z99.object({
|
|
28353
|
+
success: z99.literal(false),
|
|
28354
|
+
error: z99.string()
|
|
28355
|
+
})
|
|
28356
|
+
]);
|
|
28357
|
+
var requestTool58 = new ConnectorTool({
|
|
28358
|
+
name: "request",
|
|
28359
|
+
description: `Send authenticated GET requests to Microsoft Graph for Outlook Mail and Calendar.
|
|
28360
|
+
Authentication is handled automatically via OAuth proxy (Microsoft Entra ID).
|
|
28361
|
+
All paths are relative to https://graph.microsoft.com/v1.0. Use '/me' as the user prefix.
|
|
28362
|
+
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).
|
|
28363
|
+
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\`).`,
|
|
28364
|
+
inputSchema: inputSchema99,
|
|
28365
|
+
outputSchema: outputSchema99,
|
|
28366
|
+
async execute({ connectionId, method, path: path5, queryParams }, connections, config) {
|
|
28367
|
+
const connection2 = connections.find((c) => c.id === connectionId);
|
|
28368
|
+
if (!connection2) {
|
|
28369
|
+
return {
|
|
28370
|
+
success: false,
|
|
28371
|
+
error: `Connection ${connectionId} not found`
|
|
28372
|
+
};
|
|
28373
|
+
}
|
|
28374
|
+
console.log(
|
|
28375
|
+
`[connector-request] outlook-oauth/${connection2.name}: ${method} ${path5}`
|
|
28376
|
+
);
|
|
28377
|
+
try {
|
|
28378
|
+
const normalizedPath = normalizeRequestPath(path5, BASE_PATH_SEGMENT16);
|
|
28379
|
+
let url = `${BASE_URL42}${normalizedPath}`;
|
|
28380
|
+
if (queryParams) {
|
|
28381
|
+
const searchParams = new URLSearchParams(queryParams);
|
|
28382
|
+
url += `?${searchParams.toString()}`;
|
|
28383
|
+
}
|
|
28384
|
+
const token = await getProxyToken33(config.oauthProxy);
|
|
28385
|
+
const proxyUrl = `https://${config.oauthProxy.sandboxId}.${config.oauthProxy.previewBaseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
28386
|
+
const controller = new AbortController();
|
|
28387
|
+
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS76);
|
|
28388
|
+
try {
|
|
28389
|
+
const response = await fetch(proxyUrl, {
|
|
28390
|
+
method: "POST",
|
|
28391
|
+
headers: {
|
|
28392
|
+
"Content-Type": "application/json",
|
|
28393
|
+
Authorization: `Bearer ${token}`
|
|
28394
|
+
},
|
|
28395
|
+
body: JSON.stringify({
|
|
28396
|
+
url,
|
|
28397
|
+
method
|
|
28398
|
+
}),
|
|
28399
|
+
signal: controller.signal
|
|
28400
|
+
});
|
|
28401
|
+
const data = await response.json();
|
|
28402
|
+
if (!response.ok) {
|
|
28403
|
+
const errorMessage = typeof data?.error === "string" ? data.error : typeof data?.message === "string" ? data.message : `HTTP ${response.status} ${response.statusText}`;
|
|
28404
|
+
return { success: false, error: errorMessage };
|
|
28405
|
+
}
|
|
28406
|
+
return { success: true, status: response.status, data };
|
|
28407
|
+
} finally {
|
|
28408
|
+
clearTimeout(timeout);
|
|
28409
|
+
}
|
|
28410
|
+
} catch (err) {
|
|
28411
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
28412
|
+
return { success: false, error: msg };
|
|
28413
|
+
}
|
|
28414
|
+
}
|
|
28415
|
+
});
|
|
28416
|
+
|
|
28417
|
+
// ../connectors/src/connectors/outlook-oauth/setup.ts
|
|
28418
|
+
var requestToolName14 = `outlook-oauth_${requestTool58.name}`;
|
|
28419
|
+
var outlookOnboarding = new ConnectorOnboarding({
|
|
28420
|
+
connectionSetupInstructions: {
|
|
28421
|
+
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
|
|
28422
|
+
|
|
28423
|
+
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:
|
|
28424
|
+
- \`method\`: \`"GET"\`
|
|
28425
|
+
- \`path\`: \`"/me"\`
|
|
28426
|
+
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
|
|
28427
|
+
3. \`${requestToolName14}\` \u3092\u547C\u3073\u51FA\u3057\u3066\u30E1\u30FC\u30EB\u30D5\u30A9\u30EB\u30C0\u4E00\u89A7\u3092\u53D6\u5F97\u3059\u308B:
|
|
28428
|
+
- \`method\`: \`"GET"\`
|
|
28429
|
+
- \`path\`: \`"/me/mailFolders"\`
|
|
28430
|
+
|
|
28431
|
+
#### \u5236\u7D04
|
|
28432
|
+
- **\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
|
|
28433
|
+
- \u30C4\u30FC\u30EB\u9593\u306F1\u6587\u3060\u3051\u66F8\u3044\u3066\u5373\u6B21\u306E\u30C4\u30FC\u30EB\u547C\u3073\u51FA\u3057`,
|
|
28434
|
+
en: `Follow these steps to set up the Outlook connection.
|
|
28435
|
+
|
|
28436
|
+
1. Call \`${requestToolName14}\` to get the authenticated user's profile:
|
|
28437
|
+
- \`method\`: \`"GET"\`
|
|
28438
|
+
- \`path\`: \`"/me"\`
|
|
28439
|
+
2. If an error is returned, ask the user to verify that OAuth authentication completed correctly
|
|
28440
|
+
3. Call \`${requestToolName14}\` to get the mail folder list:
|
|
28441
|
+
- \`method\`: \`"GET"\`
|
|
28442
|
+
- \`path\`: \`"/me/mailFolders"\`
|
|
28443
|
+
|
|
28444
|
+
#### Constraints
|
|
28445
|
+
- **Do NOT read message bodies during setup**. Only the profile and mail-folder requests specified above are allowed
|
|
28446
|
+
- Write only 1 sentence between tool calls, then immediately call the next tool`
|
|
28447
|
+
},
|
|
28448
|
+
dataOverviewInstructions: {
|
|
28449
|
+
en: `Mail
|
|
28450
|
+
1. Call outlook-oauth_request with GET /me/mailFolders to list mail folders
|
|
28451
|
+
2. Call outlook-oauth_request with GET /me/messages?$top=5&$select=id,subject,from,receivedDateTime,conversationId to sample recent messages
|
|
28452
|
+
3. Call outlook-oauth_request with GET /me/messages/{id} for an interesting message to inspect the full payload
|
|
28453
|
+
4. Call outlook-oauth_request with GET /me/mailFolders/{folderId}/messages?$top=5 to drill into a specific folder
|
|
28454
|
+
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
|
|
28455
|
+
|
|
28456
|
+
Calendar
|
|
28457
|
+
6. Call outlook-oauth_request with GET /me/calendars to list calendars (default + shared)
|
|
28458
|
+
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)
|
|
28459
|
+
8. Call outlook-oauth_request with GET /me/events/{eventId} for an interesting event to inspect attendees, body, and location`,
|
|
28460
|
+
ja: `\u30E1\u30FC\u30EB
|
|
28461
|
+
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
|
|
28462
|
+
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
|
|
28463
|
+
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
|
|
28464
|
+
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
|
|
28465
|
+
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
|
|
28466
|
+
|
|
28467
|
+
\u30AB\u30EC\u30F3\u30C0\u30FC
|
|
28468
|
+
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
|
|
28469
|
+
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)
|
|
28470
|
+
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`
|
|
28471
|
+
}
|
|
28472
|
+
});
|
|
28473
|
+
|
|
28474
|
+
// ../connectors/src/connectors/outlook-oauth/parameters.ts
|
|
28475
|
+
var parameters82 = {};
|
|
28476
|
+
|
|
28477
|
+
// ../connectors/src/connectors/outlook-oauth/index.ts
|
|
28478
|
+
var tools82 = { request: requestTool58 };
|
|
28479
|
+
var outlookOauthConnector = new ConnectorPlugin({
|
|
28480
|
+
slug: "outlook",
|
|
28481
|
+
authType: AUTH_TYPES.OAUTH,
|
|
28482
|
+
name: "Outlook",
|
|
28483
|
+
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.",
|
|
28484
|
+
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/1J1FrRTYJjOh3CcSIqsz3I/6a467b4d926075ff99dc60820e0ae4b1/Microsoft_Outlook_Icon__2025%C3%A2__present_.svg",
|
|
28485
|
+
parameters: parameters82,
|
|
28486
|
+
releaseFlag: { dev1: true, dev2: false, prod: false },
|
|
28487
|
+
categories: ["productivity"],
|
|
28488
|
+
onboarding: outlookOnboarding,
|
|
28489
|
+
proxyPolicy: {
|
|
28490
|
+
allowlist: [
|
|
28491
|
+
{
|
|
28492
|
+
host: "graph.microsoft.com",
|
|
28493
|
+
methods: ["GET"]
|
|
28494
|
+
}
|
|
28495
|
+
]
|
|
28496
|
+
},
|
|
28497
|
+
systemPrompt: {
|
|
28498
|
+
en: `### Tools
|
|
28499
|
+
|
|
28500
|
+
- \`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.
|
|
28501
|
+
|
|
28502
|
+
### Microsoft Graph Reference (Outlook Mail)
|
|
28503
|
+
|
|
28504
|
+
#### Available Endpoints
|
|
28505
|
+
- GET \`/me\` \u2014 Get the signed-in user's profile (displayName, mail, userPrincipalName)
|
|
28506
|
+
- GET \`/me/mailFolders\` \u2014 List the user's mail folders (Inbox, SentItems, Drafts, etc.)
|
|
28507
|
+
- GET \`/me/mailFolders/{folderId}\` \u2014 Get a specific mail folder
|
|
28508
|
+
- GET \`/me/mailFolders/{folderId}/messages\` \u2014 List messages within a folder
|
|
28509
|
+
- GET \`/me/messages\` \u2014 List messages across all folders
|
|
28510
|
+
- GET \`/me/messages/{id}\` \u2014 Get a specific message with full body
|
|
28511
|
+
- GET \`/me/messages/{id}/attachments\` \u2014 List attachments on a message
|
|
28512
|
+
- GET \`/me/messages/{id}/attachments/{attachmentId}\` \u2014 Get a specific attachment
|
|
28513
|
+
|
|
28514
|
+
#### Well-Known Folder Names (usable in place of {folderId})
|
|
28515
|
+
- \`inbox\`, \`sentitems\`, \`drafts\`, \`deleteditems\`, \`junkemail\`, \`outbox\`, \`archive\`
|
|
28516
|
+
|
|
28517
|
+
#### Conversations (Threads)
|
|
28518
|
+
- 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).
|
|
28519
|
+
|
|
28520
|
+
### Microsoft Graph Reference (Outlook Calendar)
|
|
28521
|
+
|
|
28522
|
+
#### Available Endpoints
|
|
28523
|
+
- GET \`/me/calendars\` \u2014 List the user's calendars (default + any shared/group calendars)
|
|
28524
|
+
- GET \`/me/calendars/{calendarId}\` \u2014 Get a calendar's metadata
|
|
28525
|
+
- GET \`/me/events\` \u2014 List events on the default calendar (recurring events are returned as series masters \u2014 use \`/me/calendarView\` to expand)
|
|
28526
|
+
- GET \`/me/calendars/{calendarId}/events\` \u2014 List events on a specific calendar
|
|
28527
|
+
- GET \`/me/events/{eventId}\` \u2014 Get a single event
|
|
28528
|
+
- GET \`/me/calendarView?startDateTime=&endDateTime=\` \u2014 List event **occurrences** in a date range (expands recurring events). Equivalent to Google Calendar's \`events?singleEvents=true\`
|
|
28529
|
+
- GET \`/me/calendars/{calendarId}/calendarView?startDateTime=&endDateTime=\` \u2014 Same, scoped to a specific calendar
|
|
28530
|
+
|
|
28531
|
+
#### Calendar Tips
|
|
28532
|
+
- Use \`/me/calendarView\` when you want individual occurrences of recurring events; \`/me/events\` is closer to the raw stored series
|
|
28533
|
+
- \`startDateTime\` / \`endDateTime\` must be ISO-8601 UTC, e.g. \`2025-01-15T00:00:00Z\`
|
|
28534
|
+
- Combine with \`$select=subject,start,end,attendees,location\` and \`$orderby=start/dateTime\` to keep responses small and sorted
|
|
28535
|
+
|
|
28536
|
+
#### Key Query Parameters (OData, shared by Mail + Calendar)
|
|
28537
|
+
- \`$top\` \u2014 Maximum number of results (default 10, max 1000)
|
|
28538
|
+
- \`$skip\` \u2014 Skip the first N results (for paging)
|
|
28539
|
+
- \`$select\` \u2014 Comma-separated list of properties (e.g. \`subject,from,receivedDateTime,bodyPreview\`)
|
|
28540
|
+
- \`$orderby\` \u2014 Sort (e.g. \`receivedDateTime desc\`, \`start/dateTime asc\`)
|
|
28541
|
+
- \`$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'\`)
|
|
28542
|
+
- \`$search\` \u2014 Full-text search; must be wrapped in double quotes (e.g. \`$search="project status"\`). \`$search\` and \`$filter\` cannot be combined
|
|
28543
|
+
- \`$expand\` \u2014 Expand related resources (e.g. \`attachments\`, \`instances\` for recurring events)
|
|
28544
|
+
- \`$count=true\` \u2014 Return total count (requires \`ConsistencyLevel: eventual\` header on some endpoints)
|
|
28545
|
+
|
|
28546
|
+
#### Pagination
|
|
28547
|
+
- Responses include \`@odata.nextLink\` when more results exist; call that URL (or its path) to get the next page
|
|
28548
|
+
|
|
28549
|
+
#### Tips
|
|
28550
|
+
- Use \`/me\` for the signed-in user \u2014 never substitute another user ID
|
|
28551
|
+
- Prefer \`$select\` to avoid huge payloads; the full message body can be MB-sized when HTML
|
|
28552
|
+
- \`bodyPreview\` (first ~255 chars) is included by default and is cheap for triage
|
|
28553
|
+
- Date/time values are ISO-8601; calendar event times also include a \`timeZone\` field
|
|
28554
|
+
|
|
28555
|
+
### Business Logic
|
|
28556
|
+
|
|
28557
|
+
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.
|
|
28558
|
+
|
|
28559
|
+
SDK surface (client created via \`connection(connectionId)\`):
|
|
28560
|
+
|
|
28561
|
+
Mail:
|
|
28562
|
+
- \`client.request(path, init?)\` \u2014 low-level authenticated fetch (path appended to \`https://graph.microsoft.com/v1.0\`)
|
|
28563
|
+
- \`client.getProfile()\` \u2014 fetch the authenticated user's profile
|
|
28564
|
+
- \`client.listMailFolders()\` \u2014 list all mail folders
|
|
28565
|
+
- \`client.listMessages(options?)\` \u2014 list messages with optional \`top\`, \`skip\`, \`filter\`, \`orderBy\`, \`select\`, \`search\`
|
|
28566
|
+
- \`client.listMessagesInFolder(folderId, options?)\` \u2014 list messages in a folder (well-known names like \`inbox\` work)
|
|
28567
|
+
- \`client.getMessage(id, options?)\` \u2014 fetch a specific message
|
|
28568
|
+
- \`client.listConversation(conversationId, options?)\` \u2014 fetch every message in a thread (Gmail-style \`getThread\` equivalent; orders oldest-first by default)
|
|
28569
|
+
|
|
28570
|
+
Attachments:
|
|
28571
|
+
- \`client.listAttachments(messageId)\` \u2014 list attachments on a message
|
|
28572
|
+
- \`client.getAttachment(messageId, attachmentId)\` \u2014 fetch a single attachment (file attachments include base64 \`contentBytes\`)
|
|
28573
|
+
|
|
28574
|
+
Calendar:
|
|
28575
|
+
- \`client.listCalendars()\` \u2014 list calendars accessible to the user
|
|
28576
|
+
- \`client.listEvents(options?)\` \u2014 list events on the default calendar (or pass \`{ calendarId }\` for a specific one). Recurring events are returned as series masters
|
|
28577
|
+
- \`client.getEvent(id)\` \u2014 fetch a single event
|
|
28578
|
+
- \`client.listCalendarView(startDateTime, endDateTime, options?)\` \u2014 list event **occurrences** in a date range (recurring events expanded). Equivalent to Google Calendar's \`events?singleEvents=true\`
|
|
28579
|
+
|
|
28580
|
+
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.
|
|
28581
|
+
|
|
28582
|
+
#### Example
|
|
28583
|
+
|
|
28584
|
+
\`\`\`ts
|
|
28585
|
+
import { connection } from "@squadbase/vite-server/connectors/outlook-oauth";
|
|
28586
|
+
|
|
28587
|
+
const outlook = connection("<connectionId>");
|
|
28588
|
+
|
|
28589
|
+
// Get user profile
|
|
28590
|
+
const profile = await outlook.getProfile();
|
|
28591
|
+
console.log(profile.displayName, profile.mail);
|
|
28592
|
+
|
|
28593
|
+
// List recent unread messages in Inbox
|
|
28594
|
+
const messages = await outlook.listMessagesInFolder("inbox", {
|
|
28595
|
+
top: 10,
|
|
28596
|
+
filter: "isRead eq false",
|
|
28597
|
+
orderBy: "receivedDateTime desc",
|
|
28598
|
+
select: ["id", "subject", "from", "receivedDateTime", "bodyPreview", "conversationId"],
|
|
28599
|
+
});
|
|
28600
|
+
for (const msg of messages.value) {
|
|
28601
|
+
console.log(msg.receivedDateTime, msg.from?.emailAddress.address, msg.subject);
|
|
28602
|
+
}
|
|
28603
|
+
|
|
28604
|
+
// Pull a whole conversation
|
|
28605
|
+
const first = messages.value[0];
|
|
28606
|
+
if (first?.conversationId) {
|
|
28607
|
+
const thread = await outlook.listConversation(first.conversationId);
|
|
28608
|
+
thread.value.forEach(m => console.log(m.receivedDateTime, m.bodyPreview));
|
|
28609
|
+
}
|
|
28610
|
+
|
|
28611
|
+
// Fetch attachments on a message that has them
|
|
28612
|
+
if (first?.hasAttachments) {
|
|
28613
|
+
const atts = await outlook.listAttachments(first.id);
|
|
28614
|
+
for (const a of atts.value) {
|
|
28615
|
+
const full = await outlook.getAttachment(first.id, a.id);
|
|
28616
|
+
console.log(full.name, full.contentType, full.size);
|
|
28617
|
+
// full.contentBytes is base64 for file attachments
|
|
28618
|
+
}
|
|
28619
|
+
}
|
|
28620
|
+
|
|
28621
|
+
// List today's calendar events (expanded occurrences)
|
|
28622
|
+
const todayStart = new Date(); todayStart.setHours(0, 0, 0, 0);
|
|
28623
|
+
const todayEnd = new Date(todayStart); todayEnd.setDate(todayEnd.getDate() + 1);
|
|
28624
|
+
const events = await outlook.listCalendarView(
|
|
28625
|
+
todayStart.toISOString(),
|
|
28626
|
+
todayEnd.toISOString(),
|
|
28627
|
+
{ orderBy: "start/dateTime", select: ["id", "subject", "start", "end", "attendees"] },
|
|
28628
|
+
);
|
|
28629
|
+
events.value.forEach(e => console.log(e.start.dateTime, e.subject));
|
|
28630
|
+
\`\`\``,
|
|
28631
|
+
ja: `### \u30C4\u30FC\u30EB
|
|
28632
|
+
|
|
28633
|
+
- \`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
|
|
28634
|
+
|
|
28635
|
+
### Microsoft Graph \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9 (Outlook \u30E1\u30FC\u30EB)
|
|
28636
|
+
|
|
28637
|
+
#### \u5229\u7528\u53EF\u80FD\u306A\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8
|
|
28638
|
+
- GET \`/me\` \u2014 \u30B5\u30A4\u30F3\u30A4\u30F3\u30E6\u30FC\u30B6\u30FC\u306E\u30D7\u30ED\u30D5\u30A3\u30FC\u30EB (displayName, mail, userPrincipalName)
|
|
28639
|
+
- GET \`/me/mailFolders\` \u2014 \u30E1\u30FC\u30EB\u30D5\u30A9\u30EB\u30C0\u4E00\u89A7 (Inbox, SentItems, Drafts \u306A\u3069)
|
|
28640
|
+
- GET \`/me/mailFolders/{folderId}\` \u2014 \u7279\u5B9A\u30D5\u30A9\u30EB\u30C0\u306E\u53D6\u5F97
|
|
28641
|
+
- GET \`/me/mailFolders/{folderId}/messages\` \u2014 \u30D5\u30A9\u30EB\u30C0\u5185\u306E\u30E1\u30C3\u30BB\u30FC\u30B8\u4E00\u89A7
|
|
28642
|
+
- GET \`/me/messages\` \u2014 \u5168\u30D5\u30A9\u30EB\u30C0\u6A2A\u65AD\u306E\u30E1\u30C3\u30BB\u30FC\u30B8\u4E00\u89A7
|
|
28643
|
+
- GET \`/me/messages/{id}\` \u2014 \u7279\u5B9A\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u672C\u6587\u8FBC\u307F\u3067\u53D6\u5F97
|
|
28644
|
+
- GET \`/me/messages/{id}/attachments\` \u2014 \u30E1\u30C3\u30BB\u30FC\u30B8\u306E\u6DFB\u4ED8\u30D5\u30A1\u30A4\u30EB\u4E00\u89A7
|
|
28645
|
+
- GET \`/me/messages/{id}/attachments/{attachmentId}\` \u2014 \u6DFB\u4ED8\u30D5\u30A1\u30A4\u30EB\u5358\u4F53\u53D6\u5F97
|
|
28646
|
+
|
|
28647
|
+
#### Well-Known \u30D5\u30A9\u30EB\u30C0\u540D ({folderId} \u306E\u4EE3\u308F\u308A\u306B\u4F7F\u7528\u53EF\u80FD)
|
|
28648
|
+
- \`inbox\`, \`sentitems\`, \`drafts\`, \`deleteditems\`, \`junkemail\`, \`outbox\`, \`archive\`
|
|
28649
|
+
|
|
28650
|
+
#### \u4F1A\u8A71 (\u30B9\u30EC\u30C3\u30C9)
|
|
28651
|
+
- \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
|
|
28652
|
+
|
|
28653
|
+
### Microsoft Graph \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9 (Outlook \u30AB\u30EC\u30F3\u30C0\u30FC)
|
|
28654
|
+
|
|
28655
|
+
#### \u5229\u7528\u53EF\u80FD\u306A\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8
|
|
28656
|
+
- 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)
|
|
28657
|
+
- GET \`/me/calendars/{calendarId}\` \u2014 \u30AB\u30EC\u30F3\u30C0\u30FC\u5358\u4F53\u53D6\u5F97
|
|
28658
|
+
- 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
|
|
28659
|
+
- GET \`/me/calendars/{calendarId}/events\` \u2014 \u7279\u5B9A\u30AB\u30EC\u30F3\u30C0\u30FC\u306E\u30A4\u30D9\u30F3\u30C8\u4E00\u89A7
|
|
28660
|
+
- GET \`/me/events/{eventId}\` \u2014 \u30A4\u30D9\u30F3\u30C8\u5358\u4F53\u53D6\u5F97
|
|
28661
|
+
- 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
|
|
28662
|
+
- GET \`/me/calendars/{calendarId}/calendarView?startDateTime=&endDateTime=\` \u2014 \u540C\u4E0A\u3001\u7279\u5B9A\u30AB\u30EC\u30F3\u30C0\u30FC\u7248
|
|
28663
|
+
|
|
28664
|
+
#### \u30AB\u30EC\u30F3\u30C0\u30FC Tips
|
|
28665
|
+
- \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\`
|
|
28666
|
+
- \`startDateTime\` / \`endDateTime\` \u306F ISO-8601 UTC\u3001\u4F8B \`2025-01-15T00:00:00Z\`
|
|
28667
|
+
- \`$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
|
|
28668
|
+
|
|
28669
|
+
#### \u4E3B\u8981\u30AF\u30A8\u30EA\u30D1\u30E9\u30E1\u30FC\u30BF (OData; Mail \u3068 Calendar \u3067\u5171\u901A)
|
|
28670
|
+
- \`$top\` \u2014 \u6700\u5927\u7D50\u679C\u6570 (\u30C7\u30D5\u30A9\u30EB\u30C8 10\u3001\u6700\u5927 1000)
|
|
28671
|
+
- \`$skip\` \u2014 \u5148\u982D N \u4EF6\u3092\u30B9\u30AD\u30C3\u30D7 (\u30DA\u30FC\u30B8\u30F3\u30B0)
|
|
28672
|
+
- \`$select\` \u2014 \u53D6\u5F97\u3059\u308B\u30D7\u30ED\u30D1\u30C6\u30A3\u3092\u30AB\u30F3\u30DE\u533A\u5207\u308A (\u4F8B \`subject,from,receivedDateTime,bodyPreview\`)
|
|
28673
|
+
- \`$orderby\` \u2014 \u30BD\u30FC\u30C8 (\u4F8B \`receivedDateTime desc\`\u3001\`start/dateTime asc\`)
|
|
28674
|
+
- \`$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'\`)
|
|
28675
|
+
- \`$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
|
|
28676
|
+
- \`$expand\` \u2014 \u95A2\u9023\u30EA\u30BD\u30FC\u30B9\u3092\u5C55\u958B (\u4F8B \`attachments\`\u3001\u7E70\u308A\u8FD4\u3057\u30A4\u30D9\u30F3\u30C8\u306E \`instances\`)
|
|
28677
|
+
- \`$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)
|
|
28678
|
+
|
|
28679
|
+
#### \u30DA\u30FC\u30B8\u30CD\u30FC\u30B7\u30E7\u30F3
|
|
28680
|
+
- \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
|
|
28681
|
+
|
|
28682
|
+
#### Tips
|
|
28683
|
+
- \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
|
|
28684
|
+
- \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
|
|
28685
|
+
- \`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
|
|
28686
|
+
- \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
|
|
28687
|
+
|
|
28688
|
+
### Business Logic
|
|
28689
|
+
|
|
28690
|
+
\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
|
|
28691
|
+
|
|
28692
|
+
SDK (\`connection(connectionId)\` \u3067\u4F5C\u6210\u3057\u305F\u30AF\u30E9\u30A4\u30A2\u30F3\u30C8):
|
|
28693
|
+
|
|
28694
|
+
\u30E1\u30FC\u30EB:
|
|
28695
|
+
- \`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)
|
|
28696
|
+
- \`client.getProfile()\` \u2014 \u8A8D\u8A3C\u30E6\u30FC\u30B6\u30FC\u306E\u30D7\u30ED\u30D5\u30A3\u30FC\u30EB\u3092\u53D6\u5F97
|
|
28697
|
+
- \`client.listMailFolders()\` \u2014 \u5168\u30E1\u30FC\u30EB\u30D5\u30A9\u30EB\u30C0\u3092\u4E00\u89A7
|
|
28698
|
+
- \`client.listMessages(options?)\` \u2014 \u30E1\u30C3\u30BB\u30FC\u30B8\u4E00\u89A7 (\`top\`, \`skip\`, \`filter\`, \`orderBy\`, \`select\`, \`search\` \u5BFE\u5FDC)
|
|
28699
|
+
- \`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)
|
|
28700
|
+
- \`client.getMessage(id, options?)\` \u2014 \u7279\u5B9A\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u53D6\u5F97
|
|
28701
|
+
- \`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)
|
|
28702
|
+
|
|
28703
|
+
\u6DFB\u4ED8\u30D5\u30A1\u30A4\u30EB:
|
|
28704
|
+
- \`client.listAttachments(messageId)\` \u2014 \u30E1\u30C3\u30BB\u30FC\u30B8\u306E\u6DFB\u4ED8\u30D5\u30A1\u30A4\u30EB\u4E00\u89A7
|
|
28705
|
+
- \`client.getAttachment(messageId, attachmentId)\` \u2014 \u6DFB\u4ED8\u30D5\u30A1\u30A4\u30EB\u5358\u4F53\u53D6\u5F97 (file attachment \u306F base64 \u306E \`contentBytes\` \u3092\u542B\u3080)
|
|
28706
|
+
|
|
28707
|
+
\u30AB\u30EC\u30F3\u30C0\u30FC:
|
|
28708
|
+
- \`client.listCalendars()\` \u2014 \u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u306A\u30AB\u30EC\u30F3\u30C0\u30FC\u4E00\u89A7
|
|
28709
|
+
- \`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
|
|
28710
|
+
- \`client.getEvent(id)\` \u2014 \u30A4\u30D9\u30F3\u30C8\u5358\u4F53\u53D6\u5F97
|
|
28711
|
+
- \`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
|
|
28712
|
+
|
|
28713
|
+
\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
|
|
28714
|
+
|
|
28715
|
+
#### Example
|
|
28716
|
+
|
|
28717
|
+
\`\`\`ts
|
|
28718
|
+
import { connection } from "@squadbase/vite-server/connectors/outlook-oauth";
|
|
28719
|
+
|
|
28720
|
+
const outlook = connection("<connectionId>");
|
|
28721
|
+
|
|
28722
|
+
// \u30D7\u30ED\u30D5\u30A3\u30FC\u30EB\u53D6\u5F97
|
|
28723
|
+
const profile = await outlook.getProfile();
|
|
28724
|
+
console.log(profile.displayName, profile.mail);
|
|
28725
|
+
|
|
28726
|
+
// \u53D7\u4FE1\u30C8\u30EC\u30A4\u306E\u672A\u8AAD\u30E1\u30C3\u30BB\u30FC\u30B8\u6700\u65B010\u4EF6
|
|
28727
|
+
const messages = await outlook.listMessagesInFolder("inbox", {
|
|
28728
|
+
top: 10,
|
|
28729
|
+
filter: "isRead eq false",
|
|
28730
|
+
orderBy: "receivedDateTime desc",
|
|
28731
|
+
select: ["id", "subject", "from", "receivedDateTime", "bodyPreview", "conversationId"],
|
|
28732
|
+
});
|
|
28733
|
+
for (const msg of messages.value) {
|
|
28734
|
+
console.log(msg.receivedDateTime, msg.from?.emailAddress.address, msg.subject);
|
|
28735
|
+
}
|
|
28736
|
+
|
|
28737
|
+
// \u30B9\u30EC\u30C3\u30C9\u5168\u4F53\u3092\u53D6\u5F97
|
|
28738
|
+
const first = messages.value[0];
|
|
28739
|
+
if (first?.conversationId) {
|
|
28740
|
+
const thread = await outlook.listConversation(first.conversationId);
|
|
28741
|
+
thread.value.forEach(m => console.log(m.receivedDateTime, m.bodyPreview));
|
|
28742
|
+
}
|
|
28743
|
+
|
|
28744
|
+
// \u6DFB\u4ED8\u30D5\u30A1\u30A4\u30EB\u3092\u53D6\u5F97
|
|
28745
|
+
if (first?.hasAttachments) {
|
|
28746
|
+
const atts = await outlook.listAttachments(first.id);
|
|
28747
|
+
for (const a of atts.value) {
|
|
28748
|
+
const full = await outlook.getAttachment(first.id, a.id);
|
|
28749
|
+
console.log(full.name, full.contentType, full.size);
|
|
28750
|
+
// full.contentBytes \u306F file attachment \u306E\u5834\u5408 base64
|
|
28751
|
+
}
|
|
28752
|
+
}
|
|
28753
|
+
|
|
28754
|
+
// \u4ECA\u65E5\u306E\u30AB\u30EC\u30F3\u30C0\u30FC\u30A4\u30D9\u30F3\u30C8 (occurrence \u5C55\u958B)
|
|
28755
|
+
const todayStart = new Date(); todayStart.setHours(0, 0, 0, 0);
|
|
28756
|
+
const todayEnd = new Date(todayStart); todayEnd.setDate(todayEnd.getDate() + 1);
|
|
28757
|
+
const events = await outlook.listCalendarView(
|
|
28758
|
+
todayStart.toISOString(),
|
|
28759
|
+
todayEnd.toISOString(),
|
|
28760
|
+
{ orderBy: "start/dateTime", select: ["id", "subject", "start", "end", "attendees"] },
|
|
28761
|
+
);
|
|
28762
|
+
events.value.forEach(e => console.log(e.start.dateTime, e.subject));
|
|
28763
|
+
\`\`\``
|
|
28764
|
+
},
|
|
28765
|
+
tools: tools82,
|
|
28766
|
+
async checkConnection(_params, config) {
|
|
28767
|
+
const { proxyFetch } = config;
|
|
28768
|
+
const url = "https://graph.microsoft.com/v1.0/me";
|
|
28769
|
+
try {
|
|
28770
|
+
const res = await proxyFetch(url, { method: "GET" });
|
|
28771
|
+
if (!res.ok) {
|
|
28772
|
+
const errorText = await res.text().catch(() => res.statusText);
|
|
28773
|
+
return {
|
|
28774
|
+
success: false,
|
|
28775
|
+
error: `Microsoft Graph failed: HTTP ${res.status} ${errorText}`
|
|
28776
|
+
};
|
|
28777
|
+
}
|
|
28778
|
+
return { success: true };
|
|
28779
|
+
} catch (error) {
|
|
28780
|
+
return {
|
|
28781
|
+
success: false,
|
|
28782
|
+
error: error instanceof Error ? error.message : String(error)
|
|
28783
|
+
};
|
|
28784
|
+
}
|
|
28785
|
+
}
|
|
28786
|
+
});
|
|
28787
|
+
|
|
28788
|
+
// ../connectors/src/connectors/registry.ts
|
|
28789
|
+
var plugins = {
|
|
28790
|
+
snowflake: snowflakeConnector,
|
|
28791
|
+
snowflakePat: snowflakePatConnector,
|
|
28792
|
+
bigquery: bigqueryConnector,
|
|
28793
|
+
bigqueryOauth: bigqueryOauthConnector,
|
|
28794
|
+
databricks: databricksConnector,
|
|
28795
|
+
redshift: redshiftConnector,
|
|
28796
|
+
dbt: dbtConnector,
|
|
28797
|
+
awsAthena: awsAthenaConnector,
|
|
28798
|
+
awsBilling: awsBillingConnector,
|
|
28799
|
+
postgresql: postgresqlConnector,
|
|
28800
|
+
mysql: mysqlConnector,
|
|
28801
|
+
googleAds: googleAdsConnector,
|
|
28802
|
+
googleAnalytics: googleAnalyticsConnector,
|
|
28803
|
+
googleAnalyticsOauth: googleAnalyticsOauthConnector,
|
|
28804
|
+
googleCalendar: googleCalendarConnector,
|
|
28805
|
+
googleCalendarOauth: googleCalendarOauthConnector,
|
|
28806
|
+
googleDocs: googleDocsConnector,
|
|
28807
|
+
googleDrive: googleDriveConnector,
|
|
28808
|
+
googleSheets: googleSheetsConnector,
|
|
28809
|
+
googleSlides: googleSlidesConnector,
|
|
28810
|
+
hubspotOauth: hubspotOauthConnector,
|
|
28811
|
+
stripeOauth: stripeOauthConnector,
|
|
28812
|
+
stripeApiKey: stripeApiKeyConnector,
|
|
28813
|
+
airtable: airtableConnector,
|
|
28814
|
+
airtableOauth: airtableOauthConnector,
|
|
28815
|
+
squadbaseDb: squadbaseDbConnector,
|
|
28816
|
+
kintone: kintoneConnector,
|
|
28817
|
+
kintoneApiToken: kintoneApiTokenConnector,
|
|
28818
|
+
wixStore: wixStoreConnector,
|
|
28819
|
+
openai: openaiConnector,
|
|
28820
|
+
gemini: geminiConnector,
|
|
28821
|
+
anthropic: anthropicConnector,
|
|
28822
|
+
amplitude: amplitudeConnector,
|
|
28823
|
+
attio: attioConnector,
|
|
28824
|
+
shopify: shopifyConnector,
|
|
28825
|
+
shopifyOauth: shopifyOauthConnector,
|
|
28826
|
+
hubspot: hubspotConnector,
|
|
28827
|
+
jira: jiraConnector,
|
|
28828
|
+
linear: linearConnector,
|
|
28829
|
+
asana: asanaConnector,
|
|
28830
|
+
clickhouse: clickhouseConnector,
|
|
28831
|
+
mongodb: mongodbConnector,
|
|
28832
|
+
notion: notionConnector,
|
|
28833
|
+
notionOauth: notionOauthConnector,
|
|
28834
|
+
metaAds: metaAdsConnector,
|
|
28835
|
+
metaAdsOauth: metaAdsOauthConnector,
|
|
28836
|
+
tiktokAds: tiktokAdsConnector,
|
|
28837
|
+
mailchimp: mailchimpConnector,
|
|
28838
|
+
mailchimpOauth: mailchimpOauthConnector,
|
|
28839
|
+
customerio: customerioConnector,
|
|
28840
|
+
gmail: gmailConnector,
|
|
28841
|
+
gmailOauth: gmailOauthConnector,
|
|
28842
|
+
googleAuditLog: googleAuditLogConnector,
|
|
28843
|
+
linkedinAds: linkedinAdsConnector,
|
|
28844
|
+
zendesk: zendeskConnector,
|
|
28845
|
+
zendeskOauth: zendeskOauthConnector,
|
|
28846
|
+
intercom: intercomConnector,
|
|
28847
|
+
intercomOauth: intercomOauthConnector,
|
|
28848
|
+
mixpanel: mixpanelConnector,
|
|
28849
|
+
grafana: grafanaConnector,
|
|
28850
|
+
backlog: backlogConnector,
|
|
28851
|
+
gamma: gammaConnector,
|
|
28852
|
+
sentry: sentryConnector,
|
|
28853
|
+
salesforce: salesforceConnector,
|
|
28854
|
+
influxdb: influxdbConnector,
|
|
28855
|
+
monday: mondayConnector,
|
|
28856
|
+
jdbc: jdbcConnector,
|
|
28857
|
+
semrush: semrushConnector,
|
|
28858
|
+
googleSearchConsoleOauth: googleSearchConsoleOauthConnector,
|
|
28859
|
+
supabase: supabaseConnector,
|
|
28860
|
+
clickup: clickupConnector,
|
|
28861
|
+
sqlserver: sqlserverConnector,
|
|
28862
|
+
azureSql: azureSqlConnector,
|
|
28863
|
+
cosmosdb: cosmosdbConnector,
|
|
28864
|
+
oracle: oracleConnector,
|
|
28865
|
+
freshservice: freshserviceConnector,
|
|
28866
|
+
freshdesk: freshdeskConnector,
|
|
28867
|
+
freshsales: freshsalesConnector,
|
|
28868
|
+
github: githubConnector,
|
|
28869
|
+
powerbiOauth: powerbiOauthConnector,
|
|
28870
|
+
tableau: tableauConnector,
|
|
28871
|
+
outlookOauth: outlookOauthConnector
|
|
28872
|
+
};
|
|
28873
|
+
var connectors = {
|
|
28874
|
+
...plugins,
|
|
28875
|
+
/**
|
|
28876
|
+
* Return plugins that have at least one matching connection.
|
|
28877
|
+
*/
|
|
28878
|
+
pluginsFor(connections) {
|
|
28879
|
+
const keys = new Set(
|
|
28880
|
+
connections.map(
|
|
28881
|
+
(c) => ConnectorPlugin.deriveKey(c.connector.slug, c.connector.authType)
|
|
28882
|
+
)
|
|
28883
|
+
);
|
|
28884
|
+
return Object.values(plugins).filter((p) => keys.has(p.connectorKey));
|
|
28885
|
+
},
|
|
28886
|
+
/**
|
|
28887
|
+
* Find a plugin by slug and authType.
|
|
28888
|
+
*/
|
|
28889
|
+
findByKey(slug, authType) {
|
|
28890
|
+
const key = ConnectorPlugin.deriveKey(slug, authType);
|
|
28891
|
+
return Object.values(plugins).find((p) => p.connectorKey === key);
|
|
28892
|
+
}
|
|
28893
|
+
};
|
|
28894
|
+
|
|
28895
|
+
// src/connector-client/env.ts
|
|
28896
|
+
function resolveEnvVar(entry, key, connectionId) {
|
|
28897
|
+
const envVarName = entry.envVars[key];
|
|
28898
|
+
if (!envVarName) {
|
|
28899
|
+
throw new Error(`Connection "${connectionId}" is missing envVars mapping for key "${key}"`);
|
|
28900
|
+
}
|
|
28901
|
+
const value = process.env[envVarName];
|
|
28902
|
+
if (!value) {
|
|
27592
28903
|
throw new Error(`Environment variable "${envVarName}" (for connection "${connectionId}", key "${key}") is not set`);
|
|
27593
28904
|
}
|
|
27594
28905
|
return value;
|
|
@@ -28030,62 +29341,62 @@ function createDbtClient(entry, slug) {
|
|
|
28030
29341
|
var { getQuery, loadConnections, reloadEnvFile, watchConnectionsFile } = createConnectorRegistry();
|
|
28031
29342
|
|
|
28032
29343
|
// src/types/server-logic.ts
|
|
28033
|
-
import { z as
|
|
28034
|
-
var parameterMetaSchema =
|
|
28035
|
-
name:
|
|
28036
|
-
type:
|
|
28037
|
-
description:
|
|
28038
|
-
required:
|
|
28039
|
-
default:
|
|
28040
|
-
});
|
|
28041
|
-
var serverLogicCacheConfigSchema =
|
|
28042
|
-
ttl:
|
|
28043
|
-
staleWhileRevalidate:
|
|
28044
|
-
});
|
|
28045
|
-
var serverLogicSchemaObjectSchema =
|
|
28046
|
-
() =>
|
|
28047
|
-
type:
|
|
28048
|
-
format:
|
|
28049
|
-
description:
|
|
28050
|
-
nullable:
|
|
28051
|
-
enum:
|
|
29344
|
+
import { z as z100 } from "zod";
|
|
29345
|
+
var parameterMetaSchema = z100.object({
|
|
29346
|
+
name: z100.string(),
|
|
29347
|
+
type: z100.enum(["string", "number", "boolean"]),
|
|
29348
|
+
description: z100.string(),
|
|
29349
|
+
required: z100.boolean().optional(),
|
|
29350
|
+
default: z100.union([z100.string(), z100.number(), z100.boolean()]).optional()
|
|
29351
|
+
});
|
|
29352
|
+
var serverLogicCacheConfigSchema = z100.object({
|
|
29353
|
+
ttl: z100.number(),
|
|
29354
|
+
staleWhileRevalidate: z100.boolean().optional()
|
|
29355
|
+
});
|
|
29356
|
+
var serverLogicSchemaObjectSchema = z100.lazy(
|
|
29357
|
+
() => z100.object({
|
|
29358
|
+
type: z100.enum(["string", "number", "integer", "boolean", "object", "array", "null"]).optional(),
|
|
29359
|
+
format: z100.string().optional(),
|
|
29360
|
+
description: z100.string().optional(),
|
|
29361
|
+
nullable: z100.boolean().optional(),
|
|
29362
|
+
enum: z100.array(z100.union([z100.string(), z100.number(), z100.boolean(), z100.null()])).optional(),
|
|
28052
29363
|
items: serverLogicSchemaObjectSchema.optional(),
|
|
28053
|
-
properties:
|
|
28054
|
-
required:
|
|
28055
|
-
additionalProperties:
|
|
28056
|
-
minimum:
|
|
28057
|
-
maximum:
|
|
28058
|
-
minLength:
|
|
28059
|
-
maxLength:
|
|
28060
|
-
pattern:
|
|
29364
|
+
properties: z100.record(z100.string(), serverLogicSchemaObjectSchema).optional(),
|
|
29365
|
+
required: z100.array(z100.string()).optional(),
|
|
29366
|
+
additionalProperties: z100.union([z100.boolean(), serverLogicSchemaObjectSchema]).optional(),
|
|
29367
|
+
minimum: z100.number().optional(),
|
|
29368
|
+
maximum: z100.number().optional(),
|
|
29369
|
+
minLength: z100.number().optional(),
|
|
29370
|
+
maxLength: z100.number().optional(),
|
|
29371
|
+
pattern: z100.string().optional()
|
|
28061
29372
|
})
|
|
28062
29373
|
);
|
|
28063
|
-
var serverLogicMediaTypeSchema =
|
|
29374
|
+
var serverLogicMediaTypeSchema = z100.object({
|
|
28064
29375
|
schema: serverLogicSchemaObjectSchema.optional(),
|
|
28065
|
-
example:
|
|
29376
|
+
example: z100.unknown().optional()
|
|
28066
29377
|
});
|
|
28067
|
-
var serverLogicResponseSchema =
|
|
28068
|
-
description:
|
|
28069
|
-
content:
|
|
29378
|
+
var serverLogicResponseSchema = z100.object({
|
|
29379
|
+
description: z100.string().optional(),
|
|
29380
|
+
content: z100.record(z100.string(), serverLogicMediaTypeSchema).optional()
|
|
28070
29381
|
});
|
|
28071
29382
|
var jsonBaseFields = {
|
|
28072
|
-
description:
|
|
28073
|
-
parameters:
|
|
29383
|
+
description: z100.string(),
|
|
29384
|
+
parameters: z100.array(parameterMetaSchema).optional(),
|
|
28074
29385
|
response: serverLogicResponseSchema.optional(),
|
|
28075
29386
|
cache: serverLogicCacheConfigSchema.optional()
|
|
28076
29387
|
};
|
|
28077
|
-
var jsonSqlServerLogicSchema =
|
|
29388
|
+
var jsonSqlServerLogicSchema = z100.object({
|
|
28078
29389
|
...jsonBaseFields,
|
|
28079
|
-
type:
|
|
28080
|
-
query:
|
|
28081
|
-
connectionId:
|
|
29390
|
+
type: z100.literal("sql").optional(),
|
|
29391
|
+
query: z100.string(),
|
|
29392
|
+
connectionId: z100.string()
|
|
28082
29393
|
});
|
|
28083
|
-
var jsonTypeScriptServerLogicSchema =
|
|
29394
|
+
var jsonTypeScriptServerLogicSchema = z100.object({
|
|
28084
29395
|
...jsonBaseFields,
|
|
28085
|
-
type:
|
|
28086
|
-
handlerPath:
|
|
29396
|
+
type: z100.literal("typescript"),
|
|
29397
|
+
handlerPath: z100.string()
|
|
28087
29398
|
});
|
|
28088
|
-
var anyJsonServerLogicSchema =
|
|
29399
|
+
var anyJsonServerLogicSchema = z100.union([
|
|
28089
29400
|
jsonTypeScriptServerLogicSchema,
|
|
28090
29401
|
jsonSqlServerLogicSchema
|
|
28091
29402
|
]);
|