@squadbase/vite-server 0.1.9-dev.87dd3f7 → 0.1.9-dev.a57a0ac
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 +74937 -61829
- package/dist/connectors/asana.js +15 -2
- package/dist/connectors/aws-billing.d.ts +5 -0
- package/dist/connectors/aws-billing.js +29843 -0
- package/dist/connectors/azure-sql.d.ts +5 -0
- package/dist/connectors/azure-sql.js +657 -0
- package/dist/connectors/clickup.d.ts +5 -0
- package/dist/connectors/clickup.js +850 -0
- package/dist/connectors/freshdesk.d.ts +5 -0
- package/dist/connectors/freshdesk.js +842 -0
- package/dist/connectors/freshsales.d.ts +5 -0
- package/dist/connectors/freshsales.js +867 -0
- package/dist/connectors/freshservice.d.ts +5 -0
- package/dist/connectors/freshservice.js +813 -0
- package/dist/connectors/github.d.ts +5 -0
- package/dist/connectors/github.js +963 -0
- package/dist/connectors/gmail-oauth.js +15 -2
- package/dist/connectors/gmail.js +23 -14
- package/dist/connectors/google-audit-log.js +25 -14
- package/dist/connectors/google-calendar-oauth.js +18 -2
- package/dist/connectors/google-calendar.js +40 -26
- package/dist/connectors/google-docs.js +18 -2
- package/dist/connectors/google-drive.js +15 -2
- package/dist/connectors/google-search-console-oauth.d.ts +5 -0
- package/dist/connectors/google-search-console-oauth.js +954 -0
- package/dist/connectors/google-sheets.js +18 -2
- package/dist/connectors/google-slides.js +18 -2
- package/dist/connectors/jdbc.d.ts +5 -0
- package/dist/connectors/jdbc.js +21097 -0
- package/dist/connectors/monday.d.ts +5 -0
- package/dist/connectors/monday.js +853 -0
- package/dist/connectors/oracle.d.ts +5 -0
- package/dist/connectors/oracle.js +665 -0
- package/dist/connectors/semrush.d.ts +5 -0
- package/dist/connectors/semrush.js +812 -0
- package/dist/connectors/sqlserver.d.ts +5 -0
- package/dist/connectors/sqlserver.js +656 -0
- package/dist/connectors/supabase.d.ts +5 -0
- package/dist/connectors/supabase.js +582 -0
- package/dist/connectors/tiktok-ads.js +15 -2
- package/dist/index.js +73506 -60398
- package/dist/main.js +73500 -60392
- package/dist/vite-plugin.js +73405 -60297
- package/package.json +60 -2
|
@@ -255,9 +255,21 @@ var AUTH_TYPES = {
|
|
|
255
255
|
USER_PASSWORD: "user-password"
|
|
256
256
|
};
|
|
257
257
|
|
|
258
|
+
// ../connectors/src/lib/normalize-path.ts
|
|
259
|
+
function normalizeRequestPath(path2, basePathSegment) {
|
|
260
|
+
let p = path2.trim();
|
|
261
|
+
if (!p.startsWith("/")) p = "/" + p;
|
|
262
|
+
if (p === basePathSegment || p.startsWith(basePathSegment + "/")) {
|
|
263
|
+
p = p.slice(basePathSegment.length) || "/";
|
|
264
|
+
}
|
|
265
|
+
return p;
|
|
266
|
+
}
|
|
267
|
+
|
|
258
268
|
// ../connectors/src/connectors/gmail-oauth/tools/request.ts
|
|
259
269
|
import { z } from "zod";
|
|
260
|
-
var
|
|
270
|
+
var BASE_HOST = "https://gmail.googleapis.com";
|
|
271
|
+
var BASE_PATH_SEGMENT = "/gmail/v1/users";
|
|
272
|
+
var BASE_URL2 = `${BASE_HOST}${BASE_PATH_SEGMENT}`;
|
|
261
273
|
var REQUEST_TIMEOUT_MS = 6e4;
|
|
262
274
|
var cachedToken = null;
|
|
263
275
|
async function getProxyToken(config) {
|
|
@@ -333,7 +345,8 @@ All paths are relative to https://gmail.googleapis.com/gmail/v1/users. Use '/me'
|
|
|
333
345
|
`[connector-request] gmail-oauth/${connection2.name}: ${method} ${path2}`
|
|
334
346
|
);
|
|
335
347
|
try {
|
|
336
|
-
|
|
348
|
+
const normalizedPath = normalizeRequestPath(path2, BASE_PATH_SEGMENT);
|
|
349
|
+
let url = `${BASE_URL2}${normalizedPath}`;
|
|
337
350
|
if (queryParams) {
|
|
338
351
|
const searchParams = new URLSearchParams(queryParams);
|
|
339
352
|
url += `?${searchParams.toString()}`;
|
package/dist/connectors/gmail.js
CHANGED
|
@@ -255,9 +255,21 @@ var AUTH_TYPES = {
|
|
|
255
255
|
USER_PASSWORD: "user-password"
|
|
256
256
|
};
|
|
257
257
|
|
|
258
|
+
// ../connectors/src/lib/normalize-path.ts
|
|
259
|
+
function normalizeRequestPath(path2, basePathSegment) {
|
|
260
|
+
let p = path2.trim();
|
|
261
|
+
if (!p.startsWith("/")) p = "/" + p;
|
|
262
|
+
if (p === basePathSegment || p.startsWith(basePathSegment + "/")) {
|
|
263
|
+
p = p.slice(basePathSegment.length) || "/";
|
|
264
|
+
}
|
|
265
|
+
return p;
|
|
266
|
+
}
|
|
267
|
+
|
|
258
268
|
// ../connectors/src/connectors/gmail/tools/request-with-delegation.ts
|
|
259
269
|
import { z } from "zod";
|
|
260
|
-
var
|
|
270
|
+
var BASE_HOST = "https://gmail.googleapis.com";
|
|
271
|
+
var BASE_PATH_SEGMENT = "/gmail/v1/users";
|
|
272
|
+
var BASE_URL2 = `${BASE_HOST}${BASE_PATH_SEGMENT}`;
|
|
261
273
|
var REQUEST_TIMEOUT_MS = 6e4;
|
|
262
274
|
function decodeServiceAccount(keyJsonBase64) {
|
|
263
275
|
const decoded = Buffer.from(keyJsonBase64, "base64").toString("utf-8");
|
|
@@ -342,7 +354,8 @@ var requestWithDelegationTool = new ConnectorTool({
|
|
|
342
354
|
serviceAccountEmail
|
|
343
355
|
};
|
|
344
356
|
}
|
|
345
|
-
|
|
357
|
+
const normalizedPath = normalizeRequestPath(path2, BASE_PATH_SEGMENT);
|
|
358
|
+
let url = `${BASE_URL2}${normalizedPath}`;
|
|
346
359
|
if (queryParams) {
|
|
347
360
|
const searchParams = new URLSearchParams(queryParams);
|
|
348
361
|
url += `?${searchParams.toString()}`;
|
|
@@ -413,9 +426,7 @@ var gmailOnboarding = new ConnectorOnboarding({
|
|
|
413
426
|
- \u300C\u30EA\u30C8\u30E9\u30A4\u300D: \u76F4\u524D\u306E\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u30EA\u30B9\u30C8\u3067\u30B9\u30C6\u30C3\u30D7 2 \u3092\u518D\u5B9F\u884C
|
|
414
427
|
- \u300C\u5165\u529B\u3057\u76F4\u3059\u300D: \u30B9\u30C6\u30C3\u30D7 1 \u304B\u3089\u518D\u5B9F\u884C
|
|
415
428
|
|
|
416
|
-
4. \u5168\u30A2\u30C9\u30EC\u30B9\u304C\u6210\u529F\u3057\u305F\u3089 \`finalizeSetup\` \u3092\u547C\u3076\u3002
|
|
417
|
-
- \`- subject: alice@example.com\`
|
|
418
|
-
- \`- subject: bob@example.com\`
|
|
429
|
+
4. \u5168\u30A2\u30C9\u30EC\u30B9\u304C\u6210\u529F\u3057\u305F\u3089 \`finalizeSetup\` \u3092\u547C\u3076\u3002\u691C\u8A3C\u6E08\u307F\u306E\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\uFF08\u30B9\u30C6\u30C3\u30D7 2 \u3067 \`subject\` \u3068\u3057\u3066\u4F7F\u3063\u305F\u5404 \`<email>\`\uFF09\u3092\u3053\u306E\u30B3\u30CD\u30AF\u30B7\u30E7\u30F3\u306E\u30B9\u30B3\u30FC\u30D7\u60C5\u5831\u3068\u3057\u3066\u8A18\u9332\u3059\u308B\u3002
|
|
419
430
|
|
|
420
431
|
#### \u5236\u7D04
|
|
421
432
|
- \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\u8A31\u53EF\u3055\u308C\u3066\u3044\u308B\u306E\u306F\u30B9\u30C6\u30C3\u30D7 2 \u306E \`/me/profile\` \u78BA\u8A8D\u306E\u307F
|
|
@@ -438,21 +449,19 @@ var gmailOnboarding = new ConnectorOnboarding({
|
|
|
438
449
|
- On "retry" \u2192 re-run step 2 with the previously entered email list
|
|
439
450
|
- On "Re-enter" \u2192 re-run step 1
|
|
440
451
|
|
|
441
|
-
4. Once every email succeeds, call \`finalizeSetup\`.
|
|
442
|
-
- \`- subject: alice@example.com\`
|
|
443
|
-
- \`- subject: bob@example.com\`
|
|
452
|
+
4. Once every email succeeds, call \`finalizeSetup\`. Record the verified email addresses (the \`<email>\` values used as \`subject\` in step 2) as this connection's scope info.
|
|
444
453
|
|
|
445
454
|
#### Constraints
|
|
446
455
|
- Do NOT read message bodies during setup. Only the \`/me/profile\` verification is permitted
|
|
447
456
|
- Write at most 1 sentence between tool calls`
|
|
448
457
|
},
|
|
449
458
|
dataOverviewInstructions: {
|
|
450
|
-
en: `Pick ONE
|
|
459
|
+
en: `Pick ONE target user and use that user's email as \`subject\` for every call below. Pass \`scopes: ${READONLY_SCOPES}\` every time.
|
|
451
460
|
|
|
452
461
|
1. \`method=GET\`, \`path=/me/labels\` to list labels.
|
|
453
462
|
2. \`method=GET\`, \`path=/me/messages?maxResults=5\` to fetch recent message IDs.
|
|
454
463
|
3. For each message id, \`method=GET\`, \`path=/me/messages/{id}?format=metadata\`.`,
|
|
455
|
-
ja:
|
|
464
|
+
ja: `\u4EE3\u7406\u5BFE\u8C61\u306E\u30E6\u30FC\u30B6\u30FC\u3092 1 \u4EBA\u9078\u3073\u3001\u4EE5\u4E0B\u306E\u30B9\u30C6\u30C3\u30D7\u3067 \`subject\` \u5F15\u6570\u3068\u3057\u3066\u4F7F\u3063\u3066\u304F\u3060\u3055\u3044\u3002\`scopes\` \u306F\u6BCE\u56DE \`${READONLY_SCOPES}\` \u3092\u6E21\u3057\u307E\u3059\u3002
|
|
456
465
|
|
|
457
466
|
1. \`method=GET\`\u3001\`path=/me/labels\` \u3067\u30E9\u30D9\u30EB\u4E00\u89A7\u3092\u53D6\u5F97
|
|
458
467
|
2. \`method=GET\`\u3001\`path=/me/messages?maxResults=5\` \u3067\u6700\u8FD1\u306E\u30E1\u30C3\u30BB\u30FC\u30B8 ID \u3092\u53D6\u5F97
|
|
@@ -475,7 +484,7 @@ var gmailConnector = new ConnectorPlugin({
|
|
|
475
484
|
systemPrompt: {
|
|
476
485
|
en: `### Tools
|
|
477
486
|
|
|
478
|
-
- \`gmail-service-account_request_with_delegation\`: Call the Gmail API on behalf of the specified Workspace user via Domain-wide Delegation. Pass \`subject\` as the target user email; the token will be issued as that user.
|
|
487
|
+
- \`gmail-service-account_request_with_delegation\`: Call the Gmail API on behalf of the specified Workspace user via Domain-wide Delegation. Pass \`subject\` as the target user's email; the token will be issued as that user. Always pass \`scopes\`.
|
|
479
488
|
|
|
480
489
|
### OAuth Scopes (pass as \`scopes\` argument)
|
|
481
490
|
|
|
@@ -539,7 +548,7 @@ import { connection } from "@squadbase/vite-server/connectors/gmail";
|
|
|
539
548
|
|
|
540
549
|
const gmail = connection("<connectionId>");
|
|
541
550
|
|
|
542
|
-
//
|
|
551
|
+
// The user to impersonate.
|
|
543
552
|
const subject = "alice@example.com";
|
|
544
553
|
const READ = ["https://www.googleapis.com/auth/gmail.readonly"];
|
|
545
554
|
|
|
@@ -568,7 +577,7 @@ for (const msg of messages.messages ?? []) {
|
|
|
568
577
|
\`\`\``,
|
|
569
578
|
ja: `### \u30C4\u30FC\u30EB
|
|
570
579
|
|
|
571
|
-
- \`gmail-service-account_request_with_delegation\`: \u6307\u5B9A\u3055\u308C\u305F Workspace \u30E6\u30FC\u30B6\u30FC\u306B\u4EE3\u308F\u3063\u3066 Domain-wide Delegation \u7D4C\u7531\u3067 Gmail API \u3092\u547C\u3073\u51FA\u3057\u307E\u3059\u3002\u4EE3\u7406\u5BFE\u8C61\u306E\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u3092 \`subject\` \u3068\u3057\u3066\u6E21\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u30C8\u30FC\u30AF\u30F3\u306F\u305D\u306E\u30E6\u30FC\u30B6\u30FC\u3068\u3057\u3066\u767A\u884C\u3055\u308C\u307E\u3059\u3002
|
|
580
|
+
- \`gmail-service-account_request_with_delegation\`: \u6307\u5B9A\u3055\u308C\u305F Workspace \u30E6\u30FC\u30B6\u30FC\u306B\u4EE3\u308F\u3063\u3066 Domain-wide Delegation \u7D4C\u7531\u3067 Gmail API \u3092\u547C\u3073\u51FA\u3057\u307E\u3059\u3002\u4EE3\u7406\u5BFE\u8C61\u306E\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u3092 \`subject\` \u3068\u3057\u3066\u6E21\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u30C8\u30FC\u30AF\u30F3\u306F\u305D\u306E\u30E6\u30FC\u30B6\u30FC\u3068\u3057\u3066\u767A\u884C\u3055\u308C\u307E\u3059\u3002\`scopes\` \u3082\u6BCE\u56DE\u6E21\u3057\u3066\u304F\u3060\u3055\u3044\u3002
|
|
572
581
|
|
|
573
582
|
### OAuth \u30B9\u30B3\u30FC\u30D7 (\`scopes\` \u5F15\u6570\u3067\u6E21\u3059)
|
|
574
583
|
|
|
@@ -632,7 +641,7 @@ import { connection } from "@squadbase/vite-server/connectors/gmail";
|
|
|
632
641
|
|
|
633
642
|
const gmail = connection("<connectionId>");
|
|
634
643
|
|
|
635
|
-
// \u4EE3\u7406\u5BFE\u8C61\u30E6\u30FC\u30B6\u30FC
|
|
644
|
+
// \u4EE3\u7406\u5BFE\u8C61\u30E6\u30FC\u30B6\u30FC
|
|
636
645
|
const subject = "alice@example.com";
|
|
637
646
|
const READ = ["https://www.googleapis.com/auth/gmail.readonly"];
|
|
638
647
|
|
|
@@ -255,9 +255,21 @@ var AUTH_TYPES = {
|
|
|
255
255
|
USER_PASSWORD: "user-password"
|
|
256
256
|
};
|
|
257
257
|
|
|
258
|
+
// ../connectors/src/lib/normalize-path.ts
|
|
259
|
+
function normalizeRequestPath(path2, basePathSegment) {
|
|
260
|
+
let p = path2.trim();
|
|
261
|
+
if (!p.startsWith("/")) p = "/" + p;
|
|
262
|
+
if (p === basePathSegment || p.startsWith(basePathSegment + "/")) {
|
|
263
|
+
p = p.slice(basePathSegment.length) || "/";
|
|
264
|
+
}
|
|
265
|
+
return p;
|
|
266
|
+
}
|
|
267
|
+
|
|
258
268
|
// ../connectors/src/connectors/google-audit-log/tools/request-with-delegation.ts
|
|
259
269
|
import { z } from "zod";
|
|
260
|
-
var
|
|
270
|
+
var BASE_HOST = "https://admin.googleapis.com";
|
|
271
|
+
var BASE_PATH_SEGMENT = "/admin/reports/v1";
|
|
272
|
+
var BASE_URL2 = `${BASE_HOST}${BASE_PATH_SEGMENT}`;
|
|
261
273
|
var REQUEST_TIMEOUT_MS = 6e4;
|
|
262
274
|
function decodeServiceAccount(keyJsonBase64) {
|
|
263
275
|
const decoded = Buffer.from(keyJsonBase64, "base64").toString("utf-8");
|
|
@@ -343,7 +355,8 @@ var requestWithDelegationTool = new ConnectorTool({
|
|
|
343
355
|
serviceAccountEmail
|
|
344
356
|
};
|
|
345
357
|
}
|
|
346
|
-
|
|
358
|
+
const normalizedPath = normalizeRequestPath(path2, BASE_PATH_SEGMENT);
|
|
359
|
+
let url = `${BASE_URL2}${normalizedPath}`;
|
|
347
360
|
if (queryParams) {
|
|
348
361
|
const searchParams = new URLSearchParams(queryParams);
|
|
349
362
|
url += `?${searchParams.toString()}`;
|
|
@@ -413,8 +426,7 @@ var googleAuditLogOnboarding = new ConnectorOnboarding({
|
|
|
413
426
|
- \u300C\u30EA\u30C8\u30E9\u30A4\u300D: \u76F4\u524D\u306E\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u30EA\u30B9\u30C8\u3067\u30B9\u30C6\u30C3\u30D7 2 \u3092\u518D\u5B9F\u884C
|
|
414
427
|
- \u300C\u5165\u529B\u3057\u76F4\u3059\u300D: \u30B9\u30C6\u30C3\u30D7 1 \u304B\u3089\u518D\u5B9F\u884C
|
|
415
428
|
|
|
416
|
-
4. \u5168\u30A2\u30C9\u30EC\u30B9\u304C\u6210\u529F\u3057\u305F\u3089 \`finalizeSetup\` \u3092\u547C\u3076\u3002
|
|
417
|
-
- \`- subject: admin@example.com\`
|
|
429
|
+
4. \u5168\u30A2\u30C9\u30EC\u30B9\u304C\u6210\u529F\u3057\u305F\u3089 \`finalizeSetup\` \u3092\u547C\u3076\u3002\u691C\u8A3C\u6E08\u307F\u306E\u7BA1\u7406\u8005\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u3092\u3053\u306E\u30B3\u30CD\u30AF\u30B7\u30E7\u30F3\u306E\u30B9\u30B3\u30FC\u30D7\u60C5\u5831\u3068\u3057\u3066\u8A18\u9332\u3059\u308B\u3002
|
|
418
430
|
|
|
419
431
|
#### \u5236\u7D04
|
|
420
432
|
- \u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u4E2D\u306B\u53D6\u5F97\u3057\u305F\u76E3\u67FB\u30ED\u30B0\u672C\u6587\u3092\u8AAD\u307F\u53D6\u3089\u306A\u3044\u3053\u3068\u3002\u8A31\u53EF\u3055\u308C\u3066\u3044\u308B\u306E\u306F\u30B9\u30C6\u30C3\u30D7 2 \u306E\u30A2\u30AF\u30BB\u30B9\u78BA\u8A8D\u306E\u307F
|
|
@@ -438,20 +450,19 @@ var googleAuditLogOnboarding = new ConnectorOnboarding({
|
|
|
438
450
|
- On "retry" \u2192 re-run step 2 with the previously entered email list
|
|
439
451
|
- On "Re-enter" \u2192 re-run step 1
|
|
440
452
|
|
|
441
|
-
4. Once every email succeeds, call \`finalizeSetup\`.
|
|
442
|
-
- \`- subject: admin@example.com\`
|
|
453
|
+
4. Once every email succeeds, call \`finalizeSetup\`. Record the verified admin email addresses as this connection's scope info.
|
|
443
454
|
|
|
444
455
|
#### Constraints
|
|
445
456
|
- Do NOT read audit log contents during setup. Only the access verification call in step 2 is permitted
|
|
446
457
|
- Write at most 1 sentence between tool calls`
|
|
447
458
|
},
|
|
448
459
|
dataOverviewInstructions: {
|
|
449
|
-
en: `Pick ONE admin
|
|
460
|
+
en: `Pick ONE admin user and use that user's email as \`subject\` for every call below. Pass \`scopes: ${READONLY_SCOPES}\` every time.
|
|
450
461
|
|
|
451
462
|
1. \`method=GET\`, \`path=/activity/users/all/applications/login\`, \`queryParams={ maxResults: "10" }\` to verify recent login activity events are available.
|
|
452
463
|
2. \`method=GET\`, \`path=/activity/users/all/applications/admin\`, \`queryParams={ maxResults: "10" }\` to inspect recent admin console events.
|
|
453
464
|
3. \`method=GET\`, \`path=/usage/dates/{YYYY-MM-DD}\` (use yesterday's date) to fetch a customer-level usage report sample.`,
|
|
454
|
-
ja:
|
|
465
|
+
ja: `\u5BFE\u8C61\u306E\u7BA1\u7406\u8005\u30E6\u30FC\u30B6\u30FC\u3092 1 \u4EBA\u9078\u3073\u3001\u4EE5\u4E0B\u306E\u30B9\u30C6\u30C3\u30D7\u3067 \`subject\` \u5F15\u6570\u3068\u3057\u3066\u4F7F\u3063\u3066\u304F\u3060\u3055\u3044\u3002\`scopes\` \u306F\u6BCE\u56DE \`${READONLY_SCOPES}\` \u3092\u6E21\u3057\u307E\u3059\u3002
|
|
455
466
|
|
|
456
467
|
1. \`method=GET\`\u3001\`path=/activity/users/all/applications/login\`\u3001\`queryParams={ maxResults: "10" }\` \u3067\u76F4\u8FD1\u306E\u30ED\u30B0\u30A4\u30F3\u30A2\u30AF\u30C6\u30A3\u30D3\u30C6\u30A3\u304C\u53D6\u5F97\u3067\u304D\u308B\u3053\u3068\u3092\u78BA\u8A8D
|
|
457
468
|
2. \`method=GET\`\u3001\`path=/activity/users/all/applications/admin\`\u3001\`queryParams={ maxResults: "10" }\` \u3067\u76F4\u8FD1\u306E\u7BA1\u7406\u30B3\u30F3\u30BD\u30FC\u30EB\u64CD\u4F5C\u3092\u78BA\u8A8D
|
|
@@ -466,15 +477,15 @@ var googleAuditLogConnector = new ConnectorPlugin({
|
|
|
466
477
|
authType: AUTH_TYPES.SERVICE_ACCOUNT,
|
|
467
478
|
name: "Google Audit Log",
|
|
468
479
|
description: "Connect to the Google Workspace Admin SDK Reports API for audit activities and usage reports using a service account with domain-wide delegation. Read-only.",
|
|
469
|
-
iconUrl: "https://
|
|
480
|
+
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/6VWp0bASiAEgiSlwoZOT8A/fb59a3a2d0219db7df0a943b286a5995/admin_2020q4_48dp.png",
|
|
470
481
|
parameters,
|
|
471
|
-
releaseFlag: { dev1: true, dev2:
|
|
482
|
+
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
472
483
|
categories: ["observability"],
|
|
473
484
|
onboarding: googleAuditLogOnboarding,
|
|
474
485
|
systemPrompt: {
|
|
475
486
|
en: `### Tools
|
|
476
487
|
|
|
477
|
-
- \`google-audit-log-service-account_request_with_delegation\`: Call the Google Workspace Admin SDK Reports API on behalf of a Workspace admin via Domain-wide Delegation. Pass \`subject\` as the admin email; the token will be issued as that user.
|
|
488
|
+
- \`google-audit-log-service-account_request_with_delegation\`: Call the Google Workspace Admin SDK Reports API on behalf of a Workspace admin via Domain-wide Delegation. Pass \`subject\` as the admin email; the token will be issued as that user. Always pass \`scopes\`.
|
|
478
489
|
|
|
479
490
|
### OAuth Scopes (pass as \`scopes\` argument)
|
|
480
491
|
|
|
@@ -532,7 +543,7 @@ import { connection } from "@squadbase/vite-server/connectors/google-audit-log";
|
|
|
532
543
|
|
|
533
544
|
const reports = connection("<connectionId>");
|
|
534
545
|
|
|
535
|
-
const SUBJECT = "admin@example.com"; //
|
|
546
|
+
const SUBJECT = "admin@example.com"; // the admin user to impersonate
|
|
536
547
|
const AUDIT = ["https://www.googleapis.com/auth/admin.reports.audit.readonly"];
|
|
537
548
|
|
|
538
549
|
export default async function handler(c: Context) {
|
|
@@ -563,7 +574,7 @@ export default async function handler(c: Context) {
|
|
|
563
574
|
\`\`\``,
|
|
564
575
|
ja: `### \u30C4\u30FC\u30EB
|
|
565
576
|
|
|
566
|
-
- \`google-audit-log-service-account_request_with_delegation\`: Domain-wide Delegation \u7D4C\u7531\u3067 Workspace \u7BA1\u7406\u8005\u306B\u306A\u308A\u3059\u307E\u3057\u3066 Google Workspace Admin SDK Reports API \u3092\u547C\u3073\u51FA\u3057\u307E\u3059\u3002\u4EE3\u7406\u5BFE\u8C61\u306E\u7BA1\u7406\u8005\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u3092 \`subject\` \u3068\u3057\u3066\u6E21\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u30C8\u30FC\u30AF\u30F3\u306F\u305D\u306E\u30E6\u30FC\u30B6\u30FC\u3068\u3057\u3066\u767A\u884C\u3055\u308C\u307E\u3059\u3002
|
|
577
|
+
- \`google-audit-log-service-account_request_with_delegation\`: Domain-wide Delegation \u7D4C\u7531\u3067 Workspace \u7BA1\u7406\u8005\u306B\u306A\u308A\u3059\u307E\u3057\u3066 Google Workspace Admin SDK Reports API \u3092\u547C\u3073\u51FA\u3057\u307E\u3059\u3002\u4EE3\u7406\u5BFE\u8C61\u306E\u7BA1\u7406\u8005\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u3092 \`subject\` \u3068\u3057\u3066\u6E21\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u30C8\u30FC\u30AF\u30F3\u306F\u305D\u306E\u30E6\u30FC\u30B6\u30FC\u3068\u3057\u3066\u767A\u884C\u3055\u308C\u307E\u3059\u3002\`scopes\` \u3082\u6BCE\u56DE\u6E21\u3057\u3066\u304F\u3060\u3055\u3044\u3002
|
|
567
578
|
|
|
568
579
|
### OAuth \u30B9\u30B3\u30FC\u30D7 (\`scopes\` \u5F15\u6570\u3067\u6E21\u3059)
|
|
569
580
|
|
|
@@ -620,7 +631,7 @@ import { connection } from "@squadbase/vite-server/connectors/google-audit-log";
|
|
|
620
631
|
|
|
621
632
|
const reports = connection("<connectionId>");
|
|
622
633
|
|
|
623
|
-
const SUBJECT = "admin@example.com"; //
|
|
634
|
+
const SUBJECT = "admin@example.com"; // \u4EE3\u7406\u5BFE\u8C61\u306E\u7BA1\u7406\u8005
|
|
624
635
|
const AUDIT = ["https://www.googleapis.com/auth/admin.reports.audit.readonly"];
|
|
625
636
|
|
|
626
637
|
export default async function handler(c: Context) {
|
|
@@ -271,6 +271,16 @@ var AUTH_TYPES = {
|
|
|
271
271
|
USER_PASSWORD: "user-password"
|
|
272
272
|
};
|
|
273
273
|
|
|
274
|
+
// ../connectors/src/lib/normalize-path.ts
|
|
275
|
+
function normalizeRequestPath(path2, basePathSegment) {
|
|
276
|
+
let p = path2.trim();
|
|
277
|
+
if (!p.startsWith("/")) p = "/" + p;
|
|
278
|
+
if (p === basePathSegment || p.startsWith(basePathSegment + "/")) {
|
|
279
|
+
p = p.slice(basePathSegment.length) || "/";
|
|
280
|
+
}
|
|
281
|
+
return p;
|
|
282
|
+
}
|
|
283
|
+
|
|
274
284
|
// ../connectors/src/connectors/google-calendar-oauth/tools/list-calendars.ts
|
|
275
285
|
import { z } from "zod";
|
|
276
286
|
var BASE_URL2 = "https://www.googleapis.com/calendar/v3";
|
|
@@ -428,7 +438,9 @@ var googleCalendarOauthOnboarding = new ConnectorOnboarding({
|
|
|
428
438
|
|
|
429
439
|
// ../connectors/src/connectors/google-calendar-oauth/tools/request.ts
|
|
430
440
|
import { z as z2 } from "zod";
|
|
431
|
-
var
|
|
441
|
+
var BASE_HOST = "https://www.googleapis.com";
|
|
442
|
+
var BASE_PATH_SEGMENT = "/calendar/v3";
|
|
443
|
+
var BASE_URL3 = `${BASE_HOST}${BASE_PATH_SEGMENT}`;
|
|
432
444
|
var REQUEST_TIMEOUT_MS2 = 6e4;
|
|
433
445
|
var cachedToken2 = null;
|
|
434
446
|
async function getProxyToken2(config) {
|
|
@@ -505,7 +517,11 @@ Authentication is handled automatically via OAuth proxy.
|
|
|
505
517
|
try {
|
|
506
518
|
const calendarId = parameters.calendarId.tryGetValue(connection2) ?? "primary";
|
|
507
519
|
const resolvedPath = path2.replace(/\{calendarId\}/g, calendarId);
|
|
508
|
-
|
|
520
|
+
const normalizedPath = normalizeRequestPath(
|
|
521
|
+
resolvedPath,
|
|
522
|
+
BASE_PATH_SEGMENT
|
|
523
|
+
);
|
|
524
|
+
let url = `${BASE_URL3}${normalizedPath}`;
|
|
509
525
|
if (queryParams) {
|
|
510
526
|
const searchParams = new URLSearchParams(queryParams);
|
|
511
527
|
url += `?${searchParams.toString()}`;
|
|
@@ -278,7 +278,21 @@ var AUTH_TYPES = {
|
|
|
278
278
|
|
|
279
279
|
// ../connectors/src/connectors/google-calendar/tools/request.ts
|
|
280
280
|
import { z } from "zod";
|
|
281
|
-
|
|
281
|
+
|
|
282
|
+
// ../connectors/src/lib/normalize-path.ts
|
|
283
|
+
function normalizeRequestPath(path2, basePathSegment) {
|
|
284
|
+
let p = path2.trim();
|
|
285
|
+
if (!p.startsWith("/")) p = "/" + p;
|
|
286
|
+
if (p === basePathSegment || p.startsWith(basePathSegment + "/")) {
|
|
287
|
+
p = p.slice(basePathSegment.length) || "/";
|
|
288
|
+
}
|
|
289
|
+
return p;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
// ../connectors/src/connectors/google-calendar/tools/request.ts
|
|
293
|
+
var BASE_HOST = "https://www.googleapis.com";
|
|
294
|
+
var BASE_PATH_SEGMENT = "/calendar/v3";
|
|
295
|
+
var BASE_URL2 = `${BASE_HOST}${BASE_PATH_SEGMENT}`;
|
|
282
296
|
var REQUEST_TIMEOUT_MS = 6e4;
|
|
283
297
|
function decodeServiceAccount(keyJsonBase64) {
|
|
284
298
|
const decoded = Buffer.from(keyJsonBase64, "base64").toString("utf-8");
|
|
@@ -357,7 +371,8 @@ var requestTool = new ConnectorTool({
|
|
|
357
371
|
serviceAccountEmail
|
|
358
372
|
};
|
|
359
373
|
}
|
|
360
|
-
|
|
374
|
+
const normalizedPath = normalizeRequestPath(path2, BASE_PATH_SEGMENT);
|
|
375
|
+
let url = `${BASE_URL2}${normalizedPath}`;
|
|
361
376
|
if (queryParams) {
|
|
362
377
|
const searchParams = new URLSearchParams(queryParams);
|
|
363
378
|
url += `?${searchParams.toString()}`;
|
|
@@ -407,7 +422,9 @@ var requestTool = new ConnectorTool({
|
|
|
407
422
|
|
|
408
423
|
// ../connectors/src/connectors/google-calendar/tools/request-with-delegation.ts
|
|
409
424
|
import { z as z2 } from "zod";
|
|
410
|
-
var
|
|
425
|
+
var BASE_HOST2 = "https://www.googleapis.com";
|
|
426
|
+
var BASE_PATH_SEGMENT2 = "/calendar/v3";
|
|
427
|
+
var BASE_URL3 = `${BASE_HOST2}${BASE_PATH_SEGMENT2}`;
|
|
411
428
|
var REQUEST_TIMEOUT_MS2 = 6e4;
|
|
412
429
|
function decodeServiceAccount2(keyJsonBase64) {
|
|
413
430
|
const decoded = Buffer.from(keyJsonBase64, "base64").toString("utf-8");
|
|
@@ -492,7 +509,8 @@ var requestWithDelegationTool = new ConnectorTool({
|
|
|
492
509
|
serviceAccountEmail
|
|
493
510
|
};
|
|
494
511
|
}
|
|
495
|
-
|
|
512
|
+
const normalizedPath = normalizeRequestPath(path2, BASE_PATH_SEGMENT2);
|
|
513
|
+
let url = `${BASE_URL3}${normalizedPath}`;
|
|
496
514
|
if (queryParams) {
|
|
497
515
|
const searchParams = new URLSearchParams(queryParams);
|
|
498
516
|
url += `?${searchParams.toString()}`;
|
|
@@ -615,9 +633,7 @@ var googleCalendarOnboarding = new ConnectorOnboarding({
|
|
|
615
633
|
|
|
616
634
|
## \u30B9\u30C6\u30C3\u30D7 4: Project Knowledge \u306B\u8A18\u9332
|
|
617
635
|
|
|
618
|
-
\u30B9\u30C6\u30C3\u30D7 2 \u3068 3 \u3067\u78BA\u5B9A\u3057\u305F calendarId \u96C6\u5408\u3092\u7D71\u5408\u3059\u308B\u3002\u5404 calendarId \u306B\u3064\u3044\u3066\u3001\u30B9\u30C6\u30C3\u30D7 2 \u3067\u758E\u901A\u78BA\u8A8D\u3057\u305F\u7D50\u679C\u304B\u3001\u30B9\u30C6\u30C3\u30D7 3 \u306E\u30C7\u30A3\u30B9\u30AB\u30D0\u30EA\u7D50\u679C\u304B\u3089\u7D4C\u8DEF\u3068 (delegation \u306E\u5834\u5408\u306F) subject \u3092\u7279\u5B9A\u3059\u308B\u3002\`finalizeSetup\` \u3092\u547C\u3073\u3001
|
|
619
|
-
- \u30C9\u30E1\u30A4\u30F3\u5168\u4F53\u306E\u59D4\u4EFB\u7D4C\u7531: \`- calendar: <calendarId> (delegation, subject: <subject>, name: "<\u30AB\u30EC\u30F3\u30C0\u30FC\u540D>")\`
|
|
620
|
-
- \u30B5\u30FC\u30D3\u30B9\u30A2\u30AB\u30A6\u30F3\u30C8\u7D4C\u8DEF: \`- calendar: <calendarId> (service-account, name: "<\u30AB\u30EC\u30F3\u30C0\u30FC\u540D>")\`
|
|
636
|
+
\u30B9\u30C6\u30C3\u30D7 2 \u3068 3 \u3067\u78BA\u5B9A\u3057\u305F calendarId \u96C6\u5408\u3092\u7D71\u5408\u3059\u308B\u3002\u5404 calendarId \u306B\u3064\u3044\u3066\u3001\u30B9\u30C6\u30C3\u30D7 2 \u3067\u758E\u901A\u78BA\u8A8D\u3057\u305F\u7D50\u679C\u304B\u3001\u30B9\u30C6\u30C3\u30D7 3 \u306E\u30C7\u30A3\u30B9\u30AB\u30D0\u30EA\u7D50\u679C\u304B\u3089\u7D4C\u8DEF\u3068 (delegation \u306E\u5834\u5408\u306F) subject \u3092\u7279\u5B9A\u3059\u308B\u3002\`finalizeSetup\` \u3092\u547C\u3073\u3001\u5404\u30AB\u30EC\u30F3\u30C0\u30FC\u3092\u300C\u30AB\u30EC\u30F3\u30C0\u30FC\u540D\u30FB\u30AB\u30EC\u30F3\u30C0\u30FC ID\u30FB\u30A2\u30AF\u30BB\u30B9\u7D4C\u8DEF\uFF08delegation \u304B service-account \u304B\uFF09\u30FBdelegation \u306E\u5834\u5408\u306F subject\u300D\u3068\u3068\u3082\u306B\u3053\u306E\u30B3\u30CD\u30AF\u30B7\u30E7\u30F3\u306E\u30B9\u30B3\u30FC\u30D7\u60C5\u5831\u3068\u3057\u3066\u8A18\u9332\u3059\u308B\u3002
|
|
621
637
|
|
|
622
638
|
## \u30B9\u30C6\u30C3\u30D7 5: \u6700\u7D42\u7684\u306B\u30AB\u30EC\u30F3\u30C0\u30FC\u304C 0 \u4EF6\u306E\u3068\u304D\u306E\u30A8\u30B9\u30AB\u30EC\u30FC\u30B7\u30E7\u30F3
|
|
623
639
|
|
|
@@ -709,9 +725,7 @@ Discover calendars from each Workspace user and let the user narrow them down.
|
|
|
709
725
|
|
|
710
726
|
## Step 4: Record in Project Knowledge
|
|
711
727
|
|
|
712
|
-
Aggregate the calendarIds from Steps 2 and 3. Cross-reference each calendarId against the verification result (Step 2) or the discovery result (Step 3) to recover its access path and, for delegation, the subject. Call \`finalizeSetup
|
|
713
|
-
- Via Domain-wide Delegation: \`- calendar: <calendarId> (delegation, subject: <subject>, name: "<calendar name>")\`
|
|
714
|
-
- Via service account: \`- calendar: <calendarId> (service-account, name: "<calendar name>")\`
|
|
728
|
+
Aggregate the calendarIds from Steps 2 and 3. Cross-reference each calendarId against the verification result (Step 2) or the discovery result (Step 3) to recover its access path and, for delegation, the subject. Call \`finalizeSetup\` and record each calendar with its name, calendar ID, access path (delegation or service-account), and (for delegation) the subject as this connection's scope info.
|
|
715
729
|
|
|
716
730
|
## Step 5: Escalation when zero calendars are selected
|
|
717
731
|
|
|
@@ -737,18 +751,18 @@ Behavior per selection:
|
|
|
737
751
|
- Write at most 1 sentence between tool calls`
|
|
738
752
|
},
|
|
739
753
|
dataOverviewInstructions: {
|
|
740
|
-
en: `For each calendar
|
|
741
|
-
-
|
|
742
|
-
-
|
|
754
|
+
en: `For each calendar configured for this connection, fetch metadata and a small sample of upcoming events. Pick the tool that matches the calendar's access path:
|
|
755
|
+
- Calendars accessed via delegation \u2192 \`${requestWithDelegationToolName}\` with the user's email as \`subject\`
|
|
756
|
+
- Calendars shared directly with the service account \u2192 \`${requestToolName}\`
|
|
743
757
|
|
|
744
758
|
Pass \`scopes: ${READONLY_SCOPES}\` for every call.
|
|
745
759
|
|
|
746
760
|
For each calendar:
|
|
747
761
|
1. \`method=GET\`, \`path=/calendars/<id>\` to fetch metadata.
|
|
748
762
|
2. \`method=GET\`, \`path=/calendars/<id>/events\`, \`queryParams={ timeMin: <RFC3339 now>, maxResults: "10", singleEvents: "true", orderBy: "startTime" }\`.`,
|
|
749
|
-
ja:
|
|
750
|
-
-
|
|
751
|
-
-
|
|
763
|
+
ja: `\u3053\u306E\u30B3\u30CD\u30AF\u30B7\u30E7\u30F3\u3067\u8A2D\u5B9A\u3055\u308C\u3066\u3044\u308B\u5404\u30AB\u30EC\u30F3\u30C0\u30FC\u306B\u3064\u3044\u3066\u3001\u30E1\u30BF\u30C7\u30FC\u30BF\u3068\u76F4\u8FD1\u306E\u30A4\u30D9\u30F3\u30C8\u3092\u5C11\u91CF\u53D6\u5F97\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u30A2\u30AF\u30BB\u30B9\u7D4C\u8DEF\u306B\u5FDC\u3058\u3066\u30C4\u30FC\u30EB\u3092\u9078\u3073\u307E\u3059:
|
|
764
|
+
- delegation \u7D4C\u7531\u306E\u30AB\u30EC\u30F3\u30C0\u30FC \u2192 \`${requestWithDelegationToolName}\` \u3092\u3001\u5BFE\u8C61\u30E6\u30FC\u30B6\u30FC\u306E\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u3092 \`subject\` \u3068\u3057\u3066\u547C\u3076
|
|
765
|
+
- service account \u306B\u76F4\u63A5\u5171\u6709\u3055\u308C\u305F\u30AB\u30EC\u30F3\u30C0\u30FC \u2192 \`${requestToolName}\` \u3092\u547C\u3076
|
|
752
766
|
|
|
753
767
|
\`scopes\` \u306F\u6BCE\u56DE \`${READONLY_SCOPES}\` \u3092\u6E21\u3057\u3066\u304F\u3060\u3055\u3044\u3002
|
|
754
768
|
|
|
@@ -797,10 +811,10 @@ Per-endpoint scope reference: https://developers.google.com/calendar/api/auth
|
|
|
797
811
|
|
|
798
812
|
### Choosing the right tool
|
|
799
813
|
|
|
800
|
-
|
|
814
|
+
Each calendar configured for this connection has an access path. Match the path to the tool:
|
|
801
815
|
|
|
802
|
-
-
|
|
803
|
-
-
|
|
816
|
+
- A Workspace user's calendar accessed via Domain-wide Delegation \u2192 use \`request_with_delegation\` and pass that user's email as \`subject\`
|
|
817
|
+
- A calendar shared directly with the service account \u2192 use \`request\` (no \`subject\`)
|
|
804
818
|
|
|
805
819
|
### Path conventions
|
|
806
820
|
|
|
@@ -855,14 +869,14 @@ export default async function handler(c: Context) {
|
|
|
855
869
|
orderBy: "startTime",
|
|
856
870
|
});
|
|
857
871
|
|
|
858
|
-
//
|
|
872
|
+
// alice@example.com is accessed via delegation
|
|
859
873
|
const aliceRes = await calendar.requestWithDelegation(
|
|
860
874
|
\`/calendars/alice@example.com/events?\${qs}\`,
|
|
861
875
|
{ subject: "alice@example.com", scopes: READ },
|
|
862
876
|
);
|
|
863
877
|
const alice = await aliceRes.json();
|
|
864
878
|
|
|
865
|
-
//
|
|
879
|
+
// team@example.com is shared directly with the service account
|
|
866
880
|
const teamRes = await calendar.request(
|
|
867
881
|
\`/calendars/team@example.com/events?\${qs}\`,
|
|
868
882
|
{ scopes: READ },
|
|
@@ -895,10 +909,10 @@ export default async function handler(c: Context) {
|
|
|
895
909
|
|
|
896
910
|
### \u9069\u5207\u306A\u30C4\u30FC\u30EB\u306E\u9078\u3073\u65B9
|
|
897
911
|
|
|
898
|
-
\u3053\u306E\u30B3\u30CD\u30AF\u30B7\u30E7\u30F3\
|
|
912
|
+
\u3053\u306E\u30B3\u30CD\u30AF\u30B7\u30E7\u30F3\u3067\u8A2D\u5B9A\u3055\u308C\u3066\u3044\u308B\u5404\u30AB\u30EC\u30F3\u30C0\u30FC\u306B\u306F\u30A2\u30AF\u30BB\u30B9\u7D4C\u8DEF\u304C\u3042\u308A\u307E\u3059\u3002\u7D4C\u8DEF\u306B\u5FDC\u3058\u3066\u30C4\u30FC\u30EB\u3092\u9078\u3093\u3067\u304F\u3060\u3055\u3044:
|
|
899
913
|
|
|
900
|
-
-
|
|
901
|
-
-
|
|
914
|
+
- delegation \u7D4C\u7531\uFF08Workspace \u30E6\u30FC\u30B6\u30FC\u306E\u30AB\u30EC\u30F3\u30C0\u30FC\u306B Domain-wide Delegation \u3067\u30A2\u30AF\u30BB\u30B9\uFF09\u2192 \`request_with_delegation\` \u3092\u4F7F\u3044\u3001\u5BFE\u8C61\u30E6\u30FC\u30B6\u30FC\u306E\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u3092 \`subject\` \u3068\u3057\u3066\u6E21\u3059
|
|
915
|
+
- service account \u7D4C\u7531\uFF08\u30B5\u30FC\u30D3\u30B9\u30A2\u30AB\u30A6\u30F3\u30C8\u306B\u76F4\u63A5\u5171\u6709\u3055\u308C\u305F\u30AB\u30EC\u30F3\u30C0\u30FC\uFF09\u2192 \`request\` \u3092\u4F7F\u3046\uFF08\`subject\` \u4E0D\u8981\uFF09
|
|
902
916
|
|
|
903
917
|
### \u30D1\u30B9\u306E\u66F8\u304D\u65B9
|
|
904
918
|
|
|
@@ -953,14 +967,14 @@ export default async function handler(c: Context) {
|
|
|
953
967
|
orderBy: "startTime",
|
|
954
968
|
});
|
|
955
969
|
|
|
956
|
-
//
|
|
970
|
+
// alice@example.com \u306F delegation \u7D4C\u8DEF\u3067\u30A2\u30AF\u30BB\u30B9
|
|
957
971
|
const aliceRes = await calendar.requestWithDelegation(
|
|
958
972
|
\`/calendars/alice@example.com/events?\${qs}\`,
|
|
959
973
|
{ subject: "alice@example.com", scopes: READ },
|
|
960
974
|
);
|
|
961
975
|
const alice = await aliceRes.json();
|
|
962
976
|
|
|
963
|
-
//
|
|
977
|
+
// team@example.com \u306F SA \u306B\u76F4\u63A5\u5171\u6709
|
|
964
978
|
const teamRes = await calendar.request(
|
|
965
979
|
\`/calendars/team@example.com/events?\${qs}\`,
|
|
966
980
|
{ scopes: READ },
|
|
@@ -203,6 +203,16 @@ var AUTH_TYPES = {
|
|
|
203
203
|
USER_PASSWORD: "user-password"
|
|
204
204
|
};
|
|
205
205
|
|
|
206
|
+
// ../connectors/src/lib/normalize-path.ts
|
|
207
|
+
function normalizeRequestPath(path2, basePathSegment) {
|
|
208
|
+
let p = path2.trim();
|
|
209
|
+
if (!p.startsWith("/")) p = "/" + p;
|
|
210
|
+
if (p === basePathSegment || p.startsWith(basePathSegment + "/")) {
|
|
211
|
+
p = p.slice(basePathSegment.length) || "/";
|
|
212
|
+
}
|
|
213
|
+
return p;
|
|
214
|
+
}
|
|
215
|
+
|
|
206
216
|
// ../connectors/src/connectors/google-docs/setup.ts
|
|
207
217
|
var googleDocsOnboarding = new ConnectorOnboarding({
|
|
208
218
|
dataOverviewInstructions: {
|
|
@@ -218,7 +228,9 @@ var parameters = {};
|
|
|
218
228
|
|
|
219
229
|
// ../connectors/src/connectors/google-docs/tools/request.ts
|
|
220
230
|
import { z } from "zod";
|
|
221
|
-
var
|
|
231
|
+
var DOCS_BASE_HOST = "https://docs.googleapis.com";
|
|
232
|
+
var DOCS_BASE_PATH_SEGMENT = "/v1/documents";
|
|
233
|
+
var DOCS_BASE_URL2 = `${DOCS_BASE_HOST}${DOCS_BASE_PATH_SEGMENT}`;
|
|
222
234
|
var REQUEST_TIMEOUT_MS = 6e4;
|
|
223
235
|
var cachedToken = null;
|
|
224
236
|
async function getProxyToken(config) {
|
|
@@ -293,7 +305,11 @@ Authentication is handled automatically via OAuth proxy.`,
|
|
|
293
305
|
`[connector-request] google-docs/${connection2.name}: ${method} ${path2}`
|
|
294
306
|
);
|
|
295
307
|
try {
|
|
296
|
-
|
|
308
|
+
const normalizedPath = normalizeRequestPath(
|
|
309
|
+
path2,
|
|
310
|
+
DOCS_BASE_PATH_SEGMENT
|
|
311
|
+
);
|
|
312
|
+
let url = `${DOCS_BASE_URL2}${normalizedPath === "/" ? "" : normalizedPath}`;
|
|
297
313
|
if (queryParams) {
|
|
298
314
|
const searchParams = new URLSearchParams(queryParams);
|
|
299
315
|
url += `?${searchParams.toString()}`;
|
|
@@ -292,6 +292,16 @@ var AUTH_TYPES = {
|
|
|
292
292
|
USER_PASSWORD: "user-password"
|
|
293
293
|
};
|
|
294
294
|
|
|
295
|
+
// ../connectors/src/lib/normalize-path.ts
|
|
296
|
+
function normalizeRequestPath(path2, basePathSegment) {
|
|
297
|
+
let p = path2.trim();
|
|
298
|
+
if (!p.startsWith("/")) p = "/" + p;
|
|
299
|
+
if (p === basePathSegment || p.startsWith(basePathSegment + "/")) {
|
|
300
|
+
p = p.slice(basePathSegment.length) || "/";
|
|
301
|
+
}
|
|
302
|
+
return p;
|
|
303
|
+
}
|
|
304
|
+
|
|
295
305
|
// ../connectors/src/connectors/google-drive/setup.ts
|
|
296
306
|
var googleDriveOnboarding = new ConnectorOnboarding({
|
|
297
307
|
dataOverviewInstructions: {
|
|
@@ -307,7 +317,9 @@ var parameters = {};
|
|
|
307
317
|
|
|
308
318
|
// ../connectors/src/connectors/google-drive/tools/request.ts
|
|
309
319
|
import { z } from "zod";
|
|
310
|
-
var
|
|
320
|
+
var BASE_HOST = "https://www.googleapis.com";
|
|
321
|
+
var BASE_PATH_SEGMENT = "/drive/v3";
|
|
322
|
+
var BASE_URL2 = `${BASE_HOST}${BASE_PATH_SEGMENT}`;
|
|
311
323
|
var REQUEST_TIMEOUT_MS = 6e4;
|
|
312
324
|
var cachedToken = null;
|
|
313
325
|
async function getProxyToken(config) {
|
|
@@ -382,7 +394,8 @@ Authentication is handled automatically via OAuth proxy.`,
|
|
|
382
394
|
`[connector-request] google-drive/${connection2.name}: ${method} ${path2}`
|
|
383
395
|
);
|
|
384
396
|
try {
|
|
385
|
-
|
|
397
|
+
const normalizedPath = normalizeRequestPath(path2, BASE_PATH_SEGMENT);
|
|
398
|
+
let url = `${BASE_URL2}${normalizedPath}`;
|
|
386
399
|
if (queryParams) {
|
|
387
400
|
const searchParams = new URLSearchParams(queryParams);
|
|
388
401
|
url += `?${searchParams.toString()}`;
|