@squadbase/vite-server 0.1.3-dev.4 → 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 +2317 -2227
  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/{slack.d.ts → google-calendar-oauth.d.ts} +1 -1
  17. package/dist/connectors/google-calendar-oauth.js +744 -0
  18. package/dist/connectors/{microsoft-teams-oauth.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 +2 -1
  23. package/dist/connectors/hubspot.js +11 -1
  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/stripe-api-key.js +3 -2
  39. package/dist/connectors/stripe-oauth.js +3 -2
  40. package/dist/connectors/wix-store.js +11 -1
  41. package/dist/connectors/zendesk-oauth.js +3 -2
  42. package/dist/connectors/zendesk.js +11 -1
  43. package/dist/index.js +2312 -2222
  44. package/dist/main.js +2312 -2222
  45. package/dist/vite-plugin.js +2312 -2222
  46. package/package.json +9 -1
  47. package/dist/connectors/microsoft-teams-oauth.js +0 -479
  48. package/dist/connectors/microsoft-teams.d.ts +0 -5
  49. package/dist/connectors/microsoft-teams.js +0 -381
  50. package/dist/connectors/slack.js +0 -362
@@ -1,362 +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/slack/parameters.ts
46
- var parameters = {
47
- botToken: new ParameterDefinition({
48
- slug: "bot-token",
49
- name: "Slack Bot Token",
50
- description: "The Slack bot token for authentication (starts with xoxb-).",
51
- envVarBaseKey: "SLACK_BOT_TOKEN",
52
- type: "text",
53
- secret: true,
54
- required: true
55
- })
56
- };
57
-
58
- // ../connectors/src/connectors/slack/sdk/index.ts
59
- function createClient(params) {
60
- const botToken = params[parameters.botToken.slug];
61
- if (!botToken) {
62
- throw new Error(
63
- `slack: missing required parameter: ${parameters.botToken.slug}`
64
- );
65
- }
66
- return { botToken };
67
- }
68
-
69
- // ../connectors/src/connector-onboarding.ts
70
- var ConnectorOnboarding = class {
71
- /** Phase 1: Connection setup instructions (optional — some connectors don't need this) */
72
- connectionSetupInstructions;
73
- /** Phase 2: Data overview instructions */
74
- dataOverviewInstructions;
75
- constructor(config) {
76
- this.connectionSetupInstructions = config.connectionSetupInstructions;
77
- this.dataOverviewInstructions = config.dataOverviewInstructions;
78
- }
79
- getConnectionSetupPrompt(language) {
80
- return this.connectionSetupInstructions?.[language] ?? null;
81
- }
82
- getDataOverviewInstructions(language) {
83
- return this.dataOverviewInstructions[language];
84
- }
85
- };
86
-
87
- // ../connectors/src/connector-plugin.ts
88
- var ConnectorPlugin = class _ConnectorPlugin {
89
- slug;
90
- authType;
91
- name;
92
- description;
93
- iconUrl;
94
- parameters;
95
- releaseFlag;
96
- proxyPolicy;
97
- experimentalAttributes;
98
- onboarding;
99
- systemPrompt;
100
- tools;
101
- query;
102
- checkConnection;
103
- constructor(config) {
104
- this.slug = config.slug;
105
- this.authType = config.authType;
106
- this.name = config.name;
107
- this.description = config.description;
108
- this.iconUrl = config.iconUrl;
109
- this.parameters = config.parameters;
110
- this.releaseFlag = config.releaseFlag;
111
- this.proxyPolicy = config.proxyPolicy;
112
- this.experimentalAttributes = config.experimentalAttributes;
113
- this.onboarding = config.onboarding;
114
- this.systemPrompt = config.systemPrompt;
115
- this.tools = config.tools;
116
- this.query = config.query;
117
- this.checkConnection = config.checkConnection;
118
- }
119
- get connectorKey() {
120
- return _ConnectorPlugin.deriveKey(this.slug, this.authType);
121
- }
122
- /**
123
- * Create tools for connections that belong to this connector.
124
- * Filters connections by connectorKey internally.
125
- * Returns tools keyed as `${connectorKey}_${toolName}`.
126
- */
127
- createTools(connections, config) {
128
- const myConnections = connections.filter(
129
- (c) => _ConnectorPlugin.deriveKey(c.connector.slug, c.connector.authType) === this.connectorKey
130
- );
131
- const result = {};
132
- for (const t of Object.values(this.tools)) {
133
- result[`${this.connectorKey}_${t.name}`] = t.createTool(
134
- myConnections,
135
- config
136
- );
137
- }
138
- return result;
139
- }
140
- static deriveKey(slug, authType) {
141
- return authType ? `${slug}-${authType}` : slug;
142
- }
143
- };
144
-
145
- // ../connectors/src/connectors/slack/setup.ts
146
- var slackOnboarding = new ConnectorOnboarding({
147
- connectionSetupInstructions: {
148
- ja: `\u4EE5\u4E0B\u306E\u624B\u9806\u3067Slack\u30B3\u30CD\u30AF\u30B7\u30E7\u30F3\u306E\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u3092\u884C\u3063\u3066\u304F\u3060\u3055\u3044\u3002
149
-
150
- 1. Slack API \`auth.test\` \u3092\u547C\u3073\u51FA\u3057\u3066 Bot Token \u306E\u6709\u52B9\u6027\u3092\u78BA\u8A8D\u3059\u308B:
151
- - URL: \`https://slack.com/api/auth.test\`
152
- - Header: \`Authorization: Bearer {botToken}\`
153
- 2. \u30EC\u30B9\u30DD\u30F3\u30B9\u306E \`ok\` \u304C \`false\` \u306E\u5834\u5408:
154
- - \`invalid_auth\`: Bot Token \u304C\u7121\u52B9\u3002\u30E6\u30FC\u30B6\u30FC\u306B\u30C8\u30FC\u30AF\u30F3\u306E\u518D\u78BA\u8A8D\u3092\u4F9D\u983C\u3059\u308B
155
- - \`missing_scope\` \u3084\u6A29\u9650\u30A8\u30E9\u30FC: \u5FC5\u8981\u306A\u30B9\u30B3\u30FC\u30D7\u304C\u4E0D\u8DB3\u3057\u3066\u3044\u308B\u65E8\u3092\u6848\u5185\u3057\u3001\u30E6\u30FC\u30B6\u30FC\u306B\u4FEE\u6B63\u3092\u4F9D\u983C\u3059\u308B
156
- 3. \`team.info\` \u3092\u547C\u3073\u51FA\u3057\u3066\u30EF\u30FC\u30AF\u30B9\u30DA\u30FC\u30B9\u60C5\u5831\u3092\u53D6\u5F97\u3059\u308B:
157
- - URL: \`https://slack.com/api/team.info\`
158
- 4. \u30A8\u30E9\u30FC\u304C\u8FD4\u3055\u308C\u305F\u5834\u5408\uFF08\u7279\u306B \`missing_scope\`\uFF09:
159
- - \u4E0D\u8DB3\u3057\u3066\u3044\u308B\u30B9\u30B3\u30FC\u30D7\u3092\u6848\u5185\u3057\u3001\u30E6\u30FC\u30B6\u30FC\u306B\u8FFD\u52A0\u3092\u4F9D\u983C\u3059\u308B
160
- - \u30E6\u30FC\u30B6\u30FC\u304C\u4FEE\u6B63\u5F8C\u300C\u5B8C\u4E86\u3057\u305F\u300D\u3068\u8FD4\u7B54\u3057\u305F\u3089\u3001\u518D\u5EA6 \`team.info\` \u3092\u547C\u3073\u51FA\u3057\u3066\u78BA\u8A8D\u3059\u308B
161
- 5. \`updateConnectionContext\` \u3092\u547C\u3073\u51FA\u3059:
162
- - \`workspace\`: \u30EF\u30FC\u30AF\u30B9\u30DA\u30FC\u30B9\u540D\u30FBID
163
- - \`note\`: \u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u5185\u5BB9\u306E\u7C21\u5358\u306A\u8AAC\u660E
164
-
165
- #### \u63A8\u5968 Bot Token Scopes
166
- \u4EE5\u4E0B\u306E\u30B9\u30B3\u30FC\u30D7\u304C\u4E00\u822C\u7684\u306B\u5FC5\u8981\u3067\u3059\u3002\u4E0D\u8DB3\u3057\u3066\u3044\u308B\u5834\u5408\u306F\u30E6\u30FC\u30B6\u30FC\u306B\u6848\u5185\u3057\u3066\u304F\u3060\u3055\u3044:
167
- - \`channels:read\` \u2014 \u30D1\u30D6\u30EA\u30C3\u30AF\u30C1\u30E3\u30F3\u30CD\u30EB\u306E\u4E00\u89A7
168
- - \`groups:read\` \u2014 \u30D7\u30E9\u30A4\u30D9\u30FC\u30C8\u30C1\u30E3\u30F3\u30CD\u30EB\u306E\u4E00\u89A7
169
- - \`users:read\` \u2014 \u30E6\u30FC\u30B6\u30FC\u4E00\u89A7
170
- - \`team:read\` \u2014 \u30EF\u30FC\u30AF\u30B9\u30DA\u30FC\u30B9\u60C5\u5831
171
- - \`chat:write\` \u2014 \u30E1\u30C3\u30BB\u30FC\u30B8\u9001\u4FE1
172
-
173
- #### \u5236\u7D04
174
- - **\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u4E2D\u306B\u30C1\u30E3\u30F3\u30CD\u30EB\u306E\u30E1\u30C3\u30BB\u30FC\u30B8\u5185\u5BB9\u3092\u8AAD\u307F\u53D6\u3089\u306A\u3044\u3053\u3068**\u3002\u5B9F\u884C\u3057\u3066\u3088\u3044\u306E\u306F\u4E0A\u8A18\u624B\u9806\u3067\u6307\u5B9A\u3055\u308C\u305F\u63A5\u7D9A\u78BA\u8A8D\u30FB\u30E1\u30BF\u30C7\u30FC\u30BF\u53D6\u5F97\u30EA\u30AF\u30A8\u30B9\u30C8\u306E\u307F
175
- - \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`,
176
- en: `Follow these steps to set up the Slack connection.
177
-
178
- 1. Call Slack API \`auth.test\` to verify the Bot Token:
179
- - URL: \`https://slack.com/api/auth.test\`
180
- - Header: \`Authorization: Bearer {botToken}\`
181
- 2. If the response \`ok\` is \`false\`:
182
- - \`invalid_auth\`: Bot Token is invalid. Ask the user to re-check the token
183
- - \`missing_scope\` or permission errors: Inform which scopes are missing and ask the user to fix
184
- 3. Call \`team.info\` to get workspace info:
185
- - URL: \`https://slack.com/api/team.info\`
186
- 4. If an error is returned (especially \`missing_scope\`):
187
- - Inform the user which scopes are missing and ask them to add the scopes
188
- - When the user confirms the fix, call \`team.info\` again to verify
189
- 5. Call \`updateConnectionContext\`:
190
- - \`workspace\`: Workspace name and ID
191
- - \`note\`: Brief description of the setup
192
-
193
- #### Recommended Bot Token Scopes
194
- The following scopes are commonly required. Inform the user if any are missing:
195
- - \`channels:read\` \u2014 List public channels
196
- - \`groups:read\` \u2014 List private channels
197
- - \`users:read\` \u2014 List users
198
- - \`team:read\` \u2014 Get workspace info
199
- - \`chat:write\` \u2014 Send messages
200
-
201
- #### Constraints
202
- - **Do NOT read channel message content during setup**. Only the connection verification and metadata requests specified in the steps above are allowed
203
- - Write only 1 sentence between tool calls, then immediately call the next tool. Skip unnecessary explanations and proceed efficiently`
204
- },
205
- dataOverviewInstructions: {
206
- en: `1. Explore the Slack workspace structure using available API endpoints
207
- 2. List channels and their metadata to understand the data available for analysis`,
208
- ja: `1. \u5229\u7528\u53EF\u80FD\u306AAPI\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8\u3092\u4F7F\u3063\u3066Slack\u30EF\u30FC\u30AF\u30B9\u30DA\u30FC\u30B9\u306E\u69CB\u9020\u3092\u63A2\u7D22
209
- 2. \u30C1\u30E3\u30F3\u30CD\u30EB\u3068\u305D\u306E\u30E1\u30BF\u30C7\u30FC\u30BF\u306E\u4E00\u89A7\u3092\u53D6\u5F97\u3057\u3001\u5206\u6790\u53EF\u80FD\u306A\u30C7\u30FC\u30BF\u3092\u628A\u63E1`
210
- }
211
- });
212
-
213
- // ../connectors/src/connectors/slack/index.ts
214
- var tools = {};
215
- var slackConnector = new ConnectorPlugin({
216
- slug: "slack",
217
- authType: null,
218
- name: "Slack",
219
- description: "Connect to Slack for messaging and workspace data retrieval.",
220
- iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/7zTp67vMTvAV1wPftt6Z9R/f859e25c223d9fe4c3fd4f83895acbf6/slack.svg",
221
- parameters,
222
- releaseFlag: { dev1: true, dev2: false, prod: false },
223
- onboarding: slackOnboarding,
224
- systemPrompt: {
225
- en: `### Slack SDK (TypeScript handler)
226
- Use the Slack connector via the SDK in TypeScript handlers:
227
-
228
- \`\`\`ts
229
- import { connection } from "@squadbase/vite-server/connectors/slack";
230
-
231
- const { botToken } = connection("<connectionId>");
232
-
233
- // Use the Slack Web API with fetch
234
- const res = await fetch("https://slack.com/api/conversations.list", {
235
- headers: {
236
- Authorization: "Bearer " + botToken,
237
- "Content-Type": "application/json",
238
- },
239
- });
240
- const data = await res.json();
241
- \`\`\`
242
-
243
- ### Common Endpoints (Base URL: https://slack.com/api)
244
- - GET \`/conversations.list\` \u2014 List channels
245
- - GET \`/conversations.history?channel={id}\` \u2014 Get channel messages
246
- - GET \`/conversations.info?channel={id}\` \u2014 Get channel info
247
- - GET \`/conversations.members?channel={id}\` \u2014 List channel members
248
- - GET \`/users.list\` \u2014 List users
249
- - GET \`/users.info?user={id}\` \u2014 Get user info
250
- - POST \`/chat.postMessage\` \u2014 Send a message (JSON body: channel, text)
251
- - GET \`/reactions.list\` \u2014 List reactions
252
- - GET \`/search.messages?query={query}\` \u2014 Search messages (requires user token)
253
- - GET \`/team.info\` \u2014 Get team info
254
-
255
- ### Tips
256
- - All endpoints accept GET with query params or POST with JSON body
257
- - Pagination: use \`cursor\` parameter with \`response_metadata.next_cursor\`
258
- - Rate limits: Tier 1-4, most methods are Tier 3 (50+ per minute)
259
- - Check \`data.ok\` field \u2014 Slack returns HTTP 200 even on errors`,
260
- ja: `### Slack SDK\uFF08TypeScript\u30CF\u30F3\u30C9\u30E9\u30FC\uFF09
261
- TypeScript\u30CF\u30F3\u30C9\u30E9\u30FC\u3067Slack\u30B3\u30CD\u30AF\u30BF\u30FC\u3092SDK\u7D4C\u7531\u3067\u4F7F\u7528\u3057\u307E\u3059\uFF1A
262
-
263
- \`\`\`ts
264
- import { connection } from "@squadbase/vite-server/connectors/slack";
265
-
266
- const { botToken } = connection("<connectionId>");
267
-
268
- // Slack Web API\u3092fetch\u3067\u4F7F\u7528
269
- const res = await fetch("https://slack.com/api/conversations.list", {
270
- headers: {
271
- Authorization: "Bearer " + botToken,
272
- "Content-Type": "application/json",
273
- },
274
- });
275
- const data = await res.json();
276
- \`\`\`
277
-
278
- ### \u4E3B\u8981\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8\uFF08\u30D9\u30FC\u30B9URL: https://slack.com/api\uFF09
279
- - GET \`/conversations.list\` \u2014 \u30C1\u30E3\u30CD\u30EB\u4E00\u89A7
280
- - GET \`/conversations.history?channel={id}\` \u2014 \u30C1\u30E3\u30CD\u30EB\u30E1\u30C3\u30BB\u30FC\u30B8\u306E\u53D6\u5F97
281
- - GET \`/conversations.info?channel={id}\` \u2014 \u30C1\u30E3\u30CD\u30EB\u60C5\u5831\u306E\u53D6\u5F97
282
- - GET \`/conversations.members?channel={id}\` \u2014 \u30C1\u30E3\u30CD\u30EB\u30E1\u30F3\u30D0\u30FC\u4E00\u89A7
283
- - GET \`/users.list\` \u2014 \u30E6\u30FC\u30B6\u30FC\u4E00\u89A7
284
- - GET \`/users.info?user={id}\` \u2014 \u30E6\u30FC\u30B6\u30FC\u60C5\u5831\u306E\u53D6\u5F97
285
- - POST \`/chat.postMessage\` \u2014 \u30E1\u30C3\u30BB\u30FC\u30B8\u306E\u9001\u4FE1\uFF08JSON\u30DC\u30C7\u30A3: channel, text\uFF09
286
- - GET \`/reactions.list\` \u2014 \u30EA\u30A2\u30AF\u30B7\u30E7\u30F3\u4E00\u89A7
287
- - GET \`/search.messages?query={query}\` \u2014 \u30E1\u30C3\u30BB\u30FC\u30B8\u691C\u7D22\uFF08\u30E6\u30FC\u30B6\u30FC\u30C8\u30FC\u30AF\u30F3\u304C\u5FC5\u8981\uFF09
288
- - GET \`/team.info\` \u2014 \u30C1\u30FC\u30E0\u60C5\u5831\u306E\u53D6\u5F97
289
-
290
- ### \u30D2\u30F3\u30C8
291
- - \u3059\u3079\u3066\u306E\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8\u306F\u30AF\u30A8\u30EA\u30D1\u30E9\u30E1\u30FC\u30BF\u4ED8\u304DGET\u307E\u305F\u306FJSON\u30DC\u30C7\u30A3\u4ED8\u304DPOST\u3092\u53D7\u3051\u4ED8\u3051\u307E\u3059
292
- - \u30DA\u30FC\u30B8\u30CD\u30FC\u30B7\u30E7\u30F3: \`response_metadata.next_cursor\`\u3068\u5171\u306B\`cursor\`\u30D1\u30E9\u30E1\u30FC\u30BF\u3092\u4F7F\u7528
293
- - \u30EC\u30FC\u30C8\u5236\u9650: Tier 1-4\u3001\u307B\u3068\u3093\u3069\u306E\u30E1\u30BD\u30C3\u30C9\u306FTier 3\uFF081\u5206\u3042\u305F\u308A50\u56DE\u4EE5\u4E0A\uFF09
294
- - \`data.ok\`\u30D5\u30A3\u30FC\u30EB\u30C9\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044 \u2014 Slack\u306F\u30A8\u30E9\u30FC\u6642\u3082HTTP 200\u3092\u8FD4\u3057\u307E\u3059`
295
- },
296
- tools
297
- });
298
-
299
- // src/connectors/create-connector-sdk.ts
300
- import { readFileSync } from "fs";
301
- import path from "path";
302
-
303
- // src/connector-client/env.ts
304
- function resolveEnvVar(entry, key, connectionId) {
305
- const envVarName = entry.envVars[key];
306
- if (!envVarName) {
307
- throw new Error(`Connection "${connectionId}" is missing envVars mapping for key "${key}"`);
308
- }
309
- const value = process.env[envVarName];
310
- if (!value) {
311
- throw new Error(`Environment variable "${envVarName}" (for connection "${connectionId}", key "${key}") is not set`);
312
- }
313
- return value;
314
- }
315
- function resolveEnvVarOptional(entry, key) {
316
- const envVarName = entry.envVars[key];
317
- if (!envVarName) return void 0;
318
- return process.env[envVarName] || void 0;
319
- }
320
-
321
- // src/connectors/create-connector-sdk.ts
322
- function loadConnectionsSync() {
323
- const filePath = process.env.CONNECTIONS_PATH ?? path.join(process.cwd(), ".squadbase/connections.json");
324
- try {
325
- const raw = readFileSync(filePath, "utf-8");
326
- return JSON.parse(raw);
327
- } catch {
328
- return {};
329
- }
330
- }
331
- function createConnectorSdk(plugin, createClient2) {
332
- return (connectionId) => {
333
- const connections = loadConnectionsSync();
334
- const entry = connections[connectionId];
335
- if (!entry) {
336
- throw new Error(
337
- `Connection "${connectionId}" not found in .squadbase/connections.json`
338
- );
339
- }
340
- if (entry.connector.slug !== plugin.slug) {
341
- throw new Error(
342
- `Connection "${connectionId}" is not a ${plugin.slug} connection (got "${entry.connector.slug}")`
343
- );
344
- }
345
- const params = {};
346
- for (const param of Object.values(plugin.parameters)) {
347
- if (param.required) {
348
- params[param.slug] = resolveEnvVar(entry, param.slug, connectionId);
349
- } else {
350
- const val = resolveEnvVarOptional(entry, param.slug);
351
- if (val !== void 0) params[param.slug] = val;
352
- }
353
- }
354
- return createClient2(params);
355
- };
356
- }
357
-
358
- // src/connectors/entries/slack.ts
359
- var connection = createConnectorSdk(slackConnector, createClient);
360
- export {
361
- connection
362
- };