@squadbase/vite-server 0.1.17 → 0.1.19-dev.a00d9c3
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 +5961 -2986
- package/dist/connectors/airtable-oauth.js +39 -15
- package/dist/connectors/airtable.js +86 -15
- package/dist/connectors/amplitude.js +39 -15
- package/dist/connectors/anthropic.js +39 -15
- package/dist/connectors/asana.js +39 -15
- package/dist/connectors/attio.js +39 -15
- package/dist/connectors/aws-billing.js +39 -15
- package/dist/connectors/azure-sql.js +291 -18
- package/dist/connectors/backlog-api-key.js +39 -15
- package/dist/connectors/clickup.js +39 -15
- package/dist/connectors/cosmosdb.js +39 -15
- package/dist/connectors/customerio.js +39 -15
- package/dist/connectors/dbt.js +39 -15
- package/dist/connectors/freshdesk.js +39 -15
- package/dist/connectors/freshsales.js +39 -15
- package/dist/connectors/freshservice.js +39 -15
- package/dist/connectors/gamma.js +39 -15
- package/dist/connectors/gemini.js +39 -15
- package/dist/connectors/github.js +39 -15
- package/dist/connectors/gmail-oauth.js +32 -13
- package/dist/connectors/gmail.js +39 -15
- package/dist/connectors/google-ads.js +39 -15
- package/dist/connectors/google-analytics-oauth.js +40 -16
- package/dist/connectors/google-analytics.js +39 -15
- package/dist/connectors/google-audit-log.js +39 -15
- package/dist/connectors/google-calendar-oauth.js +40 -16
- package/dist/connectors/google-calendar.js +39 -15
- package/dist/connectors/google-docs.js +32 -13
- package/dist/connectors/google-drive.js +32 -13
- package/dist/connectors/google-search-console-oauth.js +39 -15
- package/dist/connectors/google-sheets.js +138 -195
- package/dist/connectors/google-slides.js +32 -13
- package/dist/connectors/grafana.js +39 -15
- package/dist/connectors/hackernews.d.ts +5 -0
- package/dist/connectors/hackernews.js +909 -0
- package/dist/connectors/hubspot-oauth.js +32 -13
- package/dist/connectors/hubspot.js +39 -15
- package/dist/connectors/influxdb.js +39 -15
- package/dist/connectors/intercom-oauth.js +32 -13
- package/dist/connectors/intercom.js +39 -15
- package/dist/connectors/jdbc.js +70 -19
- package/dist/connectors/jira-api-key.js +39 -15
- package/dist/connectors/kintone-api-token.js +39 -15
- package/dist/connectors/kintone.js +128 -15
- package/dist/connectors/linear.js +39 -15
- package/dist/connectors/linkedin-ads.js +39 -15
- package/dist/connectors/mailchimp-oauth.js +39 -15
- package/dist/connectors/mailchimp.js +39 -15
- package/dist/connectors/meta-ads-oauth.js +39 -15
- package/dist/connectors/meta-ads.js +39 -15
- package/dist/connectors/mixpanel.js +39 -15
- package/dist/connectors/monday.js +39 -15
- package/dist/connectors/mongodb.js +39 -15
- package/dist/connectors/notion-oauth.js +32 -13
- package/dist/connectors/notion.js +84 -15
- package/dist/connectors/openai.js +39 -15
- package/dist/connectors/oracle.js +293 -19
- package/dist/connectors/outlook-oauth.js +33 -14
- package/dist/connectors/powerbi-oauth.js +33 -14
- package/dist/connectors/salesforce.js +108 -15
- package/dist/connectors/semrush.js +39 -15
- package/dist/connectors/sentry.js +39 -15
- package/dist/connectors/shopify-oauth.js +32 -13
- package/dist/connectors/shopify.js +39 -15
- package/dist/connectors/slack.d.ts +5 -0
- package/dist/connectors/slack.js +656 -0
- package/dist/connectors/sqlserver.js +291 -18
- package/dist/connectors/stripe-api-key.js +39 -15
- package/dist/connectors/stripe-oauth.js +32 -13
- package/dist/connectors/supabase.js +293 -16
- package/dist/connectors/tableau.js +40 -16
- package/dist/connectors/tiktok-ads.js +39 -15
- package/dist/connectors/wix-store.js +39 -15
- package/dist/connectors/x.d.ts +5 -0
- package/dist/connectors/x.js +951 -0
- package/dist/connectors/zendesk-oauth.js +32 -13
- package/dist/connectors/zendesk.js +39 -15
- package/dist/index.js +6425 -3397
- package/dist/main.js +6425 -3397
- package/dist/vite-plugin.js +5965 -2987
- package/package.json +13 -4
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
2
|
-
var __esm = (fn, res) => function __init() {
|
|
3
|
-
|
|
2
|
+
var __esm = (fn, res, err) => function __init() {
|
|
3
|
+
if (err) throw err[0];
|
|
4
|
+
try {
|
|
5
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
6
|
+
} catch (e) {
|
|
7
|
+
throw err = [e], e;
|
|
8
|
+
}
|
|
4
9
|
};
|
|
5
10
|
|
|
6
11
|
// ../connectors/src/parameter-definition.ts
|
|
@@ -62,6 +67,12 @@ function createClient(_params, fetchFn = fetch) {
|
|
|
62
67
|
return `${SHEETS_BASE_URL}${path2 === "" || path2.startsWith("/") ? "" : "/"}${path2}`;
|
|
63
68
|
}
|
|
64
69
|
async function request(path2, init) {
|
|
70
|
+
const method = (init?.method ?? "GET").toUpperCase();
|
|
71
|
+
if (method !== "GET") {
|
|
72
|
+
throw new Error(
|
|
73
|
+
"google-sheets: this connector is read-only; only GET requests are supported"
|
|
74
|
+
);
|
|
75
|
+
}
|
|
65
76
|
return fetchFn(buildUrl(path2), init);
|
|
66
77
|
}
|
|
67
78
|
async function asJson(response, operation) {
|
|
@@ -89,51 +100,11 @@ function createClient(_params, fetchFn = fetch) {
|
|
|
89
100
|
const url = `${SHEETS_BASE_URL}/${spreadsheetId}/values:batchGet?${searchParams.toString()}`;
|
|
90
101
|
return asJson(await fetchFn(url), "batchGetValues");
|
|
91
102
|
}
|
|
92
|
-
async function updateValues(spreadsheetId, range, values, valueInputOption = "USER_ENTERED") {
|
|
93
|
-
const url = `${SHEETS_BASE_URL}/${spreadsheetId}/values/${encodeURIComponent(range)}?valueInputOption=${valueInputOption}`;
|
|
94
|
-
const response = await fetchFn(url, {
|
|
95
|
-
method: "PUT",
|
|
96
|
-
headers: { "Content-Type": "application/json" },
|
|
97
|
-
body: JSON.stringify({ range, majorDimension: "ROWS", values })
|
|
98
|
-
});
|
|
99
|
-
return asJson(response, "updateValues");
|
|
100
|
-
}
|
|
101
|
-
async function appendValues(spreadsheetId, range, values, valueInputOption = "USER_ENTERED") {
|
|
102
|
-
const url = `${SHEETS_BASE_URL}/${spreadsheetId}/values/${encodeURIComponent(range)}:append?valueInputOption=${valueInputOption}`;
|
|
103
|
-
const response = await fetchFn(url, {
|
|
104
|
-
method: "POST",
|
|
105
|
-
headers: { "Content-Type": "application/json" },
|
|
106
|
-
body: JSON.stringify({ range, majorDimension: "ROWS", values })
|
|
107
|
-
});
|
|
108
|
-
return asJson(response, "appendValues");
|
|
109
|
-
}
|
|
110
|
-
async function clearValues(spreadsheetId, range) {
|
|
111
|
-
const url = `${SHEETS_BASE_URL}/${spreadsheetId}/values/${encodeURIComponent(range)}:clear`;
|
|
112
|
-
const response = await fetchFn(url, {
|
|
113
|
-
method: "POST",
|
|
114
|
-
headers: { "Content-Type": "application/json" },
|
|
115
|
-
body: JSON.stringify({})
|
|
116
|
-
});
|
|
117
|
-
return asJson(response, "clearValues");
|
|
118
|
-
}
|
|
119
|
-
async function batchUpdate(spreadsheetId, requests) {
|
|
120
|
-
const url = `${SHEETS_BASE_URL}/${spreadsheetId}:batchUpdate`;
|
|
121
|
-
const response = await fetchFn(url, {
|
|
122
|
-
method: "POST",
|
|
123
|
-
headers: { "Content-Type": "application/json" },
|
|
124
|
-
body: JSON.stringify({ requests })
|
|
125
|
-
});
|
|
126
|
-
return asJson(response, "batchUpdate");
|
|
127
|
-
}
|
|
128
103
|
return {
|
|
129
104
|
request,
|
|
130
105
|
getSpreadsheet,
|
|
131
106
|
getValues,
|
|
132
|
-
batchGetValues
|
|
133
|
-
updateValues,
|
|
134
|
-
appendValues,
|
|
135
|
-
clearValues,
|
|
136
|
-
batchUpdate
|
|
107
|
+
batchGetValues
|
|
137
108
|
};
|
|
138
109
|
}
|
|
139
110
|
|
|
@@ -204,6 +175,15 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
204
175
|
* `runSetupFlow` from `setup-flow.ts`.
|
|
205
176
|
*/
|
|
206
177
|
setup;
|
|
178
|
+
/**
|
|
179
|
+
* 統一 introspection。SQL DB の `information_schema` / `SHOW` / `DESCRIBE` や SaaS の
|
|
180
|
+
* メタデータ API といった取得経路の差を吸収し、tables / columns / PK / FK を共通型
|
|
181
|
+
* {@link IntrospectedSchema} へ正規化して返す。取得経路は {@link IntrospectContext} で
|
|
182
|
+
* 抽象化され、SQL DB は `ctx.query`、SaaS は `ctx.proxyFetch` + `ctx.params` を使う。
|
|
183
|
+
* `ctx.profile === true` のときは L2 プロファイル(行数・NULL 率等)も best-effort で埋める。
|
|
184
|
+
* coding-agent の `DataContextIndex` がデータ地図を構築する際に使う。
|
|
185
|
+
*/
|
|
186
|
+
introspect;
|
|
207
187
|
/**
|
|
208
188
|
* Opt-out of the default "verify before save" behavior on connection
|
|
209
189
|
* creation. The backend invokes `checkConnection` synchronously while
|
|
@@ -218,6 +198,14 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
218
198
|
* the default verify-on-create behavior without opt-in.
|
|
219
199
|
*/
|
|
220
200
|
skipConnectionCheckOnCreate;
|
|
201
|
+
/**
|
|
202
|
+
* 決定論的な「立ち上げ survey」レシピ(ルールベース prewarm 基盤)。実装した connector は、LLM を使わずに
|
|
203
|
+
* read-only で自分を survey する probe 列(テーブル/列メタデータ → 小サンプル)を宣言する。coding-agent の
|
|
204
|
+
* recon driver がこれを読み、connector ツールの `execute` を直接呼んで結果を seed にする。未実装の connector は
|
|
205
|
+
* driver 側で safely skip される(その connection は listConnections のみ seed)。標準 `information_schema` を
|
|
206
|
+
* 持つ SQL connector は `makeStandardSqlSurveyProbes` を使える。**probe は必ず read-only**。
|
|
207
|
+
*/
|
|
208
|
+
surveyProbes;
|
|
221
209
|
constructor(config) {
|
|
222
210
|
this.slug = config.slug;
|
|
223
211
|
this.authType = config.authType;
|
|
@@ -235,7 +223,9 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
235
223
|
this.query = config.query;
|
|
236
224
|
this.checkConnection = config.checkConnection;
|
|
237
225
|
this.setup = config.setup;
|
|
226
|
+
this.introspect = config.introspect;
|
|
238
227
|
this.skipConnectionCheckOnCreate = config.skipConnectionCheckOnCreate;
|
|
228
|
+
this.surveyProbes = config.surveyProbes;
|
|
239
229
|
}
|
|
240
230
|
get connectorKey() {
|
|
241
231
|
return _ConnectorPlugin.deriveKey(this.slug, this.authType);
|
|
@@ -273,25 +263,25 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
273
263
|
if (authType) return `${slug}-${authType}`;
|
|
274
264
|
const LEGACY_NULL_AUTH_TYPE_MAP = {
|
|
275
265
|
// user-password
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
266
|
+
postgresql: "user-password",
|
|
267
|
+
mysql: "user-password",
|
|
268
|
+
clickhouse: "user-password",
|
|
269
|
+
kintone: "user-password",
|
|
280
270
|
"squadbase-db": "user-password",
|
|
281
271
|
// service-account
|
|
282
|
-
|
|
283
|
-
|
|
272
|
+
snowflake: "service-account",
|
|
273
|
+
bigquery: "service-account",
|
|
284
274
|
"google-analytics": "service-account",
|
|
285
275
|
"google-calendar": "service-account",
|
|
286
276
|
"aws-athena": "service-account",
|
|
287
|
-
|
|
277
|
+
redshift: "service-account",
|
|
288
278
|
// api-key
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
279
|
+
databricks: "api-key",
|
|
280
|
+
dbt: "api-key",
|
|
281
|
+
airtable: "api-key",
|
|
282
|
+
openai: "api-key",
|
|
283
|
+
gemini: "api-key",
|
|
284
|
+
anthropic: "api-key",
|
|
295
285
|
"wix-store": "api-key"
|
|
296
286
|
};
|
|
297
287
|
const fallbackAuthType = LEGACY_NULL_AUTH_TYPE_MAP[slug];
|
|
@@ -364,11 +354,6 @@ async function runSetupFlow(flow, params, ctx, config) {
|
|
|
364
354
|
}
|
|
365
355
|
};
|
|
366
356
|
}
|
|
367
|
-
async function resolveSetupSelection(params) {
|
|
368
|
-
const { selected, allSentinel, fetchAll, limit } = params;
|
|
369
|
-
const resolved = selected.includes(allSentinel) ? await fetchAll() : selected.filter((v) => v !== allSentinel);
|
|
370
|
-
return resolved.slice(0, limit);
|
|
371
|
-
}
|
|
372
357
|
|
|
373
358
|
// ../connectors/src/auth-types.ts
|
|
374
359
|
var AUTH_TYPES = {
|
|
@@ -432,16 +417,13 @@ var inputSchema = z.object({
|
|
|
432
417
|
"Brief description of what you intend to accomplish with this tool call"
|
|
433
418
|
),
|
|
434
419
|
connectionId: z.string().describe("ID of the Google Sheets connection to use"),
|
|
435
|
-
method: z.enum(["GET"
|
|
436
|
-
"HTTP method.
|
|
420
|
+
method: z.enum(["GET"]).describe(
|
|
421
|
+
"HTTP method. Read-only: only GET is supported (e.g., spreadsheets.get, values.get, values:batchGet)."
|
|
437
422
|
),
|
|
438
423
|
path: z.string().describe(
|
|
439
424
|
"API path appended to https://sheets.googleapis.com/v4/spreadsheets. The caller must provide the target spreadsheetId explicitly in the path (e.g., '/1AbCxyz...', '/1AbCxyz.../values/Sheet1!A1:D10')."
|
|
440
425
|
),
|
|
441
|
-
queryParams: z.record(z.string(), z.string()).optional().describe("Query parameters to append to the URL")
|
|
442
|
-
body: z.unknown().optional().describe(
|
|
443
|
-
"Request body for POST/PUT. Will be JSON-serialized. Omit for GET."
|
|
444
|
-
)
|
|
426
|
+
queryParams: z.record(z.string(), z.string()).optional().describe("Query parameters to append to the URL")
|
|
445
427
|
});
|
|
446
428
|
var outputSchema = z.discriminatedUnion("success", [
|
|
447
429
|
z.object({
|
|
@@ -456,13 +438,13 @@ var outputSchema = z.discriminatedUnion("success", [
|
|
|
456
438
|
]);
|
|
457
439
|
var requestTool = new ConnectorTool({
|
|
458
440
|
name: "request",
|
|
459
|
-
description: `Send authenticated requests to the Google Sheets API v4.
|
|
460
|
-
Supports GET (read
|
|
441
|
+
description: `Send authenticated read-only requests to the Google Sheets API v4.
|
|
442
|
+
Supports GET only (read: spreadsheets.get / values.get / values:batchGet).
|
|
461
443
|
The caller must include the target spreadsheetId in the path explicitly.
|
|
462
444
|
Authentication is handled automatically via OAuth proxy.`,
|
|
463
445
|
inputSchema,
|
|
464
446
|
outputSchema,
|
|
465
|
-
async execute({ connectionId, method, path: path2, queryParams
|
|
447
|
+
async execute({ connectionId, method, path: path2, queryParams }, connections, config) {
|
|
466
448
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
467
449
|
if (!connection2) {
|
|
468
450
|
return {
|
|
@@ -489,9 +471,6 @@ Authentication is handled automatically via OAuth proxy.`,
|
|
|
489
471
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS);
|
|
490
472
|
try {
|
|
491
473
|
const proxyBody = { url, method };
|
|
492
|
-
if (body !== void 0 && method !== "GET") {
|
|
493
|
-
proxyBody.body = body;
|
|
494
|
-
}
|
|
495
474
|
const response = await fetch(proxyUrl, {
|
|
496
475
|
method: "POST",
|
|
497
476
|
headers: {
|
|
@@ -521,11 +500,11 @@ Authentication is handled automatically via OAuth proxy.`,
|
|
|
521
500
|
var requestToolName = `google-sheets-oauth_${requestTool.name}`;
|
|
522
501
|
var googleSheetsOnboarding = new ConnectorOnboarding({
|
|
523
502
|
connectionSetupInstructions: {
|
|
524
|
-
ja: `\u4EE5\u4E0B\u306E\u624B\u9806\u3067Google Sheets (OAuth) \u30B3\u30CD\u30AF\u30B7\u30E7\u30F3\u306E\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u3092\u884C\u3063\u3066\u304F\u3060\u3055\u3044\u3002\u3053\u306E\u30B3\u30CD\u30AF\u30BF\u306F\u8AAD\u307F\
|
|
503
|
+
ja: `\u4EE5\u4E0B\u306E\u624B\u9806\u3067Google Sheets (OAuth) \u30B3\u30CD\u30AF\u30B7\u30E7\u30F3\u306E\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u3092\u884C\u3063\u3066\u304F\u3060\u3055\u3044\u3002\u3053\u306E\u30B3\u30CD\u30AF\u30BF\u306F\u8AAD\u307F\u53D6\u308A\u5C02\u7528\u30B9\u30B3\u30FC\u30D7 (\`spreadsheets.readonly\`) \u3067\u63A5\u7D9A\u3055\u308C\u3001OAuth\u8A8D\u8A3C\u3057\u305FGoogle\u30A2\u30AB\u30A6\u30F3\u30C8\u304C\u6A29\u9650\u3092\u6301\u3064\u4EFB\u610F\u306E\u30B9\u30D7\u30EC\u30C3\u30C9\u30B7\u30FC\u30C8\u3092\u8AAD\u307F\u53D6\u308C\u307E\u3059\u3002
|
|
525
504
|
|
|
526
|
-
1. \`askUserQuestion\` \u3067\
|
|
505
|
+
1. \`askUserQuestion\` \u3067\u5BFE\u8C61\u306E\u30B9\u30D7\u30EC\u30C3\u30C9\u30B7\u30FC\u30C8URL\u3092\u30D2\u30A2\u30EA\u30F3\u30B0\u3059\u308B:
|
|
527
506
|
- \`type\`: \`"freeText"\`
|
|
528
|
-
- \`question\`: \u300C\
|
|
507
|
+
- \`question\`: \u300C\u8AAD\u307F\u53D6\u308A\u305F\u3044Google Sheets\u306EURL\u3092\u8CBC\u308A\u4ED8\u3051\u3066\u304F\u3060\u3055\u3044\u300D
|
|
529
508
|
- \`placeholder\`: \`"https://docs.google.com/spreadsheets/d/.../edit"\`
|
|
530
509
|
2. \u53D7\u3051\u53D6\u3063\u305FURL\u304B\u3089\u30B9\u30D7\u30EC\u30C3\u30C9\u30B7\u30FC\u30C8ID\u3092\u62BD\u51FA\u3059\u308B\u3002URL\u306E \`/d/\` \u3068 \`/edit\`\uFF08\u307E\u305F\u306F\u672B\u5C3E\uFF09\u306E\u9593\u306B\u3042\u308B\u6587\u5B57\u5217\u304C\u30B9\u30D7\u30EC\u30C3\u30C9\u30B7\u30FC\u30C8ID\u3067\u3059\uFF08\u4F8B: \`https://docs.google.com/spreadsheets/d/1AbCxyz.../edit\` \u2192 \`1AbCxyz...\`\uFF09\u3002URL\u3067\u306F\u306A\u304FID\u3060\u3051\u304C\u6E21\u3055\u308C\u305F\u5834\u5408\u306F\u305D\u306E\u307E\u307E\u5229\u7528\u3057\u307E\u3059\u3002
|
|
531
510
|
3. \`${requestToolName}\` \u3067\u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u6027\u3092\u78BA\u8A8D\u3059\u308B:
|
|
@@ -540,11 +519,11 @@ var googleSheetsOnboarding = new ConnectorOnboarding({
|
|
|
540
519
|
- **\u63A5\u7D9A\u8A2D\u5B9A\u4E2D\u306F\u5927\u91CF\u306E\u30BB\u30EB\u5024\u3092\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
|
|
541
520
|
- **\u30B9\u30D7\u30EC\u30C3\u30C9\u30B7\u30FC\u30C8ID\u3092\u30B3\u30CD\u30AF\u30B7\u30E7\u30F3\u30D1\u30E9\u30E1\u30FC\u30BF\u3068\u3057\u3066\u4FDD\u5B58\u3057\u306A\u3044**\u3002\u30CF\u30F3\u30C9\u30E9\u5074\u306E\u30B3\u30FC\u30C9\uFF08\`server-logic\`\uFF09\u306B\u5BFE\u8C61\u30B9\u30D7\u30EC\u30C3\u30C9\u30B7\u30FC\u30C8ID\u3092\u76F4\u63A5\u6E21\u3059\u8A2D\u8A08\u306B\u306A\u3063\u3066\u3044\u308B\u305F\u3081\u3001\`updateConnectionParameters\` \u306F\u547C\u3070\u306A\u3044\u3053\u3068
|
|
542
521
|
- \u30C4\u30FC\u30EB\u9593\u306F1\u6587\u3060\u3051\u66F8\u3044\u3066\u5373\u6B21\u306E\u30C4\u30FC\u30EB\u547C\u3073\u51FA\u3057\u3002\u4E0D\u8981\u306A\u8AAC\u660E\u306F\u7701\u7565\u3057\u3001\u52B9\u7387\u7684\u306B\u9032\u3081\u308B`,
|
|
543
|
-
en: `Follow these steps to set up the Google Sheets (OAuth) connection. This connector uses the read
|
|
522
|
+
en: `Follow these steps to set up the Google Sheets (OAuth) connection. This connector uses the read-only \`spreadsheets.readonly\` scope, so it can read any spreadsheet the authenticated Google account has access to.
|
|
544
523
|
|
|
545
|
-
1. Call \`askUserQuestion\` to ask for the spreadsheet URL the user wants to
|
|
524
|
+
1. Call \`askUserQuestion\` to ask for the spreadsheet URL the user wants to read:
|
|
546
525
|
- \`type\`: \`"freeText"\`
|
|
547
|
-
- \`question\`: "Please paste the URL of the Google Sheet you want to
|
|
526
|
+
- \`question\`: "Please paste the URL of the Google Sheet you want to read."
|
|
548
527
|
- \`placeholder\`: \`"https://docs.google.com/spreadsheets/d/.../edit"\`
|
|
549
528
|
2. Extract the spreadsheet ID from the URL. It is the segment between \`/d/\` and \`/edit\` (or the end of the URL), e.g. \`https://docs.google.com/spreadsheets/d/1AbCxyz.../edit\` \u2192 \`1AbCxyz...\`. If the user pasted just the ID, use it as-is.
|
|
550
529
|
3. Verify accessibility by calling \`${requestToolName}\`:
|
|
@@ -579,87 +558,89 @@ async function googleApiFetch(config, url) {
|
|
|
579
558
|
}
|
|
580
559
|
|
|
581
560
|
// ../connectors/src/connectors/google-sheets/setup-flow.ts
|
|
582
|
-
var ALL_SPREADSHEETS = "__ALL_SPREADSHEETS__";
|
|
583
561
|
var GOOGLE_SHEETS_SETUP_MAX_SPREADSHEETS = 10;
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
);
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
562
|
+
function extractSpreadsheetId(raw) {
|
|
563
|
+
const input = raw.trim();
|
|
564
|
+
if (input === "") return null;
|
|
565
|
+
const dMatch = input.match(/\/d\/([a-zA-Z0-9-_]+)/);
|
|
566
|
+
if (dMatch?.[1]) return dMatch[1];
|
|
567
|
+
if (/^[a-zA-Z0-9-_]+$/.test(input)) return input;
|
|
568
|
+
return null;
|
|
569
|
+
}
|
|
570
|
+
function parseSpreadsheetIds(answer) {
|
|
571
|
+
const ids = [];
|
|
572
|
+
const seen = /* @__PURE__ */ new Set();
|
|
573
|
+
for (const entry of answer) {
|
|
574
|
+
for (const token of entry.split(/[\s,]+/)) {
|
|
575
|
+
const id = extractSpreadsheetId(token);
|
|
576
|
+
if (id && !seen.has(id)) {
|
|
577
|
+
seen.add(id);
|
|
578
|
+
ids.push(id);
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
return ids.slice(0, GOOGLE_SHEETS_SETUP_MAX_SPREADSHEETS);
|
|
583
|
+
}
|
|
584
|
+
function escapeMarkdownTableCell(value) {
|
|
585
|
+
return value.replace(/\|/g, "\\|").replace(/\r?\n/g, " ");
|
|
592
586
|
}
|
|
593
587
|
var googleSheetsSetupFlow = {
|
|
594
588
|
initialState: () => ({}),
|
|
595
589
|
steps: [
|
|
596
590
|
{
|
|
597
591
|
slug: "spreadsheets",
|
|
598
|
-
type: "
|
|
592
|
+
type: "text",
|
|
599
593
|
question: {
|
|
600
|
-
ja: "\u5BFE\u8C61\u306E\u30B9\u30D7\u30EC\u30C3\u30C9\u30B7\u30FC\u30C8\u3092\
|
|
601
|
-
en: "
|
|
602
|
-
},
|
|
603
|
-
async fetchOptions(_state, rt) {
|
|
604
|
-
const files = await listSpreadsheets(rt.config);
|
|
605
|
-
const fileOptions = files.map((f) => ({
|
|
606
|
-
value: f.id,
|
|
607
|
-
label: f.name
|
|
608
|
-
}));
|
|
609
|
-
return [
|
|
610
|
-
{
|
|
611
|
-
value: ALL_SPREADSHEETS,
|
|
612
|
-
label: rt.language === "ja" ? "\u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u306A\u3059\u3079\u3066\u306E\u30B9\u30D7\u30EC\u30C3\u30C9\u30B7\u30FC\u30C8" : "All accessible spreadsheets"
|
|
613
|
-
},
|
|
614
|
-
...fileOptions
|
|
615
|
-
];
|
|
594
|
+
ja: "\u5BFE\u8C61\u306E\u30B9\u30D7\u30EC\u30C3\u30C9\u30B7\u30FC\u30C8\u306EURL\uFF08\u307E\u305F\u306FID\uFF09\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u8907\u6570\u3042\u308B\u5834\u5408\u306F\u6539\u884C\u307E\u305F\u306F\u30AB\u30F3\u30DE\u533A\u5207\u308A\u3067\u5165\u529B\u3067\u304D\u307E\u3059\u3002",
|
|
595
|
+
en: "Enter the URL (or ID) of the target spreadsheet(s). To specify multiple, separate them with a newline or comma."
|
|
616
596
|
},
|
|
617
|
-
applyAnswer: (state, answer) => ({
|
|
597
|
+
applyAnswer: (state, answer) => ({
|
|
598
|
+
...state,
|
|
599
|
+
spreadsheetIds: parseSpreadsheetIds(answer)
|
|
600
|
+
})
|
|
618
601
|
}
|
|
619
602
|
],
|
|
620
603
|
async finalize(state, rt) {
|
|
621
|
-
|
|
622
|
-
throw new Error("Google Sheets setup: incomplete state on finalize");
|
|
623
|
-
}
|
|
624
|
-
const targetIds = await resolveSetupSelection({
|
|
625
|
-
selected: state.spreadsheets,
|
|
626
|
-
allSentinel: ALL_SPREADSHEETS,
|
|
627
|
-
fetchAll: async () => {
|
|
628
|
-
const files = await listSpreadsheets(rt.config);
|
|
629
|
-
return files.map((f) => f.id);
|
|
630
|
-
},
|
|
631
|
-
limit: GOOGLE_SHEETS_SETUP_MAX_SPREADSHEETS
|
|
632
|
-
});
|
|
633
|
-
const sections = ["## Google Sheets", ""];
|
|
604
|
+
const targetIds = state.spreadsheetIds ?? [];
|
|
634
605
|
if (targetIds.length === 0) {
|
|
635
|
-
|
|
636
|
-
rt.language === "ja" ? "\
|
|
606
|
+
throw new Error(
|
|
607
|
+
rt.language === "ja" ? "\u6709\u52B9\u306A\u30B9\u30D7\u30EC\u30C3\u30C9\u30B7\u30FC\u30C8\u306EURL\u307E\u305F\u306FID\u3092\u8A8D\u8B58\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002Google Sheets\u306EURL\uFF08\u4F8B: https://docs.google.com/spreadsheets/d/.../edit\uFF09\u3092\u78BA\u8A8D\u3057\u3066\u5165\u529B\u3057\u76F4\u3057\u3066\u304F\u3060\u3055\u3044\u3002" : "Could not recognize any valid spreadsheet URL or ID. Please re-enter a Google Sheets URL (e.g., https://docs.google.com/spreadsheets/d/.../edit)."
|
|
637
608
|
);
|
|
638
|
-
return sections.join("\n");
|
|
639
609
|
}
|
|
610
|
+
const sections = ["## Google Sheets", ""];
|
|
640
611
|
for (const id of targetIds) {
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
const
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
612
|
+
try {
|
|
613
|
+
const url = `https://sheets.googleapis.com/v4/spreadsheets/${encodeURIComponent(id)}?fields=spreadsheetId,properties(title),sheets(properties(title,sheetId,gridProperties))`;
|
|
614
|
+
const meta = await googleApiFetch(
|
|
615
|
+
rt.config,
|
|
616
|
+
url
|
|
617
|
+
);
|
|
618
|
+
const title = escapeMarkdownTableCell(meta.properties?.title ?? id);
|
|
619
|
+
sections.push(`### Spreadsheet: ${title}`, "", `- ID: ${id}`, "");
|
|
620
|
+
const sheets = meta.sheets ?? [];
|
|
621
|
+
if (sheets.length === 0) {
|
|
622
|
+
sections.push("- (no sheet tabs)", "");
|
|
623
|
+
continue;
|
|
624
|
+
}
|
|
625
|
+
sections.push("| Sheet | Rows | Columns |");
|
|
626
|
+
sections.push("|-------|------|---------|");
|
|
627
|
+
for (const s of sheets) {
|
|
628
|
+
const p = s.properties ?? {};
|
|
629
|
+
const sheetTitle = escapeMarkdownTableCell(p.title ?? "(untitled)");
|
|
630
|
+
const rows = p.gridProperties?.rowCount ?? "-";
|
|
631
|
+
const cols = p.gridProperties?.columnCount ?? "-";
|
|
632
|
+
sections.push(`| ${sheetTitle} | ${rows} | ${cols} |`);
|
|
633
|
+
}
|
|
634
|
+
sections.push("");
|
|
635
|
+
} catch (err) {
|
|
636
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
637
|
+
sections.push(
|
|
638
|
+
`### Spreadsheet: ${id}`,
|
|
639
|
+
"",
|
|
640
|
+
rt.language === "ja" ? `- \u53D6\u5F97\u306B\u5931\u6557\u3057\u307E\u3057\u305F: ${message}` : `- Failed to fetch: ${message}`,
|
|
641
|
+
""
|
|
642
|
+
);
|
|
661
643
|
}
|
|
662
|
-
sections.push("");
|
|
663
644
|
}
|
|
664
645
|
return sections.join("\n");
|
|
665
646
|
}
|
|
@@ -686,7 +667,7 @@ var googleSheetsConnector = new ConnectorPlugin({
|
|
|
686
667
|
authType: AUTH_TYPES.OAUTH,
|
|
687
668
|
skipConnectionCheckOnCreate: true,
|
|
688
669
|
name: "Google Sheets",
|
|
689
|
-
description: "Connect to Google Sheets for read
|
|
670
|
+
description: "Connect to Google Sheets for read-only access via OAuth. Any spreadsheet the authenticated Google account can access is supported \u2014 the target spreadsheetId is passed per call.",
|
|
690
671
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/1UPQuggyiZmbb26CuaSr2h/032770e8739b183fa00b7625f024e536/google-sheets.svg",
|
|
691
672
|
parameters,
|
|
692
673
|
releaseFlag: { dev1: true, dev2: false, prod: false },
|
|
@@ -696,33 +677,26 @@ var googleSheetsConnector = new ConnectorPlugin({
|
|
|
696
677
|
allowlist: [
|
|
697
678
|
{
|
|
698
679
|
host: "sheets.googleapis.com",
|
|
699
|
-
methods: ["GET"
|
|
680
|
+
methods: ["GET"]
|
|
700
681
|
}
|
|
701
682
|
]
|
|
702
683
|
},
|
|
703
684
|
systemPrompt: {
|
|
704
685
|
en: `### Tools (setup-time only)
|
|
705
686
|
|
|
706
|
-
- \`connector_google-sheets-oauth_request\`: Call the Google Sheets API during setup / data overview.
|
|
687
|
+
- \`connector_google-sheets-oauth_request\`: Call the Google Sheets API during setup / data overview. Read-only: only GET is supported. The caller must include the target spreadsheetId in the path explicitly (e.g., \`/1AbCxyz...\`, \`/1AbCxyz.../values/Sheet1!A1:D10\`). Authentication is configured automatically via OAuth.
|
|
707
688
|
|
|
708
689
|
> **Important**: The \`connector_google-sheets-oauth_request\` tool is only available at setup time. Inside server-logic handlers, use the SDK (\`connection(id).getValues(spreadsheetId, range)\`, etc.) \u2014 the SDK's fetch is already wired through the OAuth proxy. **Do NOT** hand-roll HTTP calls to \`_sqcore/connections/*/request\` from a handler.
|
|
709
690
|
|
|
710
|
-
> **Connection scope**: The OAuth scope is \`spreadsheets\` (read
|
|
691
|
+
> **Connection scope**: The OAuth scope is \`spreadsheets.readonly\` (read-only). A connection is NOT bound to a single spreadsheet \u2014 the target spreadsheetId is passed per call. The spreadsheetId is NOT stored as a connection parameter or environment variable; pass it explicitly from the caller (e.g., as a query param or request input to the handler).
|
|
711
692
|
|
|
712
693
|
### Google Sheets API Reference
|
|
713
694
|
|
|
714
|
-
Reads:
|
|
695
|
+
Reads (read-only connection):
|
|
715
696
|
- GET \`/{spreadsheetId}\` \u2014 Get spreadsheet metadata (title, sheets, properties)
|
|
716
697
|
- GET \`/{spreadsheetId}/values/{range}\` \u2014 Get cell values for a range
|
|
717
698
|
- GET \`/{spreadsheetId}/values:batchGet?ranges={range1}&ranges={range2}\` \u2014 Get values for multiple ranges
|
|
718
699
|
|
|
719
|
-
Writes:
|
|
720
|
-
- PUT \`/{spreadsheetId}/values/{range}?valueInputOption=USER_ENTERED\` \u2014 Overwrite a range (body: \`{ range, majorDimension, values }\`)
|
|
721
|
-
- POST \`/{spreadsheetId}/values/{range}:append?valueInputOption=USER_ENTERED\` \u2014 Append rows after the existing data
|
|
722
|
-
- POST \`/{spreadsheetId}/values/{range}:clear\` \u2014 Clear values in a range
|
|
723
|
-
- POST \`/{spreadsheetId}/values:batchUpdate\` \u2014 Batch update / batch clear
|
|
724
|
-
- POST \`/{spreadsheetId}:batchUpdate\` \u2014 Structural edits (addSheet, deleteSheet, updateCells, formatting, \u2026)
|
|
725
|
-
|
|
726
700
|
### Range Notation (A1 notation)
|
|
727
701
|
- \`Sheet1!A1:D10\` \u2014 Specific range on Sheet1
|
|
728
702
|
- \`Sheet1!A:A\` \u2014 Entire column A on Sheet1
|
|
@@ -732,7 +706,6 @@ Writes:
|
|
|
732
706
|
|
|
733
707
|
### Tips
|
|
734
708
|
- To explore a spreadsheet, first get metadata to see available sheet names
|
|
735
|
-
- Use \`valueInputOption=USER_ENTERED\` to parse formulas/dates like the UI; use \`RAW\` to store inputs literally
|
|
736
709
|
- Use \`valueRenderOption=FORMATTED_VALUE\` query param to get display values
|
|
737
710
|
- Use \`valueRenderOption=UNFORMATTED_VALUE\` for raw numeric values
|
|
738
711
|
- Use \`majorDimension=COLUMNS\` to get data organized by columns instead of rows
|
|
@@ -741,15 +714,11 @@ Writes:
|
|
|
741
714
|
|
|
742
715
|
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. The target spreadsheetId is NOT stored on the connection \u2014 the handler caller must pass it (as part of the request input).
|
|
743
716
|
|
|
744
|
-
SDK surface (client created via \`connection(connectionId)
|
|
717
|
+
SDK surface (client created via \`connection(connectionId)\`, read-only):
|
|
745
718
|
- \`client.request(path, init?)\` \u2014 low-level authenticated fetch (\`path\` is appended to \`https://sheets.googleapis.com/v4/spreadsheets\`; the caller must include the target spreadsheetId).
|
|
746
719
|
- \`client.getSpreadsheet(spreadsheetId)\` \u2014 fetch spreadsheet metadata.
|
|
747
720
|
- \`client.getValues(spreadsheetId, range)\` \u2014 read a range (A1 notation).
|
|
748
721
|
- \`client.batchGetValues(spreadsheetId, ranges)\` \u2014 read multiple ranges.
|
|
749
|
-
- \`client.updateValues(spreadsheetId, range, values, valueInputOption?)\` \u2014 overwrite a range (requires write scope).
|
|
750
|
-
- \`client.appendValues(spreadsheetId, range, values, valueInputOption?)\` \u2014 append rows (requires write scope).
|
|
751
|
-
- \`client.clearValues(spreadsheetId, range)\` \u2014 clear a range (requires write scope).
|
|
752
|
-
- \`client.batchUpdate(spreadsheetId, requests)\` \u2014 structural edits (requires write scope).
|
|
753
722
|
|
|
754
723
|
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.
|
|
755
724
|
|
|
@@ -765,38 +734,24 @@ const spreadsheetId = "<passed from request input>";
|
|
|
765
734
|
const metadata = await sheets.getSpreadsheet(spreadsheetId);
|
|
766
735
|
const values = await sheets.getValues(spreadsheetId, "Sheet1!A1:D10");
|
|
767
736
|
|
|
768
|
-
//
|
|
769
|
-
await sheets.
|
|
770
|
-
await sheets.appendValues(spreadsheetId, "Sheet1!A:B", [["Bob", 25]]);
|
|
771
|
-
await sheets.clearValues(spreadsheetId, "Sheet1!A1:B10");
|
|
772
|
-
|
|
773
|
-
// Structural edits (add a sheet)
|
|
774
|
-
await sheets.batchUpdate(spreadsheetId, [
|
|
775
|
-
{ addSheet: { properties: { title: "NewSheet" } } },
|
|
776
|
-
]);
|
|
737
|
+
// Read multiple ranges in one request
|
|
738
|
+
const batch = await sheets.batchGetValues(spreadsheetId, ["Sheet1!A1:D10", "Sheet2!A1:B5"]);
|
|
777
739
|
\`\`\``,
|
|
778
740
|
ja: `### \u30C4\u30FC\u30EB\uFF08\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u6642\u306E\u307F\uFF09
|
|
779
741
|
|
|
780
|
-
- \`connector_google-sheets-oauth_request\`: \u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u3084\u30C7\u30FC\u30BF\u6982\u8981\u628A\u63E1\u6642\u306B Google Sheets API \u3092\u547C\u3073\u51FA\u3059\u30C4\u30FC\u30EB\u3067\u3059\
|
|
742
|
+
- \`connector_google-sheets-oauth_request\`: \u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u3084\u30C7\u30FC\u30BF\u6982\u8981\u628A\u63E1\u6642\u306B Google Sheets API \u3092\u547C\u3073\u51FA\u3059\u30C4\u30FC\u30EB\u3067\u3059\u3002\u8AAD\u307F\u53D6\u308A\u5C02\u7528\u3067 GET \u306E\u307F\u3092\u30B5\u30DD\u30FC\u30C8\u3057\u307E\u3059\u3002\u547C\u3073\u51FA\u3057\u5074\u304C\u30D1\u30B9\u306B\u5BFE\u8C61\u306E spreadsheetId \u3092\u660E\u793A\u7684\u306B\u542B\u3081\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\uFF08\u4F8B: \`/1AbCxyz...\`\u3001\`/1AbCxyz.../values/Sheet1!A1:D10\`\uFF09\u3002OAuth \u7D4C\u7531\u3067\u8A8D\u8A3C\u306F\u81EA\u52D5\u8A2D\u5B9A\u3055\u308C\u307E\u3059\u3002
|
|
781
743
|
|
|
782
744
|
> **\u91CD\u8981**: \`connector_google-sheets-oauth_request\` \u306F\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u6642\u306E\u307F\u5229\u7528\u53EF\u80FD\u3067\u3059\u3002\u30B5\u30FC\u30D0\u30FC\u30ED\u30B8\u30C3\u30AF\u306E\u30CF\u30F3\u30C9\u30E9\u5185\u3067\u306F\u5FC5\u305A SDK\uFF08\`connection(id).getValues(spreadsheetId, range)\` \u306A\u3069\uFF09\u3092\u4F7F\u3063\u3066\u304F\u3060\u3055\u3044\u3002SDK \u306E fetch \u306F OAuth \u30D7\u30ED\u30AD\u30B7\u7D4C\u7531\u3067\u65E2\u306B\u914D\u7DDA\u3055\u308C\u3066\u3044\u307E\u3059\u3002\u30CF\u30F3\u30C9\u30E9\u304B\u3089 \`_sqcore/connections/*/request\` \u3092\u624B\u66F8\u304D\u3067\u547C\u3073\u51FA\u3055\u306A\u3044\u3067\u304F\u3060\u3055\u3044\u3002
|
|
783
745
|
|
|
784
|
-
> **\u63A5\u7D9A\u30B9\u30B3\u30FC\u30D7**: OAuth \u30B9\u30B3\u30FC\u30D7\u306F \`spreadsheets\`\uFF08\u8AAD\u307F\
|
|
746
|
+
> **\u63A5\u7D9A\u30B9\u30B3\u30FC\u30D7**: OAuth \u30B9\u30B3\u30FC\u30D7\u306F \`spreadsheets.readonly\`\uFF08\u8AAD\u307F\u53D6\u308A\u5C02\u7528\uFF09\u3067\u3059\u3002\u30B3\u30CD\u30AF\u30B7\u30E7\u30F3\u306F\u5358\u4E00\u306E\u30B9\u30D7\u30EC\u30C3\u30C9\u30B7\u30FC\u30C8\u306B\u7D10\u3065\u304D\u307E\u305B\u3093 \u2014 \u5BFE\u8C61\u306E spreadsheetId \u306F\u547C\u3073\u51FA\u3057\u3054\u3068\u306B\u6E21\u3057\u307E\u3059\u3002spreadsheetId \u306F\u30B3\u30CD\u30AF\u30B7\u30E7\u30F3\u30D1\u30E9\u30E1\u30FC\u30BF\u3084\u74B0\u5883\u5909\u6570\u3068\u3057\u3066\u4FDD\u5B58\u3055\u308C\u306A\u3044\u305F\u3081\u3001\u30CF\u30F3\u30C9\u30E9\u306E\u547C\u3073\u51FA\u3057\u5143\uFF08\u30EA\u30AF\u30A8\u30B9\u30C8\u5165\u529B\u306A\u3069\uFF09\u304B\u3089\u660E\u793A\u7684\u306B\u6E21\u3057\u3066\u304F\u3060\u3055\u3044\u3002
|
|
785
747
|
|
|
786
748
|
### Google Sheets API \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9
|
|
787
749
|
|
|
788
|
-
\u8AAD\u307F\u53D6\u308A:
|
|
750
|
+
\u8AAD\u307F\u53D6\u308A\uFF08\u8AAD\u307F\u53D6\u308A\u5C02\u7528\u63A5\u7D9A\uFF09:
|
|
789
751
|
- GET \`/{spreadsheetId}\` \u2014 \u30B9\u30D7\u30EC\u30C3\u30C9\u30B7\u30FC\u30C8\u306E\u30E1\u30BF\u30C7\u30FC\u30BF\u3092\u53D6\u5F97\uFF08\u30BF\u30A4\u30C8\u30EB\u3001\u30B7\u30FC\u30C8\u3001\u30D7\u30ED\u30D1\u30C6\u30A3\uFF09
|
|
790
752
|
- GET \`/{spreadsheetId}/values/{range}\` \u2014 \u7BC4\u56F2\u306E\u30BB\u30EB\u5024\u3092\u53D6\u5F97
|
|
791
753
|
- GET \`/{spreadsheetId}/values:batchGet?ranges={range1}&ranges={range2}\` \u2014 \u8907\u6570\u7BC4\u56F2\u306E\u5024\u3092\u53D6\u5F97
|
|
792
754
|
|
|
793
|
-
\u66F8\u304D\u8FBC\u307F:
|
|
794
|
-
- PUT \`/{spreadsheetId}/values/{range}?valueInputOption=USER_ENTERED\` \u2014 \u7BC4\u56F2\u3092\u4E0A\u66F8\u304D\uFF08body: \`{ range, majorDimension, values }\`\uFF09
|
|
795
|
-
- POST \`/{spreadsheetId}/values/{range}:append?valueInputOption=USER_ENTERED\` \u2014 \u65E2\u5B58\u30C7\u30FC\u30BF\u306E\u5F8C\u308D\u306B\u884C\u3092\u8FFD\u8A18
|
|
796
|
-
- POST \`/{spreadsheetId}/values/{range}:clear\` \u2014 \u7BC4\u56F2\u306E\u5024\u3092\u30AF\u30EA\u30A2
|
|
797
|
-
- POST \`/{spreadsheetId}/values:batchUpdate\` \u2014 \u30D0\u30C3\u30C1\u66F4\u65B0 / \u30D0\u30C3\u30C1\u30AF\u30EA\u30A2
|
|
798
|
-
- POST \`/{spreadsheetId}:batchUpdate\` \u2014 \u69CB\u9020\u5909\u66F4\uFF08addSheet, deleteSheet, updateCells, \u66F8\u5F0F\u8A2D\u5B9A \u7B49\uFF09
|
|
799
|
-
|
|
800
755
|
### \u7BC4\u56F2\u306E\u8868\u8A18\u6CD5\uFF08A1\u8868\u8A18\u6CD5\uFF09
|
|
801
756
|
- \`Sheet1!A1:D10\` \u2014 Sheet1\u4E0A\u306E\u7279\u5B9A\u7BC4\u56F2
|
|
802
757
|
- \`Sheet1!A:A\` \u2014 Sheet1\u306EA\u5217\u5168\u4F53
|
|
@@ -806,7 +761,6 @@ await sheets.batchUpdate(spreadsheetId, [
|
|
|
806
761
|
|
|
807
762
|
### \u30D2\u30F3\u30C8
|
|
808
763
|
- \u30B9\u30D7\u30EC\u30C3\u30C9\u30B7\u30FC\u30C8\u3092\u63A2\u7D22\u3059\u308B\u306B\u306F\u3001\u307E\u305A\u30E1\u30BF\u30C7\u30FC\u30BF\u3092\u53D6\u5F97\u3057\u3066\u5229\u7528\u53EF\u80FD\u306A\u30B7\u30FC\u30C8\u540D\u3092\u78BA\u8A8D\u3057\u307E\u3059
|
|
809
|
-
- \u6570\u5F0F\u3084\u65E5\u4ED8\u3092 UI \u3068\u540C\u3058\u3088\u3046\u306B\u89E3\u91C8\u3055\u305B\u308B\u306B\u306F \`valueInputOption=USER_ENTERED\`\u3001\u305D\u306E\u307E\u307E\u6587\u5B57\u5217\u3068\u3057\u3066\u4FDD\u5B58\u3059\u308B\u306B\u306F \`RAW\` \u3092\u4F7F\u3044\u307E\u3059
|
|
810
764
|
- \u8868\u793A\u5024\u3092\u53D6\u5F97\u3059\u308B\u306B\u306F \`valueRenderOption=FORMATTED_VALUE\` \u30AF\u30A8\u30EA\u30D1\u30E9\u30E1\u30FC\u30BF\u3092\u4F7F\u7528\u3057\u307E\u3059
|
|
811
765
|
- \u751F\u306E\u6570\u5024\u3092\u53D6\u5F97\u3059\u308B\u306B\u306F \`valueRenderOption=UNFORMATTED_VALUE\` \u3092\u4F7F\u7528\u3057\u307E\u3059
|
|
812
766
|
- \u5217\u3054\u3068\u306B\u30C7\u30FC\u30BF\u3092\u53D6\u5F97\u3059\u308B\u306B\u306F \`majorDimension=COLUMNS\` \u3092\u4F7F\u7528\u3057\u307E\u3059
|
|
@@ -815,15 +769,11 @@ await sheets.batchUpdate(spreadsheetId, [
|
|
|
815
769
|
|
|
816
770
|
\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\u5BFE\u8C61 spreadsheetId \u306F\u30B3\u30CD\u30AF\u30B7\u30E7\u30F3\u306B\u4FDD\u5B58\u3055\u308C\u306A\u3044\u305F\u3081\u3001\u30CF\u30F3\u30C9\u30E9\u306E\u547C\u3073\u51FA\u3057\u5143\uFF08\u30EA\u30AF\u30A8\u30B9\u30C8\u5165\u529B\u306A\u3069\uFF09\u304B\u3089\u6E21\u3057\u3066\u304F\u3060\u3055\u3044\u3002
|
|
817
771
|
|
|
818
|
-
SDK\uFF08\`connection(connectionId)\` \u3067\u4F5C\u6210\u3057\u305F\u30AF\u30E9\u30A4\u30A2\u30F3\u30C8\uFF09:
|
|
772
|
+
SDK\uFF08\`connection(connectionId)\` \u3067\u4F5C\u6210\u3057\u305F\u30AF\u30E9\u30A4\u30A2\u30F3\u30C8\u3001\u8AAD\u307F\u53D6\u308A\u5C02\u7528\uFF09:
|
|
819
773
|
- \`client.request(path, init?)\` \u2014 \u4F4E\u30EC\u30D9\u30EB\u306E\u8A8D\u8A3C\u4ED8\u304D fetch\uFF08\`path\` \u306F \`https://sheets.googleapis.com/v4/spreadsheets\` \u306B\u8FFD\u52A0\u3055\u308C\u3001\u547C\u3073\u51FA\u3057\u5074\u304C spreadsheetId \u3092\u542B\u3081\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\uFF09\u3002
|
|
820
774
|
- \`client.getSpreadsheet(spreadsheetId)\` \u2014 \u30B9\u30D7\u30EC\u30C3\u30C9\u30B7\u30FC\u30C8\u306E\u30E1\u30BF\u30C7\u30FC\u30BF\u3092\u53D6\u5F97\u3002
|
|
821
775
|
- \`client.getValues(spreadsheetId, range)\` \u2014 \u7BC4\u56F2\u306E\u5024\u3092\u53D6\u5F97\uFF08A1 \u8868\u8A18\uFF09\u3002
|
|
822
776
|
- \`client.batchGetValues(spreadsheetId, ranges)\` \u2014 \u8907\u6570\u7BC4\u56F2\u306E\u5024\u3092\u53D6\u5F97\u3002
|
|
823
|
-
- \`client.updateValues(spreadsheetId, range, values, valueInputOption?)\` \u2014 \u7BC4\u56F2\u3092\u4E0A\u66F8\u304D\uFF08\u66F8\u304D\u8FBC\u307F\u30B9\u30B3\u30FC\u30D7\u304C\u5FC5\u8981\uFF09\u3002
|
|
824
|
-
- \`client.appendValues(spreadsheetId, range, values, valueInputOption?)\` \u2014 \u884C\u3092\u8FFD\u8A18\uFF08\u66F8\u304D\u8FBC\u307F\u30B9\u30B3\u30FC\u30D7\u304C\u5FC5\u8981\uFF09\u3002
|
|
825
|
-
- \`client.clearValues(spreadsheetId, range)\` \u2014 \u7BC4\u56F2\u306E\u5024\u3092\u30AF\u30EA\u30A2\uFF08\u66F8\u304D\u8FBC\u307F\u30B9\u30B3\u30FC\u30D7\u304C\u5FC5\u8981\uFF09\u3002
|
|
826
|
-
- \`client.batchUpdate(spreadsheetId, requests)\` \u2014 \u69CB\u9020\u5909\u66F4\uFF08\u66F8\u304D\u8FBC\u307F\u30B9\u30B3\u30FC\u30D7\u304C\u5FC5\u8981\uFF09\u3002
|
|
827
777
|
|
|
828
778
|
\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\u3002\u901A\u5E38\u306F\u30B5\u30F3\u30C9\u30DC\u30C3\u30AF\u30B9\u306E\u521D\u671F\u5316\u4E2D\u306B\u8D77\u304D\u307E\u3059\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
|
|
829
779
|
|
|
@@ -839,15 +789,8 @@ const spreadsheetId = "<\u30EA\u30AF\u30A8\u30B9\u30C8\u5165\u529B\u304B\u3089\u
|
|
|
839
789
|
const metadata = await sheets.getSpreadsheet(spreadsheetId);
|
|
840
790
|
const values = await sheets.getValues(spreadsheetId, "Sheet1!A1:D10");
|
|
841
791
|
|
|
842
|
-
// \
|
|
843
|
-
await sheets.
|
|
844
|
-
await sheets.appendValues(spreadsheetId, "Sheet1!A:B", [["Bob", 25]]);
|
|
845
|
-
await sheets.clearValues(spreadsheetId, "Sheet1!A1:B10");
|
|
846
|
-
|
|
847
|
-
// \u69CB\u9020\u5909\u66F4\uFF08\u30B7\u30FC\u30C8\u3092\u8FFD\u52A0\uFF09
|
|
848
|
-
await sheets.batchUpdate(spreadsheetId, [
|
|
849
|
-
{ addSheet: { properties: { title: "NewSheet" } } },
|
|
850
|
-
]);
|
|
792
|
+
// \u8907\u6570\u7BC4\u56F2\u3092\u307E\u3068\u3081\u3066\u53D6\u5F97
|
|
793
|
+
const batch = await sheets.batchGetValues(spreadsheetId, ["Sheet1!A1:D10", "Sheet2!A1:B5"]);
|
|
851
794
|
\`\`\``
|
|
852
795
|
},
|
|
853
796
|
tools,
|