@squadbase/vite-server 0.1.3-dev.1 → 0.1.3-dev.10

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.
Files changed (56) hide show
  1. package/dist/cli/index.js +71031 -6800
  2. package/dist/connectors/airtable-oauth.js +77 -3
  3. package/dist/connectors/airtable.js +85 -2
  4. package/dist/connectors/amplitude.js +85 -2
  5. package/dist/connectors/anthropic.js +85 -2
  6. package/dist/connectors/asana.js +86 -3
  7. package/dist/connectors/attio.js +85 -2
  8. package/dist/connectors/customerio.js +86 -3
  9. package/dist/connectors/dbt.js +85 -2
  10. package/dist/connectors/gemini.js +86 -3
  11. package/dist/connectors/gmail-oauth.js +78 -4
  12. package/dist/connectors/gmail.d.ts +5 -0
  13. package/dist/connectors/gmail.js +875 -0
  14. package/dist/connectors/google-ads-oauth.js +78 -4
  15. package/dist/connectors/google-ads.js +85 -2
  16. package/dist/connectors/google-analytics-oauth.js +90 -8
  17. package/dist/connectors/google-analytics.js +85 -2
  18. package/dist/connectors/google-calendar-oauth.d.ts +5 -0
  19. package/dist/connectors/google-calendar-oauth.js +817 -0
  20. package/dist/connectors/google-calendar.d.ts +5 -0
  21. package/dist/connectors/google-calendar.js +991 -0
  22. package/dist/connectors/google-sheets-oauth.js +144 -33
  23. package/dist/connectors/google-sheets.js +119 -10
  24. package/dist/connectors/{microsoft-teams.d.ts → grafana.d.ts} +1 -1
  25. package/dist/connectors/grafana.js +638 -0
  26. package/dist/connectors/hubspot-oauth.js +77 -3
  27. package/dist/connectors/hubspot.js +79 -5
  28. package/dist/connectors/intercom-oauth.js +78 -4
  29. package/dist/connectors/intercom.js +86 -3
  30. package/dist/connectors/jira-api-key.js +84 -9
  31. package/dist/connectors/kintone-api-token.js +77 -3
  32. package/dist/connectors/kintone.js +86 -3
  33. package/dist/connectors/linkedin-ads-oauth.js +78 -4
  34. package/dist/connectors/linkedin-ads.js +86 -3
  35. package/dist/connectors/mailchimp-oauth.js +77 -3
  36. package/dist/connectors/mailchimp.js +86 -3
  37. package/dist/connectors/{microsoft-teams-oauth.d.ts → notion-oauth.d.ts} +1 -1
  38. package/dist/connectors/notion-oauth.js +567 -0
  39. package/dist/connectors/{slack.d.ts → notion.d.ts} +1 -1
  40. package/dist/connectors/notion.js +663 -0
  41. package/dist/connectors/openai.js +85 -2
  42. package/dist/connectors/shopify-oauth.js +77 -3
  43. package/dist/connectors/shopify.js +85 -2
  44. package/dist/connectors/stripe-api-key.d.ts +5 -0
  45. package/dist/connectors/stripe-api-key.js +600 -0
  46. package/dist/connectors/stripe-oauth.js +77 -3
  47. package/dist/connectors/wix-store.js +85 -2
  48. package/dist/connectors/zendesk-oauth.js +78 -4
  49. package/dist/connectors/zendesk.js +86 -3
  50. package/dist/index.js +75373 -8431
  51. package/dist/main.js +75359 -8417
  52. package/dist/vite-plugin.js +75210 -8305
  53. package/package.json +46 -2
  54. package/dist/connectors/microsoft-teams-oauth.js +0 -479
  55. package/dist/connectors/microsoft-teams.js +0 -381
  56. package/dist/connectors/slack.js +0 -362
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@squadbase/vite-server",
3
- "version": "0.1.3-dev.1",
3
+ "version": "0.1.3-dev.10",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -55,6 +55,14 @@
55
55
  "import": "./dist/connectors/airtable.js",
56
56
  "types": "./dist/connectors/airtable.d.ts"
57
57
  },
58
+ "./connectors/google-calendar": {
59
+ "import": "./dist/connectors/google-calendar.js",
60
+ "types": "./dist/connectors/google-calendar.d.ts"
61
+ },
62
+ "./connectors/google-calendar-oauth": {
63
+ "import": "./dist/connectors/google-calendar-oauth.js",
64
+ "types": "./dist/connectors/google-calendar-oauth.d.ts"
65
+ },
58
66
  "./connectors/google-analytics": {
59
67
  "import": "./dist/connectors/google-analytics.js",
60
68
  "types": "./dist/connectors/google-analytics.d.ts"
@@ -139,6 +147,10 @@
139
147
  "import": "./dist/connectors/customerio.js",
140
148
  "types": "./dist/connectors/customerio.d.ts"
141
149
  },
150
+ "./connectors/gmail": {
151
+ "import": "./dist/connectors/gmail.js",
152
+ "types": "./dist/connectors/gmail.d.ts"
153
+ },
142
154
  "./connectors/gmail-oauth": {
143
155
  "import": "./dist/connectors/gmail-oauth.js",
144
156
  "types": "./dist/connectors/gmail-oauth.d.ts"
@@ -150,6 +162,38 @@
150
162
  "./connectors/linkedin-ads-oauth": {
151
163
  "import": "./dist/connectors/linkedin-ads-oauth.js",
152
164
  "types": "./dist/connectors/linkedin-ads-oauth.d.ts"
165
+ },
166
+ "./connectors/intercom": {
167
+ "import": "./dist/connectors/intercom.js",
168
+ "types": "./dist/connectors/intercom.d.ts"
169
+ },
170
+ "./connectors/intercom-oauth": {
171
+ "import": "./dist/connectors/intercom-oauth.js",
172
+ "types": "./dist/connectors/intercom-oauth.d.ts"
173
+ },
174
+ "./connectors/zendesk": {
175
+ "import": "./dist/connectors/zendesk.js",
176
+ "types": "./dist/connectors/zendesk.d.ts"
177
+ },
178
+ "./connectors/zendesk-oauth": {
179
+ "import": "./dist/connectors/zendesk-oauth.js",
180
+ "types": "./dist/connectors/zendesk-oauth.d.ts"
181
+ },
182
+ "./connectors/notion": {
183
+ "import": "./dist/connectors/notion.js",
184
+ "types": "./dist/connectors/notion.d.ts"
185
+ },
186
+ "./connectors/notion-oauth": {
187
+ "import": "./dist/connectors/notion-oauth.js",
188
+ "types": "./dist/connectors/notion-oauth.d.ts"
189
+ },
190
+ "./connectors/stripe-api-key": {
191
+ "import": "./dist/connectors/stripe-api-key.js",
192
+ "types": "./dist/connectors/stripe-api-key.d.ts"
193
+ },
194
+ "./connectors/grafana": {
195
+ "import": "./dist/connectors/grafana.js",
196
+ "types": "./dist/connectors/grafana.d.ts"
153
197
  }
154
198
  },
155
199
  "files": [
@@ -165,7 +209,7 @@
165
209
  "cli": "tsx src/cli/index.ts",
166
210
  "build": "tsup && npm run build:cli",
167
211
  "release": "npm publish --@squadbase:registry=https://registry.npmjs.org",
168
- "build:cli": "tsup src/cli/index.ts --out-dir dist/cli --format esm --platform node --no-splitting --external pg --external snowflake-sdk --external @google-cloud/bigquery --external mysql2 --external @aws-sdk/client-athena --external @aws-sdk/client-redshift-data --external @databricks/sql --external trino-client --external @clickhouse/client --external @google-analytics/data --external @kintone/rest-api-client --external hono --external @clack/prompts"
212
+ "build:cli": "tsup src/cli/index.ts --out-dir dist/cli --format esm --platform node --no-splitting --external pg --external snowflake-sdk --external @google-cloud/bigquery --external mysql2 --external @aws-sdk/client-athena --external @aws-sdk/client-redshift-data --external @databricks/sql --external @clickhouse/client --external @google-analytics/data --external @kintone/rest-api-client --external hono --external @clack/prompts"
169
213
  },
170
214
  "dependencies": {
171
215
  "@aws-sdk/client-athena": "^3.750.0",
@@ -1,479 +0,0 @@
1
- // ../connectors/src/connectors/ms-teams-oauth/sdk/index.ts
2
- var BASE_URL = "https://graph.microsoft.com";
3
- function createClient(_params, fetchFn = fetch) {
4
- function request(path2, init) {
5
- const url = `${BASE_URL}${path2.startsWith("/") ? "" : "/"}${path2}`;
6
- return fetchFn(url, init);
7
- }
8
- return { request };
9
- }
10
-
11
- // ../connectors/src/connector-onboarding.ts
12
- var ConnectorOnboarding = class {
13
- /** Phase 1: Connection setup instructions (optional — some connectors don't need this) */
14
- connectionSetupInstructions;
15
- /** Phase 2: Data overview instructions */
16
- dataOverviewInstructions;
17
- constructor(config) {
18
- this.connectionSetupInstructions = config.connectionSetupInstructions;
19
- this.dataOverviewInstructions = config.dataOverviewInstructions;
20
- }
21
- getConnectionSetupPrompt(language) {
22
- return this.connectionSetupInstructions?.[language] ?? null;
23
- }
24
- getDataOverviewInstructions(language) {
25
- return this.dataOverviewInstructions[language];
26
- }
27
- };
28
-
29
- // ../connectors/src/connector-tool.ts
30
- var ConnectorTool = class {
31
- name;
32
- description;
33
- inputSchema;
34
- outputSchema;
35
- _execute;
36
- constructor(config) {
37
- this.name = config.name;
38
- this.description = config.description;
39
- this.inputSchema = config.inputSchema;
40
- this.outputSchema = config.outputSchema;
41
- this._execute = config.execute;
42
- }
43
- createTool(connections, config) {
44
- return {
45
- description: this.description,
46
- inputSchema: this.inputSchema,
47
- outputSchema: this.outputSchema,
48
- execute: (input) => this._execute(input, connections, config)
49
- };
50
- }
51
- };
52
-
53
- // ../connectors/src/connector-plugin.ts
54
- var ConnectorPlugin = class _ConnectorPlugin {
55
- slug;
56
- authType;
57
- name;
58
- description;
59
- iconUrl;
60
- parameters;
61
- releaseFlag;
62
- proxyPolicy;
63
- experimentalAttributes;
64
- onboarding;
65
- systemPrompt;
66
- tools;
67
- query;
68
- checkConnection;
69
- constructor(config) {
70
- this.slug = config.slug;
71
- this.authType = config.authType;
72
- this.name = config.name;
73
- this.description = config.description;
74
- this.iconUrl = config.iconUrl;
75
- this.parameters = config.parameters;
76
- this.releaseFlag = config.releaseFlag;
77
- this.proxyPolicy = config.proxyPolicy;
78
- this.experimentalAttributes = config.experimentalAttributes;
79
- this.onboarding = config.onboarding;
80
- this.systemPrompt = config.systemPrompt;
81
- this.tools = config.tools;
82
- this.query = config.query;
83
- this.checkConnection = config.checkConnection;
84
- }
85
- get connectorKey() {
86
- return _ConnectorPlugin.deriveKey(this.slug, this.authType);
87
- }
88
- /**
89
- * Create tools for connections that belong to this connector.
90
- * Filters connections by connectorKey internally.
91
- * Returns tools keyed as `${connectorKey}_${toolName}`.
92
- */
93
- createTools(connections, config) {
94
- const myConnections = connections.filter(
95
- (c) => _ConnectorPlugin.deriveKey(c.connector.slug, c.connector.authType) === this.connectorKey
96
- );
97
- const result = {};
98
- for (const t of Object.values(this.tools)) {
99
- result[`${this.connectorKey}_${t.name}`] = t.createTool(
100
- myConnections,
101
- config
102
- );
103
- }
104
- return result;
105
- }
106
- static deriveKey(slug, authType) {
107
- return authType ? `${slug}-${authType}` : slug;
108
- }
109
- };
110
-
111
- // ../connectors/src/auth-types.ts
112
- var AUTH_TYPES = {
113
- OAUTH: "oauth",
114
- API_KEY: "api-key",
115
- JWT: "jwt",
116
- SERVICE_ACCOUNT: "service-account",
117
- PAT: "pat"
118
- };
119
-
120
- // ../connectors/src/connectors/ms-teams-oauth/tools/request.ts
121
- import { z } from "zod";
122
- var BASE_URL2 = "https://graph.microsoft.com";
123
- var REQUEST_TIMEOUT_MS = 6e4;
124
- var cachedToken = null;
125
- async function getProxyToken(config) {
126
- if (cachedToken && cachedToken.expiresAt > Date.now() + 6e4) {
127
- return cachedToken.token;
128
- }
129
- const url = `${config.appApiBaseUrl}/v0/database/${config.projectId}/environment/${config.environmentId}/oauth-request-proxy-token`;
130
- const res = await fetch(url, {
131
- method: "POST",
132
- headers: {
133
- "Content-Type": "application/json",
134
- "x-api-key": config.appApiKey,
135
- "project-id": config.projectId
136
- },
137
- body: JSON.stringify({
138
- sandboxId: config.sandboxId,
139
- issuedBy: "coding-agent"
140
- })
141
- });
142
- if (!res.ok) {
143
- const errorText = await res.text().catch(() => res.statusText);
144
- throw new Error(
145
- `Failed to get proxy token: HTTP ${res.status} ${errorText}`
146
- );
147
- }
148
- const data = await res.json();
149
- cachedToken = {
150
- token: data.token,
151
- expiresAt: new Date(data.expiresAt).getTime()
152
- };
153
- return data.token;
154
- }
155
- var inputSchema = z.object({
156
- toolUseIntent: z.string().optional().describe(
157
- "Brief description of what you intend to accomplish with this tool call"
158
- ),
159
- connectionId: z.string().describe("ID of the Microsoft Teams OAuth connection to use"),
160
- method: z.enum(["GET", "POST", "PATCH", "DELETE"]).describe("HTTP method"),
161
- path: z.string().describe(
162
- "API path appended to https://graph.microsoft.com (e.g., '/v1.0/me/joinedTeams', '/v1.0/teams/{id}/channels')"
163
- ),
164
- queryParams: z.record(z.string(), z.string()).optional().describe("Query parameters to append to the URL"),
165
- body: z.record(z.string(), z.unknown()).optional().describe("Request body (JSON) for POST/PATCH requests")
166
- });
167
- var outputSchema = z.discriminatedUnion("success", [
168
- z.object({
169
- success: z.literal(true),
170
- status: z.number(),
171
- data: z.record(z.string(), z.unknown())
172
- }),
173
- z.object({
174
- success: z.literal(false),
175
- error: z.string()
176
- })
177
- ]);
178
- var requestTool = new ConnectorTool({
179
- name: "request",
180
- description: `Send authenticated requests to the Microsoft Graph API.
181
- Authentication is handled automatically via OAuth proxy.`,
182
- inputSchema,
183
- outputSchema,
184
- async execute({ connectionId, method, path: path2, queryParams, body }, connections, config) {
185
- const connection2 = connections.find((c) => c.id === connectionId);
186
- if (!connection2) {
187
- return {
188
- success: false,
189
- error: `Connection ${connectionId} not found`
190
- };
191
- }
192
- console.log(
193
- `[connector-request] ms-teams-oauth/${connection2.name}: ${method} ${path2}`
194
- );
195
- try {
196
- let url = `${BASE_URL2}${path2.startsWith("/") ? "" : "/"}${path2}`;
197
- if (queryParams) {
198
- const searchParams = new URLSearchParams(queryParams);
199
- url += `?${searchParams.toString()}`;
200
- }
201
- const token = await getProxyToken(config.oauthProxy);
202
- const proxyUrl = `https://${config.oauthProxy.sandboxId}.${config.oauthProxy.previewBaseDomain}/_sqcore/connections/${connectionId}/request`;
203
- const controller = new AbortController();
204
- const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS);
205
- try {
206
- const response = await fetch(proxyUrl, {
207
- method: "POST",
208
- headers: {
209
- "Content-Type": "application/json",
210
- Authorization: `Bearer ${token}`
211
- },
212
- body: JSON.stringify({
213
- url,
214
- method,
215
- body: body ? JSON.stringify(body) : void 0
216
- }),
217
- signal: controller.signal
218
- });
219
- const data = await response.json();
220
- if (!response.ok) {
221
- const errorMessage = typeof data?.error === "string" ? data.error : typeof data?.message === "string" ? data.message : `HTTP ${response.status} ${response.statusText}`;
222
- return { success: false, error: errorMessage };
223
- }
224
- return { success: true, status: response.status, data };
225
- } finally {
226
- clearTimeout(timeout);
227
- }
228
- } catch (err) {
229
- const msg = err instanceof Error ? err.message : String(err);
230
- return { success: false, error: msg };
231
- }
232
- }
233
- });
234
-
235
- // ../connectors/src/connectors/ms-teams-oauth/setup.ts
236
- var requestToolName = `microsoft-teams-oauth_${requestTool.name}`;
237
- var msTeamsOauthOnboarding = new ConnectorOnboarding({
238
- connectionSetupInstructions: {
239
- ja: `\u4EE5\u4E0B\u306E\u624B\u9806\u3092\u6B63\u78BA\u306B\u5B9F\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u624B\u9806\u306B\u8A18\u8F09\u306E\u306A\u3044\u8FFD\u52A0\u306EAPI\u30EA\u30AF\u30A8\u30B9\u30C8\u306F\u4E00\u5207\u884C\u308F\u306A\u3044\u3067\u304F\u3060\u3055\u3044\u3002
240
-
241
- 1. \`${requestToolName}\` \u3092\u547C\u3073\u51FA\u3057\u3066\u3001\u30E6\u30FC\u30B6\u30FC\u60C5\u5831\u3092\u53D6\u5F97\u3059\u308B:
242
- - \`method\`: \`"GET"\`
243
- - \`path\`: \`"/v1.0/me"\`
244
- 2. \u30A8\u30E9\u30FC\u304C\u8FD4\u3055\u308C\u305F\u5834\u5408\u3001\u30E6\u30FC\u30B6\u30FC\u306BOAuth\u63A5\u7D9A\u306E\u8A2D\u5B9A\u3092\u78BA\u8A8D\u3059\u308B\u3088\u3046\u4F1D\u3048\u308B
245
- 3. \`updateConnectionContext\` \u3092\u547C\u3073\u51FA\u3059:
246
- - \`user\`: Microsoft \u30E6\u30FC\u30B6\u30FC\u60C5\u5831\uFF08displayName, mail \u306A\u3069\uFF09
247
- - \`note\`: \u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u5185\u5BB9\u306E\u7C21\u5358\u306A\u8AAC\u660E
248
-
249
- #### \u5236\u7D04
250
- - **\u4E0A\u8A18\u30B9\u30C6\u30C3\u30D7\u306E\u307F\u5B9F\u884C\u3059\u308B\u3053\u3068**\u3002Teams\u4E00\u89A7\u306E\u53D6\u5F97\u3001\u30C1\u30E3\u30F3\u30CD\u30EB\u4E00\u89A7\u306E\u53D6\u5F97\u3001\u30E1\u30C3\u30BB\u30FC\u30B8\u306E\u8AAD\u307F\u53D6\u308A\u306A\u3069\u3001\u624B\u9806\u306B\u8A18\u8F09\u306E\u306A\u3044API\u30EA\u30AF\u30A8\u30B9\u30C8\u306F\u4E00\u5207\u7981\u6B62
251
- - \u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u306F\u63A5\u7D9A\u78BA\u8A8D\u306E\u307F\u304C\u76EE\u7684\u3002\u30C7\u30FC\u30BF\u63A2\u7D22\u306F\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u5B8C\u4E86\u5F8C\u306B\u30E6\u30FC\u30B6\u30FC\u304C\u884C\u3046
252
- - \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`,
253
- en: `Follow these steps exactly. Do NOT make any API requests not listed in the steps below.
254
-
255
- 1. Call \`${requestToolName}\` to fetch user info:
256
- - \`method\`: \`"GET"\`
257
- - \`path\`: \`"/v1.0/me"\`
258
- 2. If an error is returned, ask the user to check the OAuth connection settings
259
- 3. Call \`updateConnectionContext\`:
260
- - \`user\`: Microsoft user info (displayName, mail, etc.)
261
- - \`note\`: Brief description of the setup
262
-
263
- #### Constraints
264
- - **Only execute the steps above**. Do NOT fetch Teams list, channels, messages, or make any API requests not specified in the steps
265
- - Setup is only for connection verification. Data exploration is done by the user after setup is complete
266
- - Write only 1 sentence between tool calls, then immediately call the next tool. Skip unnecessary explanations and proceed efficiently`
267
- },
268
- dataOverviewInstructions: {
269
- en: `1. Call ms-teams-oauth_request with GET /v1.0/me/joinedTeams to list available teams
270
- 2. Call ms-teams-oauth_request with GET /v1.0/teams/{teamId}/channels to list channels in a team
271
- 3. Explore messages or members as needed to understand the data structure`,
272
- ja: `1. ms-teams-oauth_request \u3067 GET /v1.0/me/joinedTeams \u3092\u547C\u3073\u51FA\u3057\u3001\u5229\u7528\u53EF\u80FD\u306A\u30C1\u30FC\u30E0\u4E00\u89A7\u3092\u53D6\u5F97
273
- 2. ms-teams-oauth_request \u3067 GET /v1.0/teams/{teamId}/channels \u3092\u547C\u3073\u51FA\u3057\u3001\u30C1\u30FC\u30E0\u5185\u306E\u30C1\u30E3\u30F3\u30CD\u30EB\u4E00\u89A7\u3092\u53D6\u5F97
274
- 3. \u5FC5\u8981\u306B\u5FDC\u3058\u3066\u30E1\u30C3\u30BB\u30FC\u30B8\u3084\u30E1\u30F3\u30D0\u30FC\u3092\u63A2\u7D22\u3057\u3001\u30C7\u30FC\u30BF\u69CB\u9020\u3092\u628A\u63E1`
275
- }
276
- });
277
-
278
- // ../connectors/src/connectors/ms-teams-oauth/parameters.ts
279
- var parameters = {};
280
-
281
- // ../connectors/src/connectors/ms-teams-oauth/index.ts
282
- var tools = { request: requestTool };
283
- var msTeamsOauthConnector = new ConnectorPlugin({
284
- slug: "microsoft-teams",
285
- authType: AUTH_TYPES.OAUTH,
286
- name: "Microsoft Teams (OAuth)",
287
- description: "Connect to Microsoft Teams for messaging, channels, and team data using OAuth.",
288
- iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/6QM1sVuqarTJAB2UihVNQ9/12b8353c9b022916d72ef0f53349bae2/microsoft-teams-icon.svg",
289
- parameters,
290
- releaseFlag: { dev1: true, dev2: false, prod: false },
291
- onboarding: msTeamsOauthOnboarding,
292
- proxyPolicy: {
293
- allowlist: [
294
- {
295
- host: "graph.microsoft.com",
296
- methods: ["GET", "POST", "PATCH", "DELETE"]
297
- }
298
- ]
299
- },
300
- systemPrompt: {
301
- en: `### Microsoft Teams API (OAuth)
302
-
303
- ### Available Endpoints (Microsoft Graph API v1.0)
304
- - GET \`/v1.0/me\` \u2014 Get current user info
305
- - GET \`/v1.0/me/joinedTeams\` \u2014 List joined teams
306
- - GET \`/v1.0/teams/{teamId}\` \u2014 Get a team
307
- - GET \`/v1.0/teams/{teamId}/channels\` \u2014 List channels
308
- - GET \`/v1.0/teams/{teamId}/channels/{channelId}\` \u2014 Get a channel
309
- - GET \`/v1.0/teams/{teamId}/channels/{channelId}/messages\` \u2014 List channel messages
310
- - POST \`/v1.0/teams/{teamId}/channels/{channelId}/messages\` \u2014 Send a channel message
311
- - GET \`/v1.0/teams/{teamId}/members\` \u2014 List team members
312
- - GET \`/v1.0/chats\` \u2014 List chats
313
- - GET \`/v1.0/chats/{chatId}/messages\` \u2014 List chat messages
314
- - POST \`/v1.0/chats/{chatId}/messages\` \u2014 Send a chat message
315
- - GET \`/v1.0/users\` \u2014 List users
316
-
317
- ### Query Parameters
318
- - \`$top\` \u2014 Number of results per page (max varies by endpoint)
319
- - \`$skip\` \u2014 Number of results to skip
320
- - \`$filter\` \u2014 OData filter expression
321
- - \`$select\` \u2014 Comma-separated list of properties to return
322
- - \`$orderby\` \u2014 Sort order
323
- - \`$expand\` \u2014 Related resources to include
324
-
325
- ### Tips
326
- - Pagination uses \`@odata.nextLink\` URL in the response
327
- - Use \`$select\` to limit response size
328
- - Channel messages require \`ChannelMessage.Read.All\` permission
329
- - Chat messages require \`Chat.Read\` permission
330
-
331
- ### Business Logic
332
-
333
- 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.
334
-
335
- #### Example
336
-
337
- \`\`\`ts
338
- import { connection } from "@squadbase/vite-server/connectors/microsoft-teams-oauth";
339
-
340
- const teams = connection("<connectionId>");
341
-
342
- // Authenticated fetch (returns standard Response)
343
- const res = await teams.request("/v1.0/me/joinedTeams");
344
- const data = await res.json();
345
- \`\`\``,
346
- ja: `### Microsoft Teams API (OAuth)
347
-
348
- ### \u5229\u7528\u53EF\u80FD\u306A\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8 (Microsoft Graph API v1.0)
349
- - GET \`/v1.0/me\` \u2014 \u73FE\u5728\u306E\u30E6\u30FC\u30B6\u30FC\u60C5\u5831\u3092\u53D6\u5F97
350
- - GET \`/v1.0/me/joinedTeams\` \u2014 \u53C2\u52A0\u3057\u3066\u3044\u308B\u30C1\u30FC\u30E0\u4E00\u89A7\u3092\u53D6\u5F97
351
- - GET \`/v1.0/teams/{teamId}\` \u2014 \u30C1\u30FC\u30E0\u3092\u53D6\u5F97
352
- - GET \`/v1.0/teams/{teamId}/channels\` \u2014 \u30C1\u30E3\u30CD\u30EB\u4E00\u89A7\u3092\u53D6\u5F97
353
- - GET \`/v1.0/teams/{teamId}/channels/{channelId}\` \u2014 \u30C1\u30E3\u30CD\u30EB\u3092\u53D6\u5F97
354
- - GET \`/v1.0/teams/{teamId}/channels/{channelId}/messages\` \u2014 \u30C1\u30E3\u30CD\u30EB\u30E1\u30C3\u30BB\u30FC\u30B8\u4E00\u89A7\u3092\u53D6\u5F97
355
- - POST \`/v1.0/teams/{teamId}/channels/{channelId}/messages\` \u2014 \u30C1\u30E3\u30CD\u30EB\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u9001\u4FE1
356
- - GET \`/v1.0/teams/{teamId}/members\` \u2014 \u30C1\u30FC\u30E0\u30E1\u30F3\u30D0\u30FC\u4E00\u89A7\u3092\u53D6\u5F97
357
- - GET \`/v1.0/chats\` \u2014 \u30C1\u30E3\u30C3\u30C8\u4E00\u89A7\u3092\u53D6\u5F97
358
- - GET \`/v1.0/chats/{chatId}/messages\` \u2014 \u30C1\u30E3\u30C3\u30C8\u30E1\u30C3\u30BB\u30FC\u30B8\u4E00\u89A7\u3092\u53D6\u5F97
359
- - POST \`/v1.0/chats/{chatId}/messages\` \u2014 \u30C1\u30E3\u30C3\u30C8\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u9001\u4FE1
360
- - GET \`/v1.0/users\` \u2014 \u30E6\u30FC\u30B6\u30FC\u4E00\u89A7\u3092\u53D6\u5F97
361
-
362
- ### \u30AF\u30A8\u30EA\u30D1\u30E9\u30E1\u30FC\u30BF
363
- - \`$top\` \u2014 \u30DA\u30FC\u30B8\u3042\u305F\u308A\u306E\u7D50\u679C\u6570\uFF08\u6700\u5927\u5024\u306F\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8\u306B\u3088\u308A\u7570\u306A\u308B\uFF09
364
- - \`$skip\` \u2014 \u30B9\u30AD\u30C3\u30D7\u3059\u308B\u7D50\u679C\u6570
365
- - \`$filter\` \u2014 OData\u30D5\u30A3\u30EB\u30BF\u5F0F
366
- - \`$select\` \u2014 \u8FD4\u5374\u3059\u308B\u30D7\u30ED\u30D1\u30C6\u30A3\u306E\u30AB\u30F3\u30DE\u533A\u5207\u308A\u30EA\u30B9\u30C8
367
- - \`$orderby\` \u2014 \u30BD\u30FC\u30C8\u9806
368
- - \`$expand\` \u2014 \u542B\u3081\u308B\u95A2\u9023\u30EA\u30BD\u30FC\u30B9
369
-
370
- ### \u30D2\u30F3\u30C8
371
- - \u30DA\u30FC\u30B8\u30CD\u30FC\u30B7\u30E7\u30F3\u306F\u30EC\u30B9\u30DD\u30F3\u30B9\u5185\u306E \`@odata.nextLink\` URL\u3092\u4F7F\u7528\u3057\u307E\u3059
372
- - \u30EC\u30B9\u30DD\u30F3\u30B9\u30B5\u30A4\u30BA\u3092\u5236\u9650\u3059\u308B\u306B\u306F \`$select\` \u3092\u4F7F\u7528\u3057\u307E\u3059
373
- - \u30C1\u30E3\u30CD\u30EB\u30E1\u30C3\u30BB\u30FC\u30B8\u306B\u306F \`ChannelMessage.Read.All\` \u6A29\u9650\u304C\u5FC5\u8981\u3067\u3059
374
- - \u30C1\u30E3\u30C3\u30C8\u30E1\u30C3\u30BB\u30FC\u30B8\u306B\u306F \`Chat.Read\` \u6A29\u9650\u304C\u5FC5\u8981\u3067\u3059
375
-
376
- ### Business Logic
377
-
378
- \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\u30BFSDK\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
379
-
380
- #### Example
381
-
382
- \`\`\`ts
383
- import { connection } from "@squadbase/vite-server/connectors/microsoft-teams-oauth";
384
-
385
- const teams = connection("<connectionId>");
386
-
387
- // Authenticated fetch (returns standard Response)
388
- const res = await teams.request("/v1.0/me/joinedTeams");
389
- const data = await res.json();
390
- \`\`\``
391
- },
392
- tools,
393
- async checkConnection(_params, config) {
394
- const { proxyFetch } = config;
395
- try {
396
- const res = await proxyFetch("https://graph.microsoft.com/v1.0/me", {
397
- method: "GET"
398
- });
399
- if (!res.ok) {
400
- const errorText = await res.text().catch(() => res.statusText);
401
- return {
402
- success: false,
403
- error: `Microsoft Graph API failed: HTTP ${res.status} ${errorText}`
404
- };
405
- }
406
- return { success: true };
407
- } catch (error) {
408
- return {
409
- success: false,
410
- error: error instanceof Error ? error.message : String(error)
411
- };
412
- }
413
- }
414
- });
415
-
416
- // src/connectors/create-connector-sdk.ts
417
- import { readFileSync } from "fs";
418
- import path from "path";
419
-
420
- // src/connector-client/env.ts
421
- function resolveEnvVar(entry, key, connectionId) {
422
- const envVarName = entry.envVars[key];
423
- if (!envVarName) {
424
- throw new Error(`Connection "${connectionId}" is missing envVars mapping for key "${key}"`);
425
- }
426
- const value = process.env[envVarName];
427
- if (!value) {
428
- throw new Error(`Environment variable "${envVarName}" (for connection "${connectionId}", key "${key}") is not set`);
429
- }
430
- return value;
431
- }
432
- function resolveEnvVarOptional(entry, key) {
433
- const envVarName = entry.envVars[key];
434
- if (!envVarName) return void 0;
435
- return process.env[envVarName] || void 0;
436
- }
437
-
438
- // src/connectors/create-connector-sdk.ts
439
- function loadConnectionsSync() {
440
- const filePath = process.env.CONNECTIONS_PATH ?? path.join(process.cwd(), ".squadbase/connections.json");
441
- try {
442
- const raw = readFileSync(filePath, "utf-8");
443
- return JSON.parse(raw);
444
- } catch {
445
- return {};
446
- }
447
- }
448
- function createConnectorSdk(plugin, createClient2) {
449
- return (connectionId) => {
450
- const connections = loadConnectionsSync();
451
- const entry = connections[connectionId];
452
- if (!entry) {
453
- throw new Error(
454
- `Connection "${connectionId}" not found in .squadbase/connections.json`
455
- );
456
- }
457
- if (entry.connector.slug !== plugin.slug) {
458
- throw new Error(
459
- `Connection "${connectionId}" is not a ${plugin.slug} connection (got "${entry.connector.slug}")`
460
- );
461
- }
462
- const params = {};
463
- for (const param of Object.values(plugin.parameters)) {
464
- if (param.required) {
465
- params[param.slug] = resolveEnvVar(entry, param.slug, connectionId);
466
- } else {
467
- const val = resolveEnvVarOptional(entry, param.slug);
468
- if (val !== void 0) params[param.slug] = val;
469
- }
470
- }
471
- return createClient2(params);
472
- };
473
- }
474
-
475
- // src/connectors/entries/microsoft-teams-oauth.ts
476
- var connection = createConnectorSdk(msTeamsOauthConnector, createClient);
477
- export {
478
- connection
479
- };