@squadbase/vite-server 0.1.7-dev.2 → 0.1.7-dev.3
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 +36 -22
- package/dist/connectors/google-sheets.js +51 -29
- package/dist/index.js +36 -22
- package/dist/main.js +36 -22
- package/dist/vite-plugin.js +36 -22
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -72736,6 +72736,21 @@ await drive.updateFile("fileId123", {}, "newFolderId", "oldFolderId");
|
|
|
72736
72736
|
|
|
72737
72737
|
// ../connectors/src/connectors/google-sheets/tools/request.ts
|
|
72738
72738
|
import { z as z27 } from "zod";
|
|
72739
|
+
|
|
72740
|
+
// ../connectors/src/connectors/google-sheets/parameters.ts
|
|
72741
|
+
var parameters18 = {
|
|
72742
|
+
spreadsheetId: new ParameterDefinition({
|
|
72743
|
+
slug: "spreadsheet-id",
|
|
72744
|
+
name: "Google Sheets Spreadsheet ID",
|
|
72745
|
+
description: "The spreadsheet ID from the Google Sheets URL (the segment between /d/ and /edit in https://docs.google.com/spreadsheets/d/{spreadsheetId}/edit). Collected during the setup flow.",
|
|
72746
|
+
envVarBaseKey: "GOOGLE_SHEETS_SPREADSHEET_ID",
|
|
72747
|
+
type: "text",
|
|
72748
|
+
secret: false,
|
|
72749
|
+
required: true
|
|
72750
|
+
})
|
|
72751
|
+
};
|
|
72752
|
+
|
|
72753
|
+
// ../connectors/src/connectors/google-sheets/tools/request.ts
|
|
72739
72754
|
var SHEETS_BASE_URL = "https://sheets.googleapis.com/v4/spreadsheets";
|
|
72740
72755
|
var REQUEST_TIMEOUT_MS17 = 6e4;
|
|
72741
72756
|
var cachedToken13 = null;
|
|
@@ -72810,7 +72825,15 @@ Authentication is handled automatically via OAuth proxy.`,
|
|
|
72810
72825
|
`[connector-request] google-sheets/${connection.name}: ${method} ${path5}`
|
|
72811
72826
|
);
|
|
72812
72827
|
try {
|
|
72813
|
-
|
|
72828
|
+
const spreadsheetId = parameters18.spreadsheetId.tryGetValue(connection);
|
|
72829
|
+
if (!spreadsheetId) {
|
|
72830
|
+
return {
|
|
72831
|
+
success: false,
|
|
72832
|
+
error: `Spreadsheet ID is not configured for connection "${connection.name}". Ask the user for a Google Sheets URL and save it with updateConnectionParameters (parameterSlug: "spreadsheet-id") before calling this tool.`
|
|
72833
|
+
};
|
|
72834
|
+
}
|
|
72835
|
+
const resolvedPath = path5.replace(/\{spreadsheetId\}/g, spreadsheetId);
|
|
72836
|
+
let url = `${SHEETS_BASE_URL}${resolvedPath === "" || resolvedPath.startsWith("/") ? "" : "/"}${resolvedPath}`;
|
|
72814
72837
|
if (queryParams) {
|
|
72815
72838
|
const searchParams = new URLSearchParams(queryParams);
|
|
72816
72839
|
url += `?${searchParams.toString()}`;
|
|
@@ -72864,10 +72887,12 @@ var googleSheetsOnboarding = new ConnectorOnboarding({
|
|
|
72864
72887
|
- \`options\`: \`[{ value: <\u62BD\u51FA\u3057\u305FID>, label: <\u540C\u3058\u5024> }]\`\uFF081\u4EF6\u306E\u307F\u306E\u30AA\u30D7\u30B7\u30E7\u30F3\u306F\u81EA\u52D5\u9078\u629E\u3055\u308C\u308B\uFF09
|
|
72865
72888
|
4. \`${requestToolName}\` \u3067\u30B9\u30D7\u30EC\u30C3\u30C9\u30B7\u30FC\u30C8\u306B\u30A2\u30AF\u30BB\u30B9\u3067\u304D\u308B\u3053\u3068\u3092\u78BA\u8A8D\u3059\u308B:
|
|
72866
72889
|
- \`method\`: \`"GET"\`
|
|
72867
|
-
- \`path\`: \`"/{spreadsheetId}"\`
|
|
72868
|
-
5. \
|
|
72869
|
-
|
|
72870
|
-
|
|
72890
|
+
- \`path\`: \`"/{spreadsheetId}"\`\uFF08\`{spreadsheetId}\` \u306F\u30D7\u30EC\u30FC\u30B9\u30DB\u30EB\u30C0\u3002\u305D\u306E\u307E\u307E\u6E21\u305B\u3070\u4FDD\u5B58\u6E08\u307FID\u306B\u81EA\u52D5\u7F6E\u63DB\u3055\u308C\u307E\u3059\uFF09
|
|
72891
|
+
5. **\u691C\u8A3C\u5931\u6557\u6642\u306E\u518D\u30D2\u30A2\u30EA\u30F3\u30B0**: \u30B9\u30C6\u30C3\u30D74\u304C \`success: false\` \u3092\u8FD4\u3057\u305F\u5834\u5408\uFF08404/403/\u898B\u3064\u304B\u3089\u306A\u3044\u7B49\u3001\u3069\u3093\u306A\u30A8\u30E9\u30FC\u3067\u3082\uFF09\u3001\u4EE5\u4E0B\u306E\u624B\u9806\u3067\u518D\u8A66\u884C\u3059\u308B:
|
|
72892
|
+
a. \u30E6\u30FC\u30B6\u30FC\u306B\u539F\u56E0\u306E\u53EF\u80FD\u6027\u3092\u4F1D\u3048\u308B\uFF08\u4F8B: URL\u304C\u9593\u9055\u3063\u3066\u3044\u308B\u3001OAuth\u9023\u643A\u3057\u305FGoogle\u30A2\u30AB\u30A6\u30F3\u30C8\u306B\u95B2\u89A7\u6A29\u9650\u304C\u306A\u3044\u3001\u30D7\u30E9\u30A4\u30D9\u30FC\u30C8\u30B7\u30FC\u30C8\u3067\u5225\u30A2\u30AB\u30A6\u30F3\u30C8\u3068\u5171\u6709\u3055\u308C\u3066\u3044\u308B\uFF09
|
|
72893
|
+
b. \`askUserQuestion\` \u3067\u3082\u3046\u4E00\u5EA6URL\u3092\u805E\u304D\u76F4\u3059\uFF08\`type: "freeText"\`\u3001\`question: \u300C\u30A2\u30AF\u30BB\u30B9\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u3082\u3046\u4E00\u5EA6URL\u3092\u8CBC\u308A\u4ED8\u3051\u3066\u3044\u305F\u3060\u304F\u304B\u3001\u30B9\u30D7\u30EC\u30C3\u30C9\u30B7\u30FC\u30C8\u306E\u5171\u6709\u8A2D\u5B9A\u3092\u3054\u78BA\u8A8D\u304F\u3060\u3055\u3044\u300D\`\uFF09
|
|
72894
|
+
c. \u65B0\u3057\u304F\u53D7\u3051\u53D6\u3063\u305FURL\u304B\u3089ID\u3092\u62BD\u51FA\u3057 \`updateConnectionParameters\` \u3067\u4E0A\u66F8\u304D\u4FDD\u5B58\u3001\u518D\u5EA6 \`${requestToolName}\` \u3067\u691C\u8A3C
|
|
72895
|
+
d. \u6210\u529F\u3059\u308B\u307E\u3067\uFF08\u307E\u305F\u306F\u30E6\u30FC\u30B6\u30FC\u304C\u4E2D\u65AD\u3059\u308B\u307E\u3067\uFF09\u3053\u306E\u30EB\u30FC\u30D7\u3092\u7E70\u308A\u8FD4\u3059\u3002\u540C\u3058ID\u304C\u518D\u5EA6\u5931\u6557\u3059\u308B\u5834\u5408\u306F\u5171\u6709\u8A2D\u5B9A\u306E\u554F\u984C\u306A\u306E\u3067\u30E6\u30FC\u30B6\u30FC\u306B\u305D\u306E\u65E8\u3092\u4F1D\u3048\u3066\u5224\u65AD\u3092\u4EF0\u3050
|
|
72871
72896
|
|
|
72872
72897
|
#### \u5236\u7D04
|
|
72873
72898
|
- **\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u4E2D\u306B\u30BB\u30EB\u5024\u3092\u5927\u91CF\u306B\u53D6\u5F97\u3057\u306A\u3044\u3053\u3068**\u3002\u5B9F\u884C\u3057\u3066\u3088\u3044\u306E\u306F\u4E0A\u8A18\u624B\u9806\u3067\u6307\u5B9A\u3055\u308C\u305F\u30E1\u30BF\u30C7\u30FC\u30BF\u53D6\u5F97\u306E\u307F
|
|
@@ -72884,10 +72909,12 @@ var googleSheetsOnboarding = new ConnectorOnboarding({
|
|
|
72884
72909
|
- \`options\`: \`[{ value: <extracted ID>, label: <same value> }]\` (a single option is auto-selected)
|
|
72885
72910
|
4. Verify access by calling \`${requestToolName}\`:
|
|
72886
72911
|
- \`method\`: \`"GET"\`
|
|
72887
|
-
- \`path\`: \`"/{spreadsheetId}"\`
|
|
72888
|
-
5. If
|
|
72889
|
-
|
|
72890
|
-
-
|
|
72912
|
+
- \`path\`: \`"/{spreadsheetId}"\` (the \`{spreadsheetId}\` placeholder is auto-replaced with the saved ID \u2014 pass it as-is)
|
|
72913
|
+
5. **Retry on verification failure**: If step 4 returns \`success: false\` (404/403/not found or any other error):
|
|
72914
|
+
a. Tell the user the likely causes (wrong URL, OAuth-connected Google account lacks read access, private sheet shared with a different account, etc.)
|
|
72915
|
+
b. Call \`askUserQuestion\` to re-ask for the URL (\`type: "freeText"\`, \`question: "I could not access that sheet. Please paste the URL again, or verify the share settings of the spreadsheet."\`)
|
|
72916
|
+
c. Extract the ID from the new URL, overwrite it via \`updateConnectionParameters\`, and re-verify with \`${requestToolName}\`
|
|
72917
|
+
d. Repeat until verification succeeds (or the user aborts). If the same ID keeps failing, it is a sharing/permissions issue \u2014 inform the user and ask how to proceed
|
|
72891
72918
|
|
|
72892
72919
|
#### Constraints
|
|
72893
72920
|
- **Do NOT read large amounts of cell data during setup**. Only the metadata request specified above is allowed
|
|
@@ -72901,19 +72928,6 @@ var googleSheetsOnboarding = new ConnectorOnboarding({
|
|
|
72901
72928
|
}
|
|
72902
72929
|
});
|
|
72903
72930
|
|
|
72904
|
-
// ../connectors/src/connectors/google-sheets/parameters.ts
|
|
72905
|
-
var parameters18 = {
|
|
72906
|
-
spreadsheetId: new ParameterDefinition({
|
|
72907
|
-
slug: "spreadsheet-id",
|
|
72908
|
-
name: "Google Sheets Spreadsheet ID",
|
|
72909
|
-
description: "The spreadsheet ID from the Google Sheets URL (the segment between /d/ and /edit in https://docs.google.com/spreadsheets/d/{spreadsheetId}/edit). Collected during the setup flow.",
|
|
72910
|
-
envVarBaseKey: "GOOGLE_SHEETS_SPREADSHEET_ID",
|
|
72911
|
-
type: "text",
|
|
72912
|
-
secret: false,
|
|
72913
|
-
required: false
|
|
72914
|
-
})
|
|
72915
|
-
};
|
|
72916
|
-
|
|
72917
72931
|
// ../connectors/src/connectors/google-sheets/index.ts
|
|
72918
72932
|
var tools18 = { request: requestTool9 };
|
|
72919
72933
|
var googleSheetsConnector = new ConnectorPlugin({
|
|
@@ -42,14 +42,36 @@ var ParameterDefinition = class {
|
|
|
42
42
|
}
|
|
43
43
|
};
|
|
44
44
|
|
|
45
|
+
// ../connectors/src/connectors/google-sheets/parameters.ts
|
|
46
|
+
var parameters = {
|
|
47
|
+
spreadsheetId: new ParameterDefinition({
|
|
48
|
+
slug: "spreadsheet-id",
|
|
49
|
+
name: "Google Sheets Spreadsheet ID",
|
|
50
|
+
description: "The spreadsheet ID from the Google Sheets URL (the segment between /d/ and /edit in https://docs.google.com/spreadsheets/d/{spreadsheetId}/edit). Collected during the setup flow.",
|
|
51
|
+
envVarBaseKey: "GOOGLE_SHEETS_SPREADSHEET_ID",
|
|
52
|
+
type: "text",
|
|
53
|
+
secret: false,
|
|
54
|
+
required: true
|
|
55
|
+
})
|
|
56
|
+
};
|
|
57
|
+
|
|
45
58
|
// ../connectors/src/connectors/google-sheets/sdk/index.ts
|
|
46
59
|
var SHEETS_BASE_URL = "https://sheets.googleapis.com/v4/spreadsheets";
|
|
47
|
-
function createClient(
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
60
|
+
function createClient(params, fetchFn = fetch) {
|
|
61
|
+
const spreadsheetId = params[parameters.spreadsheetId.slug];
|
|
62
|
+
if (!spreadsheetId) {
|
|
63
|
+
throw new Error(
|
|
64
|
+
`google-sheets: parameter "${parameters.spreadsheetId.slug}" is not configured for this connection`
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
function resolvePath(path2) {
|
|
68
|
+
const replaced = path2.replace(/\{spreadsheetId\}/g, spreadsheetId);
|
|
69
|
+
return `${SHEETS_BASE_URL}${replaced === "" || replaced.startsWith("/") ? "" : "/"}${replaced}`;
|
|
51
70
|
}
|
|
52
|
-
async function
|
|
71
|
+
async function request(path2, init) {
|
|
72
|
+
return fetchFn(resolvePath(path2), init);
|
|
73
|
+
}
|
|
74
|
+
async function getSpreadsheet() {
|
|
53
75
|
const url = `${SHEETS_BASE_URL}/${spreadsheetId}?fields=spreadsheetId,properties,sheets.properties`;
|
|
54
76
|
const response = await fetchFn(url);
|
|
55
77
|
if (!response.ok) {
|
|
@@ -60,7 +82,7 @@ function createClient(_params, fetchFn = fetch) {
|
|
|
60
82
|
}
|
|
61
83
|
return await response.json();
|
|
62
84
|
}
|
|
63
|
-
async function getValues(
|
|
85
|
+
async function getValues(range) {
|
|
64
86
|
const url = `${SHEETS_BASE_URL}/${spreadsheetId}/values/${encodeURIComponent(range)}`;
|
|
65
87
|
const response = await fetchFn(url);
|
|
66
88
|
if (!response.ok) {
|
|
@@ -71,7 +93,7 @@ function createClient(_params, fetchFn = fetch) {
|
|
|
71
93
|
}
|
|
72
94
|
return await response.json();
|
|
73
95
|
}
|
|
74
|
-
async function batchGetValues(
|
|
96
|
+
async function batchGetValues(ranges) {
|
|
75
97
|
const searchParams = new URLSearchParams();
|
|
76
98
|
for (const range of ranges) {
|
|
77
99
|
searchParams.append("ranges", range);
|
|
@@ -87,6 +109,7 @@ function createClient(_params, fetchFn = fetch) {
|
|
|
87
109
|
return await response.json();
|
|
88
110
|
}
|
|
89
111
|
return {
|
|
112
|
+
spreadsheetId,
|
|
90
113
|
request,
|
|
91
114
|
getSpreadsheet,
|
|
92
115
|
getValues,
|
|
@@ -317,7 +340,15 @@ Authentication is handled automatically via OAuth proxy.`,
|
|
|
317
340
|
`[connector-request] google-sheets/${connection2.name}: ${method} ${path2}`
|
|
318
341
|
);
|
|
319
342
|
try {
|
|
320
|
-
|
|
343
|
+
const spreadsheetId = parameters.spreadsheetId.tryGetValue(connection2);
|
|
344
|
+
if (!spreadsheetId) {
|
|
345
|
+
return {
|
|
346
|
+
success: false,
|
|
347
|
+
error: `Spreadsheet ID is not configured for connection "${connection2.name}". Ask the user for a Google Sheets URL and save it with updateConnectionParameters (parameterSlug: "spreadsheet-id") before calling this tool.`
|
|
348
|
+
};
|
|
349
|
+
}
|
|
350
|
+
const resolvedPath = path2.replace(/\{spreadsheetId\}/g, spreadsheetId);
|
|
351
|
+
let url = `${SHEETS_BASE_URL2}${resolvedPath === "" || resolvedPath.startsWith("/") ? "" : "/"}${resolvedPath}`;
|
|
321
352
|
if (queryParams) {
|
|
322
353
|
const searchParams = new URLSearchParams(queryParams);
|
|
323
354
|
url += `?${searchParams.toString()}`;
|
|
@@ -371,10 +402,12 @@ var googleSheetsOnboarding = new ConnectorOnboarding({
|
|
|
371
402
|
- \`options\`: \`[{ value: <\u62BD\u51FA\u3057\u305FID>, label: <\u540C\u3058\u5024> }]\`\uFF081\u4EF6\u306E\u307F\u306E\u30AA\u30D7\u30B7\u30E7\u30F3\u306F\u81EA\u52D5\u9078\u629E\u3055\u308C\u308B\uFF09
|
|
372
403
|
4. \`${requestToolName}\` \u3067\u30B9\u30D7\u30EC\u30C3\u30C9\u30B7\u30FC\u30C8\u306B\u30A2\u30AF\u30BB\u30B9\u3067\u304D\u308B\u3053\u3068\u3092\u78BA\u8A8D\u3059\u308B:
|
|
373
404
|
- \`method\`: \`"GET"\`
|
|
374
|
-
- \`path\`: \`"/{spreadsheetId}"\`
|
|
375
|
-
5. \
|
|
376
|
-
|
|
377
|
-
|
|
405
|
+
- \`path\`: \`"/{spreadsheetId}"\`\uFF08\`{spreadsheetId}\` \u306F\u30D7\u30EC\u30FC\u30B9\u30DB\u30EB\u30C0\u3002\u305D\u306E\u307E\u307E\u6E21\u305B\u3070\u4FDD\u5B58\u6E08\u307FID\u306B\u81EA\u52D5\u7F6E\u63DB\u3055\u308C\u307E\u3059\uFF09
|
|
406
|
+
5. **\u691C\u8A3C\u5931\u6557\u6642\u306E\u518D\u30D2\u30A2\u30EA\u30F3\u30B0**: \u30B9\u30C6\u30C3\u30D74\u304C \`success: false\` \u3092\u8FD4\u3057\u305F\u5834\u5408\uFF08404/403/\u898B\u3064\u304B\u3089\u306A\u3044\u7B49\u3001\u3069\u3093\u306A\u30A8\u30E9\u30FC\u3067\u3082\uFF09\u3001\u4EE5\u4E0B\u306E\u624B\u9806\u3067\u518D\u8A66\u884C\u3059\u308B:
|
|
407
|
+
a. \u30E6\u30FC\u30B6\u30FC\u306B\u539F\u56E0\u306E\u53EF\u80FD\u6027\u3092\u4F1D\u3048\u308B\uFF08\u4F8B: URL\u304C\u9593\u9055\u3063\u3066\u3044\u308B\u3001OAuth\u9023\u643A\u3057\u305FGoogle\u30A2\u30AB\u30A6\u30F3\u30C8\u306B\u95B2\u89A7\u6A29\u9650\u304C\u306A\u3044\u3001\u30D7\u30E9\u30A4\u30D9\u30FC\u30C8\u30B7\u30FC\u30C8\u3067\u5225\u30A2\u30AB\u30A6\u30F3\u30C8\u3068\u5171\u6709\u3055\u308C\u3066\u3044\u308B\uFF09
|
|
408
|
+
b. \`askUserQuestion\` \u3067\u3082\u3046\u4E00\u5EA6URL\u3092\u805E\u304D\u76F4\u3059\uFF08\`type: "freeText"\`\u3001\`question: \u300C\u30A2\u30AF\u30BB\u30B9\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u3082\u3046\u4E00\u5EA6URL\u3092\u8CBC\u308A\u4ED8\u3051\u3066\u3044\u305F\u3060\u304F\u304B\u3001\u30B9\u30D7\u30EC\u30C3\u30C9\u30B7\u30FC\u30C8\u306E\u5171\u6709\u8A2D\u5B9A\u3092\u3054\u78BA\u8A8D\u304F\u3060\u3055\u3044\u300D\`\uFF09
|
|
409
|
+
c. \u65B0\u3057\u304F\u53D7\u3051\u53D6\u3063\u305FURL\u304B\u3089ID\u3092\u62BD\u51FA\u3057 \`updateConnectionParameters\` \u3067\u4E0A\u66F8\u304D\u4FDD\u5B58\u3001\u518D\u5EA6 \`${requestToolName}\` \u3067\u691C\u8A3C
|
|
410
|
+
d. \u6210\u529F\u3059\u308B\u307E\u3067\uFF08\u307E\u305F\u306F\u30E6\u30FC\u30B6\u30FC\u304C\u4E2D\u65AD\u3059\u308B\u307E\u3067\uFF09\u3053\u306E\u30EB\u30FC\u30D7\u3092\u7E70\u308A\u8FD4\u3059\u3002\u540C\u3058ID\u304C\u518D\u5EA6\u5931\u6557\u3059\u308B\u5834\u5408\u306F\u5171\u6709\u8A2D\u5B9A\u306E\u554F\u984C\u306A\u306E\u3067\u30E6\u30FC\u30B6\u30FC\u306B\u305D\u306E\u65E8\u3092\u4F1D\u3048\u3066\u5224\u65AD\u3092\u4EF0\u3050
|
|
378
411
|
|
|
379
412
|
#### \u5236\u7D04
|
|
380
413
|
- **\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u4E2D\u306B\u30BB\u30EB\u5024\u3092\u5927\u91CF\u306B\u53D6\u5F97\u3057\u306A\u3044\u3053\u3068**\u3002\u5B9F\u884C\u3057\u3066\u3088\u3044\u306E\u306F\u4E0A\u8A18\u624B\u9806\u3067\u6307\u5B9A\u3055\u308C\u305F\u30E1\u30BF\u30C7\u30FC\u30BF\u53D6\u5F97\u306E\u307F
|
|
@@ -391,10 +424,12 @@ var googleSheetsOnboarding = new ConnectorOnboarding({
|
|
|
391
424
|
- \`options\`: \`[{ value: <extracted ID>, label: <same value> }]\` (a single option is auto-selected)
|
|
392
425
|
4. Verify access by calling \`${requestToolName}\`:
|
|
393
426
|
- \`method\`: \`"GET"\`
|
|
394
|
-
- \`path\`: \`"/{spreadsheetId}"\`
|
|
395
|
-
5. If
|
|
396
|
-
|
|
397
|
-
-
|
|
427
|
+
- \`path\`: \`"/{spreadsheetId}"\` (the \`{spreadsheetId}\` placeholder is auto-replaced with the saved ID \u2014 pass it as-is)
|
|
428
|
+
5. **Retry on verification failure**: If step 4 returns \`success: false\` (404/403/not found or any other error):
|
|
429
|
+
a. Tell the user the likely causes (wrong URL, OAuth-connected Google account lacks read access, private sheet shared with a different account, etc.)
|
|
430
|
+
b. Call \`askUserQuestion\` to re-ask for the URL (\`type: "freeText"\`, \`question: "I could not access that sheet. Please paste the URL again, or verify the share settings of the spreadsheet."\`)
|
|
431
|
+
c. Extract the ID from the new URL, overwrite it via \`updateConnectionParameters\`, and re-verify with \`${requestToolName}\`
|
|
432
|
+
d. Repeat until verification succeeds (or the user aborts). If the same ID keeps failing, it is a sharing/permissions issue \u2014 inform the user and ask how to proceed
|
|
398
433
|
|
|
399
434
|
#### Constraints
|
|
400
435
|
- **Do NOT read large amounts of cell data during setup**. Only the metadata request specified above is allowed
|
|
@@ -408,19 +443,6 @@ var googleSheetsOnboarding = new ConnectorOnboarding({
|
|
|
408
443
|
}
|
|
409
444
|
});
|
|
410
445
|
|
|
411
|
-
// ../connectors/src/connectors/google-sheets/parameters.ts
|
|
412
|
-
var parameters = {
|
|
413
|
-
spreadsheetId: new ParameterDefinition({
|
|
414
|
-
slug: "spreadsheet-id",
|
|
415
|
-
name: "Google Sheets Spreadsheet ID",
|
|
416
|
-
description: "The spreadsheet ID from the Google Sheets URL (the segment between /d/ and /edit in https://docs.google.com/spreadsheets/d/{spreadsheetId}/edit). Collected during the setup flow.",
|
|
417
|
-
envVarBaseKey: "GOOGLE_SHEETS_SPREADSHEET_ID",
|
|
418
|
-
type: "text",
|
|
419
|
-
secret: false,
|
|
420
|
-
required: false
|
|
421
|
-
})
|
|
422
|
-
};
|
|
423
|
-
|
|
424
446
|
// ../connectors/src/connectors/google-sheets/index.ts
|
|
425
447
|
var tools = { request: requestTool };
|
|
426
448
|
var googleSheetsConnector = new ConnectorPlugin({
|
package/dist/index.js
CHANGED
|
@@ -72671,6 +72671,21 @@ await drive.updateFile("fileId123", {}, "newFolderId", "oldFolderId");
|
|
|
72671
72671
|
|
|
72672
72672
|
// ../connectors/src/connectors/google-sheets/tools/request.ts
|
|
72673
72673
|
import { z as z27 } from "zod";
|
|
72674
|
+
|
|
72675
|
+
// ../connectors/src/connectors/google-sheets/parameters.ts
|
|
72676
|
+
var parameters18 = {
|
|
72677
|
+
spreadsheetId: new ParameterDefinition({
|
|
72678
|
+
slug: "spreadsheet-id",
|
|
72679
|
+
name: "Google Sheets Spreadsheet ID",
|
|
72680
|
+
description: "The spreadsheet ID from the Google Sheets URL (the segment between /d/ and /edit in https://docs.google.com/spreadsheets/d/{spreadsheetId}/edit). Collected during the setup flow.",
|
|
72681
|
+
envVarBaseKey: "GOOGLE_SHEETS_SPREADSHEET_ID",
|
|
72682
|
+
type: "text",
|
|
72683
|
+
secret: false,
|
|
72684
|
+
required: true
|
|
72685
|
+
})
|
|
72686
|
+
};
|
|
72687
|
+
|
|
72688
|
+
// ../connectors/src/connectors/google-sheets/tools/request.ts
|
|
72674
72689
|
var SHEETS_BASE_URL = "https://sheets.googleapis.com/v4/spreadsheets";
|
|
72675
72690
|
var REQUEST_TIMEOUT_MS17 = 6e4;
|
|
72676
72691
|
var cachedToken13 = null;
|
|
@@ -72745,7 +72760,15 @@ Authentication is handled automatically via OAuth proxy.`,
|
|
|
72745
72760
|
`[connector-request] google-sheets/${connection2.name}: ${method} ${path5}`
|
|
72746
72761
|
);
|
|
72747
72762
|
try {
|
|
72748
|
-
|
|
72763
|
+
const spreadsheetId = parameters18.spreadsheetId.tryGetValue(connection2);
|
|
72764
|
+
if (!spreadsheetId) {
|
|
72765
|
+
return {
|
|
72766
|
+
success: false,
|
|
72767
|
+
error: `Spreadsheet ID is not configured for connection "${connection2.name}". Ask the user for a Google Sheets URL and save it with updateConnectionParameters (parameterSlug: "spreadsheet-id") before calling this tool.`
|
|
72768
|
+
};
|
|
72769
|
+
}
|
|
72770
|
+
const resolvedPath = path5.replace(/\{spreadsheetId\}/g, spreadsheetId);
|
|
72771
|
+
let url = `${SHEETS_BASE_URL}${resolvedPath === "" || resolvedPath.startsWith("/") ? "" : "/"}${resolvedPath}`;
|
|
72749
72772
|
if (queryParams) {
|
|
72750
72773
|
const searchParams = new URLSearchParams(queryParams);
|
|
72751
72774
|
url += `?${searchParams.toString()}`;
|
|
@@ -72799,10 +72822,12 @@ var googleSheetsOnboarding = new ConnectorOnboarding({
|
|
|
72799
72822
|
- \`options\`: \`[{ value: <\u62BD\u51FA\u3057\u305FID>, label: <\u540C\u3058\u5024> }]\`\uFF081\u4EF6\u306E\u307F\u306E\u30AA\u30D7\u30B7\u30E7\u30F3\u306F\u81EA\u52D5\u9078\u629E\u3055\u308C\u308B\uFF09
|
|
72800
72823
|
4. \`${requestToolName}\` \u3067\u30B9\u30D7\u30EC\u30C3\u30C9\u30B7\u30FC\u30C8\u306B\u30A2\u30AF\u30BB\u30B9\u3067\u304D\u308B\u3053\u3068\u3092\u78BA\u8A8D\u3059\u308B:
|
|
72801
72824
|
- \`method\`: \`"GET"\`
|
|
72802
|
-
- \`path\`: \`"/{spreadsheetId}"\`
|
|
72803
|
-
5. \
|
|
72804
|
-
|
|
72805
|
-
|
|
72825
|
+
- \`path\`: \`"/{spreadsheetId}"\`\uFF08\`{spreadsheetId}\` \u306F\u30D7\u30EC\u30FC\u30B9\u30DB\u30EB\u30C0\u3002\u305D\u306E\u307E\u307E\u6E21\u305B\u3070\u4FDD\u5B58\u6E08\u307FID\u306B\u81EA\u52D5\u7F6E\u63DB\u3055\u308C\u307E\u3059\uFF09
|
|
72826
|
+
5. **\u691C\u8A3C\u5931\u6557\u6642\u306E\u518D\u30D2\u30A2\u30EA\u30F3\u30B0**: \u30B9\u30C6\u30C3\u30D74\u304C \`success: false\` \u3092\u8FD4\u3057\u305F\u5834\u5408\uFF08404/403/\u898B\u3064\u304B\u3089\u306A\u3044\u7B49\u3001\u3069\u3093\u306A\u30A8\u30E9\u30FC\u3067\u3082\uFF09\u3001\u4EE5\u4E0B\u306E\u624B\u9806\u3067\u518D\u8A66\u884C\u3059\u308B:
|
|
72827
|
+
a. \u30E6\u30FC\u30B6\u30FC\u306B\u539F\u56E0\u306E\u53EF\u80FD\u6027\u3092\u4F1D\u3048\u308B\uFF08\u4F8B: URL\u304C\u9593\u9055\u3063\u3066\u3044\u308B\u3001OAuth\u9023\u643A\u3057\u305FGoogle\u30A2\u30AB\u30A6\u30F3\u30C8\u306B\u95B2\u89A7\u6A29\u9650\u304C\u306A\u3044\u3001\u30D7\u30E9\u30A4\u30D9\u30FC\u30C8\u30B7\u30FC\u30C8\u3067\u5225\u30A2\u30AB\u30A6\u30F3\u30C8\u3068\u5171\u6709\u3055\u308C\u3066\u3044\u308B\uFF09
|
|
72828
|
+
b. \`askUserQuestion\` \u3067\u3082\u3046\u4E00\u5EA6URL\u3092\u805E\u304D\u76F4\u3059\uFF08\`type: "freeText"\`\u3001\`question: \u300C\u30A2\u30AF\u30BB\u30B9\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u3082\u3046\u4E00\u5EA6URL\u3092\u8CBC\u308A\u4ED8\u3051\u3066\u3044\u305F\u3060\u304F\u304B\u3001\u30B9\u30D7\u30EC\u30C3\u30C9\u30B7\u30FC\u30C8\u306E\u5171\u6709\u8A2D\u5B9A\u3092\u3054\u78BA\u8A8D\u304F\u3060\u3055\u3044\u300D\`\uFF09
|
|
72829
|
+
c. \u65B0\u3057\u304F\u53D7\u3051\u53D6\u3063\u305FURL\u304B\u3089ID\u3092\u62BD\u51FA\u3057 \`updateConnectionParameters\` \u3067\u4E0A\u66F8\u304D\u4FDD\u5B58\u3001\u518D\u5EA6 \`${requestToolName}\` \u3067\u691C\u8A3C
|
|
72830
|
+
d. \u6210\u529F\u3059\u308B\u307E\u3067\uFF08\u307E\u305F\u306F\u30E6\u30FC\u30B6\u30FC\u304C\u4E2D\u65AD\u3059\u308B\u307E\u3067\uFF09\u3053\u306E\u30EB\u30FC\u30D7\u3092\u7E70\u308A\u8FD4\u3059\u3002\u540C\u3058ID\u304C\u518D\u5EA6\u5931\u6557\u3059\u308B\u5834\u5408\u306F\u5171\u6709\u8A2D\u5B9A\u306E\u554F\u984C\u306A\u306E\u3067\u30E6\u30FC\u30B6\u30FC\u306B\u305D\u306E\u65E8\u3092\u4F1D\u3048\u3066\u5224\u65AD\u3092\u4EF0\u3050
|
|
72806
72831
|
|
|
72807
72832
|
#### \u5236\u7D04
|
|
72808
72833
|
- **\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u4E2D\u306B\u30BB\u30EB\u5024\u3092\u5927\u91CF\u306B\u53D6\u5F97\u3057\u306A\u3044\u3053\u3068**\u3002\u5B9F\u884C\u3057\u3066\u3088\u3044\u306E\u306F\u4E0A\u8A18\u624B\u9806\u3067\u6307\u5B9A\u3055\u308C\u305F\u30E1\u30BF\u30C7\u30FC\u30BF\u53D6\u5F97\u306E\u307F
|
|
@@ -72819,10 +72844,12 @@ var googleSheetsOnboarding = new ConnectorOnboarding({
|
|
|
72819
72844
|
- \`options\`: \`[{ value: <extracted ID>, label: <same value> }]\` (a single option is auto-selected)
|
|
72820
72845
|
4. Verify access by calling \`${requestToolName}\`:
|
|
72821
72846
|
- \`method\`: \`"GET"\`
|
|
72822
|
-
- \`path\`: \`"/{spreadsheetId}"\`
|
|
72823
|
-
5. If
|
|
72824
|
-
|
|
72825
|
-
-
|
|
72847
|
+
- \`path\`: \`"/{spreadsheetId}"\` (the \`{spreadsheetId}\` placeholder is auto-replaced with the saved ID \u2014 pass it as-is)
|
|
72848
|
+
5. **Retry on verification failure**: If step 4 returns \`success: false\` (404/403/not found or any other error):
|
|
72849
|
+
a. Tell the user the likely causes (wrong URL, OAuth-connected Google account lacks read access, private sheet shared with a different account, etc.)
|
|
72850
|
+
b. Call \`askUserQuestion\` to re-ask for the URL (\`type: "freeText"\`, \`question: "I could not access that sheet. Please paste the URL again, or verify the share settings of the spreadsheet."\`)
|
|
72851
|
+
c. Extract the ID from the new URL, overwrite it via \`updateConnectionParameters\`, and re-verify with \`${requestToolName}\`
|
|
72852
|
+
d. Repeat until verification succeeds (or the user aborts). If the same ID keeps failing, it is a sharing/permissions issue \u2014 inform the user and ask how to proceed
|
|
72826
72853
|
|
|
72827
72854
|
#### Constraints
|
|
72828
72855
|
- **Do NOT read large amounts of cell data during setup**. Only the metadata request specified above is allowed
|
|
@@ -72836,19 +72863,6 @@ var googleSheetsOnboarding = new ConnectorOnboarding({
|
|
|
72836
72863
|
}
|
|
72837
72864
|
});
|
|
72838
72865
|
|
|
72839
|
-
// ../connectors/src/connectors/google-sheets/parameters.ts
|
|
72840
|
-
var parameters18 = {
|
|
72841
|
-
spreadsheetId: new ParameterDefinition({
|
|
72842
|
-
slug: "spreadsheet-id",
|
|
72843
|
-
name: "Google Sheets Spreadsheet ID",
|
|
72844
|
-
description: "The spreadsheet ID from the Google Sheets URL (the segment between /d/ and /edit in https://docs.google.com/spreadsheets/d/{spreadsheetId}/edit). Collected during the setup flow.",
|
|
72845
|
-
envVarBaseKey: "GOOGLE_SHEETS_SPREADSHEET_ID",
|
|
72846
|
-
type: "text",
|
|
72847
|
-
secret: false,
|
|
72848
|
-
required: false
|
|
72849
|
-
})
|
|
72850
|
-
};
|
|
72851
|
-
|
|
72852
72866
|
// ../connectors/src/connectors/google-sheets/index.ts
|
|
72853
72867
|
var tools18 = { request: requestTool9 };
|
|
72854
72868
|
var googleSheetsConnector = new ConnectorPlugin({
|
package/dist/main.js
CHANGED
|
@@ -72671,6 +72671,21 @@ await drive.updateFile("fileId123", {}, "newFolderId", "oldFolderId");
|
|
|
72671
72671
|
|
|
72672
72672
|
// ../connectors/src/connectors/google-sheets/tools/request.ts
|
|
72673
72673
|
import { z as z27 } from "zod";
|
|
72674
|
+
|
|
72675
|
+
// ../connectors/src/connectors/google-sheets/parameters.ts
|
|
72676
|
+
var parameters18 = {
|
|
72677
|
+
spreadsheetId: new ParameterDefinition({
|
|
72678
|
+
slug: "spreadsheet-id",
|
|
72679
|
+
name: "Google Sheets Spreadsheet ID",
|
|
72680
|
+
description: "The spreadsheet ID from the Google Sheets URL (the segment between /d/ and /edit in https://docs.google.com/spreadsheets/d/{spreadsheetId}/edit). Collected during the setup flow.",
|
|
72681
|
+
envVarBaseKey: "GOOGLE_SHEETS_SPREADSHEET_ID",
|
|
72682
|
+
type: "text",
|
|
72683
|
+
secret: false,
|
|
72684
|
+
required: true
|
|
72685
|
+
})
|
|
72686
|
+
};
|
|
72687
|
+
|
|
72688
|
+
// ../connectors/src/connectors/google-sheets/tools/request.ts
|
|
72674
72689
|
var SHEETS_BASE_URL = "https://sheets.googleapis.com/v4/spreadsheets";
|
|
72675
72690
|
var REQUEST_TIMEOUT_MS17 = 6e4;
|
|
72676
72691
|
var cachedToken13 = null;
|
|
@@ -72745,7 +72760,15 @@ Authentication is handled automatically via OAuth proxy.`,
|
|
|
72745
72760
|
`[connector-request] google-sheets/${connection2.name}: ${method} ${path6}`
|
|
72746
72761
|
);
|
|
72747
72762
|
try {
|
|
72748
|
-
|
|
72763
|
+
const spreadsheetId = parameters18.spreadsheetId.tryGetValue(connection2);
|
|
72764
|
+
if (!spreadsheetId) {
|
|
72765
|
+
return {
|
|
72766
|
+
success: false,
|
|
72767
|
+
error: `Spreadsheet ID is not configured for connection "${connection2.name}". Ask the user for a Google Sheets URL and save it with updateConnectionParameters (parameterSlug: "spreadsheet-id") before calling this tool.`
|
|
72768
|
+
};
|
|
72769
|
+
}
|
|
72770
|
+
const resolvedPath = path6.replace(/\{spreadsheetId\}/g, spreadsheetId);
|
|
72771
|
+
let url = `${SHEETS_BASE_URL}${resolvedPath === "" || resolvedPath.startsWith("/") ? "" : "/"}${resolvedPath}`;
|
|
72749
72772
|
if (queryParams) {
|
|
72750
72773
|
const searchParams = new URLSearchParams(queryParams);
|
|
72751
72774
|
url += `?${searchParams.toString()}`;
|
|
@@ -72799,10 +72822,12 @@ var googleSheetsOnboarding = new ConnectorOnboarding({
|
|
|
72799
72822
|
- \`options\`: \`[{ value: <\u62BD\u51FA\u3057\u305FID>, label: <\u540C\u3058\u5024> }]\`\uFF081\u4EF6\u306E\u307F\u306E\u30AA\u30D7\u30B7\u30E7\u30F3\u306F\u81EA\u52D5\u9078\u629E\u3055\u308C\u308B\uFF09
|
|
72800
72823
|
4. \`${requestToolName}\` \u3067\u30B9\u30D7\u30EC\u30C3\u30C9\u30B7\u30FC\u30C8\u306B\u30A2\u30AF\u30BB\u30B9\u3067\u304D\u308B\u3053\u3068\u3092\u78BA\u8A8D\u3059\u308B:
|
|
72801
72824
|
- \`method\`: \`"GET"\`
|
|
72802
|
-
- \`path\`: \`"/{spreadsheetId}"\`
|
|
72803
|
-
5. \
|
|
72804
|
-
|
|
72805
|
-
|
|
72825
|
+
- \`path\`: \`"/{spreadsheetId}"\`\uFF08\`{spreadsheetId}\` \u306F\u30D7\u30EC\u30FC\u30B9\u30DB\u30EB\u30C0\u3002\u305D\u306E\u307E\u307E\u6E21\u305B\u3070\u4FDD\u5B58\u6E08\u307FID\u306B\u81EA\u52D5\u7F6E\u63DB\u3055\u308C\u307E\u3059\uFF09
|
|
72826
|
+
5. **\u691C\u8A3C\u5931\u6557\u6642\u306E\u518D\u30D2\u30A2\u30EA\u30F3\u30B0**: \u30B9\u30C6\u30C3\u30D74\u304C \`success: false\` \u3092\u8FD4\u3057\u305F\u5834\u5408\uFF08404/403/\u898B\u3064\u304B\u3089\u306A\u3044\u7B49\u3001\u3069\u3093\u306A\u30A8\u30E9\u30FC\u3067\u3082\uFF09\u3001\u4EE5\u4E0B\u306E\u624B\u9806\u3067\u518D\u8A66\u884C\u3059\u308B:
|
|
72827
|
+
a. \u30E6\u30FC\u30B6\u30FC\u306B\u539F\u56E0\u306E\u53EF\u80FD\u6027\u3092\u4F1D\u3048\u308B\uFF08\u4F8B: URL\u304C\u9593\u9055\u3063\u3066\u3044\u308B\u3001OAuth\u9023\u643A\u3057\u305FGoogle\u30A2\u30AB\u30A6\u30F3\u30C8\u306B\u95B2\u89A7\u6A29\u9650\u304C\u306A\u3044\u3001\u30D7\u30E9\u30A4\u30D9\u30FC\u30C8\u30B7\u30FC\u30C8\u3067\u5225\u30A2\u30AB\u30A6\u30F3\u30C8\u3068\u5171\u6709\u3055\u308C\u3066\u3044\u308B\uFF09
|
|
72828
|
+
b. \`askUserQuestion\` \u3067\u3082\u3046\u4E00\u5EA6URL\u3092\u805E\u304D\u76F4\u3059\uFF08\`type: "freeText"\`\u3001\`question: \u300C\u30A2\u30AF\u30BB\u30B9\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u3082\u3046\u4E00\u5EA6URL\u3092\u8CBC\u308A\u4ED8\u3051\u3066\u3044\u305F\u3060\u304F\u304B\u3001\u30B9\u30D7\u30EC\u30C3\u30C9\u30B7\u30FC\u30C8\u306E\u5171\u6709\u8A2D\u5B9A\u3092\u3054\u78BA\u8A8D\u304F\u3060\u3055\u3044\u300D\`\uFF09
|
|
72829
|
+
c. \u65B0\u3057\u304F\u53D7\u3051\u53D6\u3063\u305FURL\u304B\u3089ID\u3092\u62BD\u51FA\u3057 \`updateConnectionParameters\` \u3067\u4E0A\u66F8\u304D\u4FDD\u5B58\u3001\u518D\u5EA6 \`${requestToolName}\` \u3067\u691C\u8A3C
|
|
72830
|
+
d. \u6210\u529F\u3059\u308B\u307E\u3067\uFF08\u307E\u305F\u306F\u30E6\u30FC\u30B6\u30FC\u304C\u4E2D\u65AD\u3059\u308B\u307E\u3067\uFF09\u3053\u306E\u30EB\u30FC\u30D7\u3092\u7E70\u308A\u8FD4\u3059\u3002\u540C\u3058ID\u304C\u518D\u5EA6\u5931\u6557\u3059\u308B\u5834\u5408\u306F\u5171\u6709\u8A2D\u5B9A\u306E\u554F\u984C\u306A\u306E\u3067\u30E6\u30FC\u30B6\u30FC\u306B\u305D\u306E\u65E8\u3092\u4F1D\u3048\u3066\u5224\u65AD\u3092\u4EF0\u3050
|
|
72806
72831
|
|
|
72807
72832
|
#### \u5236\u7D04
|
|
72808
72833
|
- **\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u4E2D\u306B\u30BB\u30EB\u5024\u3092\u5927\u91CF\u306B\u53D6\u5F97\u3057\u306A\u3044\u3053\u3068**\u3002\u5B9F\u884C\u3057\u3066\u3088\u3044\u306E\u306F\u4E0A\u8A18\u624B\u9806\u3067\u6307\u5B9A\u3055\u308C\u305F\u30E1\u30BF\u30C7\u30FC\u30BF\u53D6\u5F97\u306E\u307F
|
|
@@ -72819,10 +72844,12 @@ var googleSheetsOnboarding = new ConnectorOnboarding({
|
|
|
72819
72844
|
- \`options\`: \`[{ value: <extracted ID>, label: <same value> }]\` (a single option is auto-selected)
|
|
72820
72845
|
4. Verify access by calling \`${requestToolName}\`:
|
|
72821
72846
|
- \`method\`: \`"GET"\`
|
|
72822
|
-
- \`path\`: \`"/{spreadsheetId}"\`
|
|
72823
|
-
5. If
|
|
72824
|
-
|
|
72825
|
-
-
|
|
72847
|
+
- \`path\`: \`"/{spreadsheetId}"\` (the \`{spreadsheetId}\` placeholder is auto-replaced with the saved ID \u2014 pass it as-is)
|
|
72848
|
+
5. **Retry on verification failure**: If step 4 returns \`success: false\` (404/403/not found or any other error):
|
|
72849
|
+
a. Tell the user the likely causes (wrong URL, OAuth-connected Google account lacks read access, private sheet shared with a different account, etc.)
|
|
72850
|
+
b. Call \`askUserQuestion\` to re-ask for the URL (\`type: "freeText"\`, \`question: "I could not access that sheet. Please paste the URL again, or verify the share settings of the spreadsheet."\`)
|
|
72851
|
+
c. Extract the ID from the new URL, overwrite it via \`updateConnectionParameters\`, and re-verify with \`${requestToolName}\`
|
|
72852
|
+
d. Repeat until verification succeeds (or the user aborts). If the same ID keeps failing, it is a sharing/permissions issue \u2014 inform the user and ask how to proceed
|
|
72826
72853
|
|
|
72827
72854
|
#### Constraints
|
|
72828
72855
|
- **Do NOT read large amounts of cell data during setup**. Only the metadata request specified above is allowed
|
|
@@ -72836,19 +72863,6 @@ var googleSheetsOnboarding = new ConnectorOnboarding({
|
|
|
72836
72863
|
}
|
|
72837
72864
|
});
|
|
72838
72865
|
|
|
72839
|
-
// ../connectors/src/connectors/google-sheets/parameters.ts
|
|
72840
|
-
var parameters18 = {
|
|
72841
|
-
spreadsheetId: new ParameterDefinition({
|
|
72842
|
-
slug: "spreadsheet-id",
|
|
72843
|
-
name: "Google Sheets Spreadsheet ID",
|
|
72844
|
-
description: "The spreadsheet ID from the Google Sheets URL (the segment between /d/ and /edit in https://docs.google.com/spreadsheets/d/{spreadsheetId}/edit). Collected during the setup flow.",
|
|
72845
|
-
envVarBaseKey: "GOOGLE_SHEETS_SPREADSHEET_ID",
|
|
72846
|
-
type: "text",
|
|
72847
|
-
secret: false,
|
|
72848
|
-
required: false
|
|
72849
|
-
})
|
|
72850
|
-
};
|
|
72851
|
-
|
|
72852
72866
|
// ../connectors/src/connectors/google-sheets/index.ts
|
|
72853
72867
|
var tools18 = { request: requestTool9 };
|
|
72854
72868
|
var googleSheetsConnector = new ConnectorPlugin({
|
package/dist/vite-plugin.js
CHANGED
|
@@ -72672,6 +72672,21 @@ await drive.updateFile("fileId123", {}, "newFolderId", "oldFolderId");
|
|
|
72672
72672
|
|
|
72673
72673
|
// ../connectors/src/connectors/google-sheets/tools/request.ts
|
|
72674
72674
|
import { z as z27 } from "zod";
|
|
72675
|
+
|
|
72676
|
+
// ../connectors/src/connectors/google-sheets/parameters.ts
|
|
72677
|
+
var parameters18 = {
|
|
72678
|
+
spreadsheetId: new ParameterDefinition({
|
|
72679
|
+
slug: "spreadsheet-id",
|
|
72680
|
+
name: "Google Sheets Spreadsheet ID",
|
|
72681
|
+
description: "The spreadsheet ID from the Google Sheets URL (the segment between /d/ and /edit in https://docs.google.com/spreadsheets/d/{spreadsheetId}/edit). Collected during the setup flow.",
|
|
72682
|
+
envVarBaseKey: "GOOGLE_SHEETS_SPREADSHEET_ID",
|
|
72683
|
+
type: "text",
|
|
72684
|
+
secret: false,
|
|
72685
|
+
required: true
|
|
72686
|
+
})
|
|
72687
|
+
};
|
|
72688
|
+
|
|
72689
|
+
// ../connectors/src/connectors/google-sheets/tools/request.ts
|
|
72675
72690
|
var SHEETS_BASE_URL = "https://sheets.googleapis.com/v4/spreadsheets";
|
|
72676
72691
|
var REQUEST_TIMEOUT_MS17 = 6e4;
|
|
72677
72692
|
var cachedToken13 = null;
|
|
@@ -72746,7 +72761,15 @@ Authentication is handled automatically via OAuth proxy.`,
|
|
|
72746
72761
|
`[connector-request] google-sheets/${connection.name}: ${method} ${path4}`
|
|
72747
72762
|
);
|
|
72748
72763
|
try {
|
|
72749
|
-
|
|
72764
|
+
const spreadsheetId = parameters18.spreadsheetId.tryGetValue(connection);
|
|
72765
|
+
if (!spreadsheetId) {
|
|
72766
|
+
return {
|
|
72767
|
+
success: false,
|
|
72768
|
+
error: `Spreadsheet ID is not configured for connection "${connection.name}". Ask the user for a Google Sheets URL and save it with updateConnectionParameters (parameterSlug: "spreadsheet-id") before calling this tool.`
|
|
72769
|
+
};
|
|
72770
|
+
}
|
|
72771
|
+
const resolvedPath = path4.replace(/\{spreadsheetId\}/g, spreadsheetId);
|
|
72772
|
+
let url = `${SHEETS_BASE_URL}${resolvedPath === "" || resolvedPath.startsWith("/") ? "" : "/"}${resolvedPath}`;
|
|
72750
72773
|
if (queryParams) {
|
|
72751
72774
|
const searchParams = new URLSearchParams(queryParams);
|
|
72752
72775
|
url += `?${searchParams.toString()}`;
|
|
@@ -72800,10 +72823,12 @@ var googleSheetsOnboarding = new ConnectorOnboarding({
|
|
|
72800
72823
|
- \`options\`: \`[{ value: <\u62BD\u51FA\u3057\u305FID>, label: <\u540C\u3058\u5024> }]\`\uFF081\u4EF6\u306E\u307F\u306E\u30AA\u30D7\u30B7\u30E7\u30F3\u306F\u81EA\u52D5\u9078\u629E\u3055\u308C\u308B\uFF09
|
|
72801
72824
|
4. \`${requestToolName}\` \u3067\u30B9\u30D7\u30EC\u30C3\u30C9\u30B7\u30FC\u30C8\u306B\u30A2\u30AF\u30BB\u30B9\u3067\u304D\u308B\u3053\u3068\u3092\u78BA\u8A8D\u3059\u308B:
|
|
72802
72825
|
- \`method\`: \`"GET"\`
|
|
72803
|
-
- \`path\`: \`"/{spreadsheetId}"\`
|
|
72804
|
-
5. \
|
|
72805
|
-
|
|
72806
|
-
|
|
72826
|
+
- \`path\`: \`"/{spreadsheetId}"\`\uFF08\`{spreadsheetId}\` \u306F\u30D7\u30EC\u30FC\u30B9\u30DB\u30EB\u30C0\u3002\u305D\u306E\u307E\u307E\u6E21\u305B\u3070\u4FDD\u5B58\u6E08\u307FID\u306B\u81EA\u52D5\u7F6E\u63DB\u3055\u308C\u307E\u3059\uFF09
|
|
72827
|
+
5. **\u691C\u8A3C\u5931\u6557\u6642\u306E\u518D\u30D2\u30A2\u30EA\u30F3\u30B0**: \u30B9\u30C6\u30C3\u30D74\u304C \`success: false\` \u3092\u8FD4\u3057\u305F\u5834\u5408\uFF08404/403/\u898B\u3064\u304B\u3089\u306A\u3044\u7B49\u3001\u3069\u3093\u306A\u30A8\u30E9\u30FC\u3067\u3082\uFF09\u3001\u4EE5\u4E0B\u306E\u624B\u9806\u3067\u518D\u8A66\u884C\u3059\u308B:
|
|
72828
|
+
a. \u30E6\u30FC\u30B6\u30FC\u306B\u539F\u56E0\u306E\u53EF\u80FD\u6027\u3092\u4F1D\u3048\u308B\uFF08\u4F8B: URL\u304C\u9593\u9055\u3063\u3066\u3044\u308B\u3001OAuth\u9023\u643A\u3057\u305FGoogle\u30A2\u30AB\u30A6\u30F3\u30C8\u306B\u95B2\u89A7\u6A29\u9650\u304C\u306A\u3044\u3001\u30D7\u30E9\u30A4\u30D9\u30FC\u30C8\u30B7\u30FC\u30C8\u3067\u5225\u30A2\u30AB\u30A6\u30F3\u30C8\u3068\u5171\u6709\u3055\u308C\u3066\u3044\u308B\uFF09
|
|
72829
|
+
b. \`askUserQuestion\` \u3067\u3082\u3046\u4E00\u5EA6URL\u3092\u805E\u304D\u76F4\u3059\uFF08\`type: "freeText"\`\u3001\`question: \u300C\u30A2\u30AF\u30BB\u30B9\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u3082\u3046\u4E00\u5EA6URL\u3092\u8CBC\u308A\u4ED8\u3051\u3066\u3044\u305F\u3060\u304F\u304B\u3001\u30B9\u30D7\u30EC\u30C3\u30C9\u30B7\u30FC\u30C8\u306E\u5171\u6709\u8A2D\u5B9A\u3092\u3054\u78BA\u8A8D\u304F\u3060\u3055\u3044\u300D\`\uFF09
|
|
72830
|
+
c. \u65B0\u3057\u304F\u53D7\u3051\u53D6\u3063\u305FURL\u304B\u3089ID\u3092\u62BD\u51FA\u3057 \`updateConnectionParameters\` \u3067\u4E0A\u66F8\u304D\u4FDD\u5B58\u3001\u518D\u5EA6 \`${requestToolName}\` \u3067\u691C\u8A3C
|
|
72831
|
+
d. \u6210\u529F\u3059\u308B\u307E\u3067\uFF08\u307E\u305F\u306F\u30E6\u30FC\u30B6\u30FC\u304C\u4E2D\u65AD\u3059\u308B\u307E\u3067\uFF09\u3053\u306E\u30EB\u30FC\u30D7\u3092\u7E70\u308A\u8FD4\u3059\u3002\u540C\u3058ID\u304C\u518D\u5EA6\u5931\u6557\u3059\u308B\u5834\u5408\u306F\u5171\u6709\u8A2D\u5B9A\u306E\u554F\u984C\u306A\u306E\u3067\u30E6\u30FC\u30B6\u30FC\u306B\u305D\u306E\u65E8\u3092\u4F1D\u3048\u3066\u5224\u65AD\u3092\u4EF0\u3050
|
|
72807
72832
|
|
|
72808
72833
|
#### \u5236\u7D04
|
|
72809
72834
|
- **\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u4E2D\u306B\u30BB\u30EB\u5024\u3092\u5927\u91CF\u306B\u53D6\u5F97\u3057\u306A\u3044\u3053\u3068**\u3002\u5B9F\u884C\u3057\u3066\u3088\u3044\u306E\u306F\u4E0A\u8A18\u624B\u9806\u3067\u6307\u5B9A\u3055\u308C\u305F\u30E1\u30BF\u30C7\u30FC\u30BF\u53D6\u5F97\u306E\u307F
|
|
@@ -72820,10 +72845,12 @@ var googleSheetsOnboarding = new ConnectorOnboarding({
|
|
|
72820
72845
|
- \`options\`: \`[{ value: <extracted ID>, label: <same value> }]\` (a single option is auto-selected)
|
|
72821
72846
|
4. Verify access by calling \`${requestToolName}\`:
|
|
72822
72847
|
- \`method\`: \`"GET"\`
|
|
72823
|
-
- \`path\`: \`"/{spreadsheetId}"\`
|
|
72824
|
-
5. If
|
|
72825
|
-
|
|
72826
|
-
-
|
|
72848
|
+
- \`path\`: \`"/{spreadsheetId}"\` (the \`{spreadsheetId}\` placeholder is auto-replaced with the saved ID \u2014 pass it as-is)
|
|
72849
|
+
5. **Retry on verification failure**: If step 4 returns \`success: false\` (404/403/not found or any other error):
|
|
72850
|
+
a. Tell the user the likely causes (wrong URL, OAuth-connected Google account lacks read access, private sheet shared with a different account, etc.)
|
|
72851
|
+
b. Call \`askUserQuestion\` to re-ask for the URL (\`type: "freeText"\`, \`question: "I could not access that sheet. Please paste the URL again, or verify the share settings of the spreadsheet."\`)
|
|
72852
|
+
c. Extract the ID from the new URL, overwrite it via \`updateConnectionParameters\`, and re-verify with \`${requestToolName}\`
|
|
72853
|
+
d. Repeat until verification succeeds (or the user aborts). If the same ID keeps failing, it is a sharing/permissions issue \u2014 inform the user and ask how to proceed
|
|
72827
72854
|
|
|
72828
72855
|
#### Constraints
|
|
72829
72856
|
- **Do NOT read large amounts of cell data during setup**. Only the metadata request specified above is allowed
|
|
@@ -72837,19 +72864,6 @@ var googleSheetsOnboarding = new ConnectorOnboarding({
|
|
|
72837
72864
|
}
|
|
72838
72865
|
});
|
|
72839
72866
|
|
|
72840
|
-
// ../connectors/src/connectors/google-sheets/parameters.ts
|
|
72841
|
-
var parameters18 = {
|
|
72842
|
-
spreadsheetId: new ParameterDefinition({
|
|
72843
|
-
slug: "spreadsheet-id",
|
|
72844
|
-
name: "Google Sheets Spreadsheet ID",
|
|
72845
|
-
description: "The spreadsheet ID from the Google Sheets URL (the segment between /d/ and /edit in https://docs.google.com/spreadsheets/d/{spreadsheetId}/edit). Collected during the setup flow.",
|
|
72846
|
-
envVarBaseKey: "GOOGLE_SHEETS_SPREADSHEET_ID",
|
|
72847
|
-
type: "text",
|
|
72848
|
-
secret: false,
|
|
72849
|
-
required: false
|
|
72850
|
-
})
|
|
72851
|
-
};
|
|
72852
|
-
|
|
72853
72867
|
// ../connectors/src/connectors/google-sheets/index.ts
|
|
72854
72868
|
var tools18 = { request: requestTool9 };
|
|
72855
72869
|
var googleSheetsConnector = new ConnectorPlugin({
|