@squadbase/vite-server 0.1.3-dev.3 → 0.1.3-dev.5

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 (50) hide show
  1. package/dist/cli/index.js +2511 -2128
  2. package/dist/connectors/airtable-oauth.js +3 -2
  3. package/dist/connectors/airtable.js +11 -1
  4. package/dist/connectors/amplitude.js +11 -1
  5. package/dist/connectors/anthropic.js +11 -1
  6. package/dist/connectors/asana.js +11 -1
  7. package/dist/connectors/attio.js +11 -1
  8. package/dist/connectors/customerio.js +11 -1
  9. package/dist/connectors/dbt.js +11 -1
  10. package/dist/connectors/gemini.js +11 -1
  11. package/dist/connectors/gmail-oauth.js +3 -2
  12. package/dist/connectors/google-ads-oauth.js +3 -2
  13. package/dist/connectors/google-ads.js +11 -1
  14. package/dist/connectors/google-analytics-oauth.js +3 -2
  15. package/dist/connectors/google-analytics.js +11 -1
  16. package/dist/connectors/{microsoft-teams.d.ts → google-calendar-oauth.d.ts} +1 -1
  17. package/dist/connectors/google-calendar-oauth.js +744 -0
  18. package/dist/connectors/{slack.d.ts → google-calendar.d.ts} +1 -1
  19. package/dist/connectors/google-calendar.js +655 -0
  20. package/dist/connectors/google-sheets-oauth.js +3 -2
  21. package/dist/connectors/google-sheets.js +11 -1
  22. package/dist/connectors/hubspot-oauth.js +3 -2
  23. package/dist/connectors/hubspot.js +5 -4
  24. package/dist/connectors/intercom-oauth.js +3 -2
  25. package/dist/connectors/intercom.js +11 -1
  26. package/dist/connectors/jira-api-key.js +3 -2
  27. package/dist/connectors/kintone-api-token.js +3 -2
  28. package/dist/connectors/kintone.js +12 -2
  29. package/dist/connectors/linkedin-ads-oauth.js +3 -2
  30. package/dist/connectors/linkedin-ads.js +11 -1
  31. package/dist/connectors/mailchimp-oauth.js +2 -1
  32. package/dist/connectors/mailchimp.js +11 -1
  33. package/dist/connectors/notion-oauth.js +3 -2
  34. package/dist/connectors/notion.js +11 -1
  35. package/dist/connectors/openai.js +11 -1
  36. package/dist/connectors/shopify-oauth.js +3 -2
  37. package/dist/connectors/shopify.js +11 -1
  38. package/dist/connectors/{microsoft-teams-oauth.d.ts → stripe-api-key.d.ts} +1 -1
  39. package/dist/connectors/stripe-api-key.js +527 -0
  40. package/dist/connectors/stripe-oauth.js +3 -2
  41. package/dist/connectors/wix-store.js +11 -1
  42. package/dist/connectors/zendesk-oauth.js +3 -2
  43. package/dist/connectors/zendesk.js +11 -1
  44. package/dist/index.js +2508 -2125
  45. package/dist/main.js +2508 -2125
  46. package/dist/vite-plugin.js +2508 -2125
  47. package/package.json +13 -1
  48. package/dist/connectors/microsoft-teams-oauth.js +0 -479
  49. package/dist/connectors/microsoft-teams.js +0 -381
  50. package/dist/connectors/slack.js +0 -362
@@ -1,381 +0,0 @@
1
- // ../connectors/src/parameter-definition.ts
2
- var ParameterDefinition = class {
3
- slug;
4
- name;
5
- description;
6
- envVarBaseKey;
7
- type;
8
- secret;
9
- required;
10
- constructor(config) {
11
- this.slug = config.slug;
12
- this.name = config.name;
13
- this.description = config.description;
14
- this.envVarBaseKey = config.envVarBaseKey;
15
- this.type = config.type;
16
- this.secret = config.secret;
17
- this.required = config.required;
18
- }
19
- /**
20
- * Get the parameter value from a ConnectorConnectionObject.
21
- */
22
- getValue(connection2) {
23
- const param = connection2.parameters.find(
24
- (p) => p.parameterSlug === this.slug
25
- );
26
- if (!param || param.value == null) {
27
- throw new Error(
28
- `Parameter "${this.slug}" not found or has no value in connection "${connection2.id}"`
29
- );
30
- }
31
- return param.value;
32
- }
33
- /**
34
- * Try to get the parameter value. Returns undefined if not found (for optional params).
35
- */
36
- tryGetValue(connection2) {
37
- const param = connection2.parameters.find(
38
- (p) => p.parameterSlug === this.slug
39
- );
40
- if (!param || param.value == null) return void 0;
41
- return param.value;
42
- }
43
- };
44
-
45
- // ../connectors/src/connectors/ms-teams/parameters.ts
46
- var parameters = {
47
- clientId: new ParameterDefinition({
48
- slug: "client-id",
49
- name: "Azure AD Client ID",
50
- description: "The Application (client) ID from your Azure AD app registration. Required API Permissions (Application type, admin consent required): Team.ReadBasic.All, Channel.ReadBasic.All, ChannelMessage.Read.All, Chat.Read.All, User.Read.All (or their higher-level equivalents such as Team.Read.All, Channel.Read.All, etc.)",
51
- envVarBaseKey: "MS_TEAMS_CLIENT_ID",
52
- type: "text",
53
- secret: false,
54
- required: true
55
- }),
56
- tenantId: new ParameterDefinition({
57
- slug: "tenant-id",
58
- name: "Azure AD Tenant ID",
59
- description: "The Directory (tenant) ID from your Azure AD app registration.",
60
- envVarBaseKey: "MS_TEAMS_TENANT_ID",
61
- type: "text",
62
- secret: false,
63
- required: true
64
- }),
65
- clientSecret: new ParameterDefinition({
66
- slug: "client-secret",
67
- name: "Azure AD Client Secret",
68
- description: "The client secret from your Azure AD app registration.",
69
- envVarBaseKey: "MS_TEAMS_CLIENT_SECRET",
70
- type: "text",
71
- secret: true,
72
- required: true
73
- })
74
- };
75
-
76
- // ../connectors/src/connectors/ms-teams/sdk/index.ts
77
- function createClient(params) {
78
- const clientId = params[parameters.clientId.slug];
79
- const clientSecret = params[parameters.clientSecret.slug];
80
- const tenantId = params[parameters.tenantId.slug];
81
- if (!clientId) {
82
- throw new Error(
83
- `ms-teams: missing required parameter: ${parameters.clientId.slug}`
84
- );
85
- }
86
- if (!clientSecret) {
87
- throw new Error(
88
- `ms-teams: missing required parameter: ${parameters.clientSecret.slug}`
89
- );
90
- }
91
- if (!tenantId) {
92
- throw new Error(
93
- `ms-teams: missing required parameter: ${parameters.tenantId.slug}`
94
- );
95
- }
96
- return { clientId, clientSecret, tenantId };
97
- }
98
-
99
- // ../connectors/src/connector-plugin.ts
100
- var ConnectorPlugin = class _ConnectorPlugin {
101
- slug;
102
- authType;
103
- name;
104
- description;
105
- iconUrl;
106
- parameters;
107
- releaseFlag;
108
- proxyPolicy;
109
- experimentalAttributes;
110
- onboarding;
111
- systemPrompt;
112
- tools;
113
- query;
114
- checkConnection;
115
- constructor(config) {
116
- this.slug = config.slug;
117
- this.authType = config.authType;
118
- this.name = config.name;
119
- this.description = config.description;
120
- this.iconUrl = config.iconUrl;
121
- this.parameters = config.parameters;
122
- this.releaseFlag = config.releaseFlag;
123
- this.proxyPolicy = config.proxyPolicy;
124
- this.experimentalAttributes = config.experimentalAttributes;
125
- this.onboarding = config.onboarding;
126
- this.systemPrompt = config.systemPrompt;
127
- this.tools = config.tools;
128
- this.query = config.query;
129
- this.checkConnection = config.checkConnection;
130
- }
131
- get connectorKey() {
132
- return _ConnectorPlugin.deriveKey(this.slug, this.authType);
133
- }
134
- /**
135
- * Create tools for connections that belong to this connector.
136
- * Filters connections by connectorKey internally.
137
- * Returns tools keyed as `${connectorKey}_${toolName}`.
138
- */
139
- createTools(connections, config) {
140
- const myConnections = connections.filter(
141
- (c) => _ConnectorPlugin.deriveKey(c.connector.slug, c.connector.authType) === this.connectorKey
142
- );
143
- const result = {};
144
- for (const t of Object.values(this.tools)) {
145
- result[`${this.connectorKey}_${t.name}`] = t.createTool(
146
- myConnections,
147
- config
148
- );
149
- }
150
- return result;
151
- }
152
- static deriveKey(slug, authType) {
153
- return authType ? `${slug}-${authType}` : slug;
154
- }
155
- };
156
-
157
- // ../connectors/src/connectors/ms-teams/index.ts
158
- var tools = {};
159
- var msTeamsConnector = new ConnectorPlugin({
160
- slug: "microsoft-teams",
161
- authType: null,
162
- name: "Microsoft Teams",
163
- description: "Connect to Microsoft Teams for messaging, channels, and team data.",
164
- iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/6QM1sVuqarTJAB2UihVNQ9/12b8353c9b022916d72ef0f53349bae2/microsoft-teams-icon.svg",
165
- parameters,
166
- releaseFlag: { dev1: true, dev2: false, prod: false },
167
- systemPrompt: {
168
- en: `### Microsoft Teams SDK (TypeScript handler)
169
- Use the Microsoft Teams connector via the SDK in TypeScript handlers:
170
-
171
- \`\`\`ts
172
- import { connection } from "@squadbase/vite-server/connectors/microsoft-teams";
173
-
174
- const { clientId, clientSecret, tenantId } = connection("<connectionId>");
175
-
176
- // 1. Get an access token using client credentials flow
177
- const tokenRes = await fetch(
178
- \`https://login.microsoftonline.com/\${tenantId}/oauth2/v2.0/token\`,
179
- {
180
- method: "POST",
181
- headers: { "Content-Type": "application/x-www-form-urlencoded" },
182
- body: new URLSearchParams({
183
- client_id: clientId,
184
- client_secret: clientSecret,
185
- scope: "https://graph.microsoft.com/.default",
186
- grant_type: "client_credentials",
187
- }),
188
- },
189
- );
190
- const { access_token } = await tokenRes.json();
191
-
192
- // 2. Call the Microsoft Graph API
193
- const res = await fetch("https://graph.microsoft.com/v1.0/teams", {
194
- headers: { Authorization: \`Bearer \${access_token}\` },
195
- });
196
- const data = await res.json();
197
- \`\`\`
198
-
199
- ### Common Endpoints (Base URL: https://graph.microsoft.com/v1.0)
200
- - GET \`/teams\` \u2014 List all teams
201
- - GET \`/teams/{id}\` \u2014 Get a team
202
- - GET \`/teams/{id}/channels\` \u2014 List channels
203
- - GET \`/teams/{id}/channels/{id}/messages\` \u2014 List channel messages
204
- - POST \`/teams/{id}/channels/{id}/messages\` \u2014 Send a channel message
205
- - GET \`/teams/{id}/members\` \u2014 List team members
206
- - GET \`/chats\` \u2014 List chats
207
- - GET \`/chats/{id}/messages\` \u2014 List chat messages
208
- - POST \`/chats/{id}/messages\` \u2014 Send a chat message
209
- - GET \`/users\` \u2014 List users
210
-
211
- ### Query Parameters
212
- - \`$top\` \u2014 Number of results per page
213
- - \`$skip\` \u2014 Number of results to skip
214
- - \`$filter\` \u2014 OData filter expression
215
- - \`$select\` \u2014 Comma-separated list of properties to return
216
- - \`$orderby\` \u2014 Sort order
217
-
218
- ### Tips
219
- - Use the client credentials flow to get an access token
220
- - Application permissions require admin consent in Azure AD
221
- - Pagination uses \`@odata.nextLink\` URL in the response
222
- - Required API permissions: Team.ReadBasic.All, Channel.ReadBasic.All, ChannelMessage.Read.All, Chat.Read.All, User.Read.All
223
-
224
- ### Important: Permission Validation (MUST DO FIRST)
225
- Before creating any dashboard or data server logics, you MUST first create a **permission check server logic** to validate that the Azure AD app has the required permissions:
226
-
227
- 1. Create a server logic that uses \`connection("<connectionId>")\` to obtain the credentials, then acquires an access token and calls \`GET /teams\` and \`GET /users\`
228
- 2. Run this permission check server logic and inspect the results
229
- 3. **If ANY of these calls return an empty array (\`{ "value": [] }\`) or an error, STOP immediately** and inform the user:
230
- - "Your Azure AD app registration appears to be missing required API permissions. Microsoft Graph API returns empty results when permissions are not granted."
231
- - "Please go to Azure Portal > App registrations > [Your App] > API permissions and add the following **Application** permissions (not Delegated), then click 'Grant admin consent':"
232
- - Team.ReadBasic.All (or Team.Read.All), Channel.ReadBasic.All (or Channel.Read.All), ChannelMessage.Read.All (or ChannelMessage.ReadWrite.All), Chat.Read.All (or Chat.ReadWrite.All), User.Read.All (or User.ReadWrite.All)
233
- - **Do NOT proceed with setup or create further server logics until the user confirms permissions have been granted and you can verify non-empty results.**
234
- 4. Only proceed with data exploration and dashboard server logic creation after confirming that the permission check returns actual data (non-empty arrays)
235
-
236
- ### Troubleshooting
237
- - If the token request returns an error, verify that the Client ID, Client Secret, and Tenant ID are correct
238
- - **If Graph API returns 200 OK but with empty results** (\`{ "value": [] }\`), this almost always means the Azure AD app is missing required Application permissions or admin consent has not been granted. Do NOT interpret empty results as "no data yet" \u2014 treat it as a permission issue and ask the user to verify permissions in Azure Portal
239
- - If Graph API returns **403 Forbidden**, the Azure AD app is missing required Application permissions or admin consent has not been granted. Ask the user to go to Azure Portal > App registrations > API permissions and grant admin consent for the required permissions (or their higher-level equivalents): Team.ReadBasic.All, Channel.ReadBasic.All, ChannelMessage.Read.All, Chat.Read.All, User.Read.All
240
- - If Graph API returns **401 Unauthorized**, the access token may be invalid or expired \u2014 re-acquire it using the client credentials flow`,
241
- ja: `### Microsoft Teams SDK\uFF08TypeScript\u30CF\u30F3\u30C9\u30E9\u30FC\uFF09
242
- TypeScript\u30CF\u30F3\u30C9\u30E9\u30FC\u3067Microsoft Teams\u30B3\u30CD\u30AF\u30BF\u30FC\u3092SDK\u7D4C\u7531\u3067\u4F7F\u7528\u3057\u307E\u3059\uFF1A
243
-
244
- \`\`\`ts
245
- import { connection } from "@squadbase/vite-server/connectors/microsoft-teams";
246
-
247
- const { clientId, clientSecret, tenantId } = connection("<connectionId>");
248
-
249
- // 1. \u30AF\u30E9\u30A4\u30A2\u30F3\u30C8\u8CC7\u683C\u60C5\u5831\u30D5\u30ED\u30FC\u3067\u30A2\u30AF\u30BB\u30B9\u30C8\u30FC\u30AF\u30F3\u3092\u53D6\u5F97
250
- const tokenRes = await fetch(
251
- \`https://login.microsoftonline.com/\${tenantId}/oauth2/v2.0/token\`,
252
- {
253
- method: "POST",
254
- headers: { "Content-Type": "application/x-www-form-urlencoded" },
255
- body: new URLSearchParams({
256
- client_id: clientId,
257
- client_secret: clientSecret,
258
- scope: "https://graph.microsoft.com/.default",
259
- grant_type: "client_credentials",
260
- }),
261
- },
262
- );
263
- const { access_token } = await tokenRes.json();
264
-
265
- // 2. Microsoft Graph API\u3092\u547C\u3073\u51FA\u3059
266
- const res = await fetch("https://graph.microsoft.com/v1.0/teams", {
267
- headers: { Authorization: \`Bearer \${access_token}\` },
268
- });
269
- const data = await res.json();
270
- \`\`\`
271
-
272
- ### \u4E3B\u8981\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8\uFF08\u30D9\u30FC\u30B9URL: https://graph.microsoft.com/v1.0\uFF09
273
- - GET \`/teams\` \u2014 \u5168\u30C1\u30FC\u30E0\u4E00\u89A7
274
- - GET \`/teams/{id}\` \u2014 \u30C1\u30FC\u30E0\u306E\u53D6\u5F97
275
- - GET \`/teams/{id}/channels\` \u2014 \u30C1\u30E3\u30CD\u30EB\u4E00\u89A7
276
- - GET \`/teams/{id}/channels/{id}/messages\` \u2014 \u30C1\u30E3\u30CD\u30EB\u30E1\u30C3\u30BB\u30FC\u30B8\u4E00\u89A7
277
- - POST \`/teams/{id}/channels/{id}/messages\` \u2014 \u30C1\u30E3\u30CD\u30EB\u30E1\u30C3\u30BB\u30FC\u30B8\u306E\u9001\u4FE1
278
- - GET \`/teams/{id}/members\` \u2014 \u30C1\u30FC\u30E0\u30E1\u30F3\u30D0\u30FC\u4E00\u89A7
279
- - GET \`/chats\` \u2014 \u30C1\u30E3\u30C3\u30C8\u4E00\u89A7
280
- - GET \`/chats/{id}/messages\` \u2014 \u30C1\u30E3\u30C3\u30C8\u30E1\u30C3\u30BB\u30FC\u30B8\u4E00\u89A7
281
- - POST \`/chats/{id}/messages\` \u2014 \u30C1\u30E3\u30C3\u30C8\u30E1\u30C3\u30BB\u30FC\u30B8\u306E\u9001\u4FE1
282
- - GET \`/users\` \u2014 \u30E6\u30FC\u30B6\u30FC\u4E00\u89A7
283
-
284
- ### \u30AF\u30A8\u30EA\u30D1\u30E9\u30E1\u30FC\u30BF
285
- - \`$top\` \u2014 \u30DA\u30FC\u30B8\u3042\u305F\u308A\u306E\u7D50\u679C\u6570
286
- - \`$skip\` \u2014 \u30B9\u30AD\u30C3\u30D7\u3059\u308B\u7D50\u679C\u6570
287
- - \`$filter\` \u2014 OData\u30D5\u30A3\u30EB\u30BF\u30FC\u5F0F
288
- - \`$select\` \u2014 \u8FD4\u5374\u3059\u308B\u30D7\u30ED\u30D1\u30C6\u30A3\u306E\u30AB\u30F3\u30DE\u533A\u5207\u308A\u30EA\u30B9\u30C8
289
- - \`$orderby\` \u2014 \u30BD\u30FC\u30C8\u9806
290
-
291
- ### \u30D2\u30F3\u30C8
292
- - \u30AF\u30E9\u30A4\u30A2\u30F3\u30C8\u8CC7\u683C\u60C5\u5831\u30D5\u30ED\u30FC\u3092\u4F7F\u7528\u3057\u3066\u30A2\u30AF\u30BB\u30B9\u30C8\u30FC\u30AF\u30F3\u3092\u53D6\u5F97\u3057\u307E\u3059
293
- - \u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3\u6A29\u9650\u306B\u306FAzure AD\u3067\u306E\u7BA1\u7406\u8005\u540C\u610F\u304C\u5FC5\u8981\u3067\u3059
294
- - \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
295
- - \u5FC5\u8981\u306AAPI\u6A29\u9650: Team.ReadBasic.All, Channel.ReadBasic.All, ChannelMessage.Read.All, Chat.Read.All, User.Read.All
296
-
297
- ### \u91CD\u8981: \u6A29\u9650\u306E\u691C\u8A3C\uFF08\u6700\u521D\u306B\u5FC5\u305A\u5B9F\u884C\uFF09
298
- \u30C0\u30C3\u30B7\u30E5\u30DC\u30FC\u30C9\u3084\u30C7\u30FC\u30BF\u30B5\u30FC\u30D0\u30FC\u30ED\u30B8\u30C3\u30AF\u3092\u4F5C\u6210\u3059\u308B\u524D\u306B\u3001\u307E\u305A**\u6A29\u9650\u30C1\u30A7\u30C3\u30AF\u7528\u30B5\u30FC\u30D0\u30FC\u30ED\u30B8\u30C3\u30AF**\u3092\u4F5C\u6210\u3057\u3066\u3001Azure AD\u30A2\u30D7\u30EA\u306B\u5FC5\u8981\u306A\u6A29\u9650\u304C\u3042\u308B\u3053\u3068\u3092\u691C\u8A3C\u3057\u3066\u304F\u3060\u3055\u3044\uFF1A
299
-
300
- 1. \`connection("<connectionId>")\`\u3067\u8CC7\u683C\u60C5\u5831\u3092\u53D6\u5F97\u3057\u3001\u30A2\u30AF\u30BB\u30B9\u30C8\u30FC\u30AF\u30F3\u3092\u53D6\u5F97\u3057\u3066\`GET /teams\`\u3068\`GET /users\`\u3092\u547C\u3073\u51FA\u3059\u30B5\u30FC\u30D0\u30FC\u30ED\u30B8\u30C3\u30AF\u3092\u4F5C\u6210
301
- 2. \u3053\u306E\u6A29\u9650\u30C1\u30A7\u30C3\u30AF\u7528\u30B5\u30FC\u30D0\u30FC\u30ED\u30B8\u30C3\u30AF\u3092\u5B9F\u884C\u3057\u3066\u7D50\u679C\u3092\u78BA\u8A8D
302
- 3. **\u3053\u308C\u3089\u306E\u547C\u3073\u51FA\u3057\u306E\u3044\u305A\u308C\u304B\u304C\u7A7A\u306E\u914D\u5217\uFF08\`{ "value": [] }\`\uFF09\u307E\u305F\u306F\u30A8\u30E9\u30FC\u3092\u8FD4\u3059\u5834\u5408\u3001\u76F4\u3061\u306B\u4E2D\u6B62**\u3057\u3066\u30E6\u30FC\u30B6\u30FC\u306B\u901A\u77E5\uFF1A
303
- - \u300CAzure AD\u30A2\u30D7\u30EA\u306E\u767B\u9332\u306B\u5FC5\u8981\u306AAPI\u6A29\u9650\u304C\u4E0D\u8DB3\u3057\u3066\u3044\u308B\u3088\u3046\u3067\u3059\u3002\u6A29\u9650\u304C\u4ED8\u4E0E\u3055\u308C\u3066\u3044\u306A\u3044\u5834\u5408\u3001Microsoft Graph API\u306F\u7A7A\u306E\u7D50\u679C\u3092\u8FD4\u3057\u307E\u3059\u3002\u300D
304
- - \u300CAzure\u30DD\u30FC\u30BF\u30EB > \u30A2\u30D7\u30EA\u306E\u767B\u9332 > [\u30A2\u30D7\u30EA\u540D] > API\u6A29\u9650\u3067\u3001\u4EE5\u4E0B\u306E**\u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3**\u6A29\u9650\uFF08\u59D4\u4EFB\u3067\u306F\u306A\u3044\uFF09\u3092\u8FFD\u52A0\u3057\u3001\u300E\u7BA1\u7406\u8005\u306E\u540C\u610F\u3092\u4ED8\u4E0E\u300F\u3092\u30AF\u30EA\u30C3\u30AF\u3057\u3066\u304F\u3060\u3055\u3044\uFF1A\u300D
305
- - Team.ReadBasic.All\uFF08\u307E\u305F\u306FTeam.Read.All\uFF09\u3001Channel.ReadBasic.All\uFF08\u307E\u305F\u306FChannel.Read.All\uFF09\u3001ChannelMessage.Read.All\uFF08\u307E\u305F\u306FChannelMessage.ReadWrite.All\uFF09\u3001Chat.Read.All\uFF08\u307E\u305F\u306FChat.ReadWrite.All\uFF09\u3001User.Read.All\uFF08\u307E\u305F\u306FUser.ReadWrite.All\uFF09
306
- - **\u30E6\u30FC\u30B6\u30FC\u304C\u6A29\u9650\u306E\u4ED8\u4E0E\u3092\u78BA\u8A8D\u3057\u3001\u7A7A\u3067\u306A\u3044\u7D50\u679C\u304C\u78BA\u8A8D\u3067\u304D\u308B\u307E\u3067\u3001\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u306E\u7D9A\u884C\u3084\u30B5\u30FC\u30D0\u30FC\u30ED\u30B8\u30C3\u30AF\u306E\u8FFD\u52A0\u4F5C\u6210\u3092\u884C\u308F\u306A\u3044\u3067\u304F\u3060\u3055\u3044\u3002**
307
- 4. \u6A29\u9650\u30C1\u30A7\u30C3\u30AF\u304C\u5B9F\u969B\u306E\u30C7\u30FC\u30BF\uFF08\u7A7A\u3067\u306A\u3044\u914D\u5217\uFF09\u3092\u8FD4\u3059\u3053\u3068\u3092\u78BA\u8A8D\u3057\u3066\u304B\u3089\u3001\u30C7\u30FC\u30BF\u306E\u63A2\u7D22\u3068\u30C0\u30C3\u30B7\u30E5\u30DC\u30FC\u30C9\u7528\u30B5\u30FC\u30D0\u30FC\u30ED\u30B8\u30C3\u30AF\u306E\u4F5C\u6210\u306B\u9032\u3080
308
-
309
- ### \u30C8\u30E9\u30D6\u30EB\u30B7\u30E5\u30FC\u30C6\u30A3\u30F3\u30B0
310
- - \u30C8\u30FC\u30AF\u30F3\u30EA\u30AF\u30A8\u30B9\u30C8\u304C\u30A8\u30E9\u30FC\u3092\u8FD4\u3059\u5834\u5408\u3001\u30AF\u30E9\u30A4\u30A2\u30F3\u30C8ID\u3001\u30AF\u30E9\u30A4\u30A2\u30F3\u30C8\u30B7\u30FC\u30AF\u30EC\u30C3\u30C8\u3001\u30C6\u30CA\u30F3\u30C8ID\u304C\u6B63\u3057\u3044\u304B\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044
311
- - **Graph API\u304C200 OK\u3092\u8FD4\u3059\u304C\u7D50\u679C\u304C\u7A7A\u306E\u5834\u5408**\uFF08\`{ "value": [] }\`\uFF09\u3001\u307B\u307C\u78BA\u5B9F\u306BAzure AD\u30A2\u30D7\u30EA\u306B\u5FC5\u8981\u306A\u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3\u6A29\u9650\u304C\u4E0D\u8DB3\u3057\u3066\u3044\u308B\u304B\u3001\u7BA1\u7406\u8005\u540C\u610F\u304C\u4ED8\u4E0E\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002\u7A7A\u306E\u7D50\u679C\u3092\u300C\u307E\u3060\u30C7\u30FC\u30BF\u304C\u306A\u3044\u300D\u3068\u89E3\u91C8\u305B\u305A\u3001\u6A29\u9650\u306E\u554F\u984C\u3068\u3057\u3066\u6271\u3044\u3001\u30E6\u30FC\u30B6\u30FC\u306BAzure\u30DD\u30FC\u30BF\u30EB\u3067\u6A29\u9650\u3092\u78BA\u8A8D\u3059\u308B\u3088\u3046\u4F9D\u983C\u3057\u3066\u304F\u3060\u3055\u3044
312
- - Graph API\u304C**403 Forbidden**\u3092\u8FD4\u3059\u5834\u5408\u3001Azure AD\u30A2\u30D7\u30EA\u306B\u5FC5\u8981\u306A\u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3\u6A29\u9650\u304C\u4E0D\u8DB3\u3057\u3066\u3044\u308B\u304B\u3001\u7BA1\u7406\u8005\u540C\u610F\u304C\u4ED8\u4E0E\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002\u30E6\u30FC\u30B6\u30FC\u306BAzure\u30DD\u30FC\u30BF\u30EB > \u30A2\u30D7\u30EA\u306E\u767B\u9332 > API\u6A29\u9650\u3067\u3001\u5FC5\u8981\u306A\u6A29\u9650\uFF08\u307E\u305F\u306F\u305D\u308C\u4EE5\u4E0A\u306E\u6A29\u9650\uFF09\u306E\u7BA1\u7406\u8005\u540C\u610F\u3092\u4ED8\u4E0E\u3059\u308B\u3088\u3046\u4F9D\u983C\u3057\u3066\u304F\u3060\u3055\u3044: Team.ReadBasic.All, Channel.ReadBasic.All, ChannelMessage.Read.All, Chat.Read.All, User.Read.All
313
- - Graph API\u304C**401 Unauthorized**\u3092\u8FD4\u3059\u5834\u5408\u3001\u30A2\u30AF\u30BB\u30B9\u30C8\u30FC\u30AF\u30F3\u304C\u7121\u52B9\u307E\u305F\u306F\u671F\u9650\u5207\u308C\u306E\u53EF\u80FD\u6027\u304C\u3042\u308A\u307E\u3059\u3002\u30AF\u30E9\u30A4\u30A2\u30F3\u30C8\u8CC7\u683C\u60C5\u5831\u30D5\u30ED\u30FC\u3067\u518D\u53D6\u5F97\u3057\u3066\u304F\u3060\u3055\u3044`
314
- },
315
- tools
316
- });
317
-
318
- // src/connectors/create-connector-sdk.ts
319
- import { readFileSync } from "fs";
320
- import path from "path";
321
-
322
- // src/connector-client/env.ts
323
- function resolveEnvVar(entry, key, connectionId) {
324
- const envVarName = entry.envVars[key];
325
- if (!envVarName) {
326
- throw new Error(`Connection "${connectionId}" is missing envVars mapping for key "${key}"`);
327
- }
328
- const value = process.env[envVarName];
329
- if (!value) {
330
- throw new Error(`Environment variable "${envVarName}" (for connection "${connectionId}", key "${key}") is not set`);
331
- }
332
- return value;
333
- }
334
- function resolveEnvVarOptional(entry, key) {
335
- const envVarName = entry.envVars[key];
336
- if (!envVarName) return void 0;
337
- return process.env[envVarName] || void 0;
338
- }
339
-
340
- // src/connectors/create-connector-sdk.ts
341
- function loadConnectionsSync() {
342
- const filePath = process.env.CONNECTIONS_PATH ?? path.join(process.cwd(), ".squadbase/connections.json");
343
- try {
344
- const raw = readFileSync(filePath, "utf-8");
345
- return JSON.parse(raw);
346
- } catch {
347
- return {};
348
- }
349
- }
350
- function createConnectorSdk(plugin, createClient2) {
351
- return (connectionId) => {
352
- const connections = loadConnectionsSync();
353
- const entry = connections[connectionId];
354
- if (!entry) {
355
- throw new Error(
356
- `Connection "${connectionId}" not found in .squadbase/connections.json`
357
- );
358
- }
359
- if (entry.connector.slug !== plugin.slug) {
360
- throw new Error(
361
- `Connection "${connectionId}" is not a ${plugin.slug} connection (got "${entry.connector.slug}")`
362
- );
363
- }
364
- const params = {};
365
- for (const param of Object.values(plugin.parameters)) {
366
- if (param.required) {
367
- params[param.slug] = resolveEnvVar(entry, param.slug, connectionId);
368
- } else {
369
- const val = resolveEnvVarOptional(entry, param.slug);
370
- if (val !== void 0) params[param.slug] = val;
371
- }
372
- }
373
- return createClient2(params);
374
- };
375
- }
376
-
377
- // src/connectors/entries/microsoft-teams.ts
378
- var connection = createConnectorSdk(msTeamsConnector, createClient);
379
- export {
380
- connection
381
- };