@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
@@ -0,0 +1,527 @@
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/stripe-api-key/parameters.ts
46
+ var parameters = {
47
+ apiKey: new ParameterDefinition({
48
+ slug: "api-key",
49
+ name: "Stripe API Key",
50
+ description: "Your Stripe Secret API Key (sk_live_... / sk_test_...) or Restricted API Key (rk_live_... / rk_test_...).",
51
+ envVarBaseKey: "STRIPE_API_KEY",
52
+ type: "text",
53
+ secret: true,
54
+ required: true
55
+ })
56
+ };
57
+
58
+ // ../connectors/src/connectors/stripe-api-key/sdk/index.ts
59
+ var BASE_URL = "https://api.stripe.com";
60
+ function createClient(params) {
61
+ const apiKey = params[parameters.apiKey.slug];
62
+ if (!apiKey) {
63
+ throw new Error(
64
+ `stripe-api-key: missing required parameter: ${parameters.apiKey.slug}`
65
+ );
66
+ }
67
+ return {
68
+ request(path2, init) {
69
+ const url = `${BASE_URL}${path2.startsWith("/") ? "" : "/"}${path2}`;
70
+ const headers = new Headers(init?.headers);
71
+ headers.set("Authorization", `Bearer ${apiKey}`);
72
+ return fetch(url, { ...init, headers });
73
+ }
74
+ };
75
+ }
76
+
77
+ // ../connectors/src/connector-onboarding.ts
78
+ var ConnectorOnboarding = class {
79
+ /** Phase 1: Connection setup instructions (optional — some connectors don't need this) */
80
+ connectionSetupInstructions;
81
+ /** Phase 2: Data overview instructions */
82
+ dataOverviewInstructions;
83
+ constructor(config) {
84
+ this.connectionSetupInstructions = config.connectionSetupInstructions;
85
+ this.dataOverviewInstructions = config.dataOverviewInstructions;
86
+ }
87
+ getConnectionSetupPrompt(language) {
88
+ return this.connectionSetupInstructions?.[language] ?? null;
89
+ }
90
+ getDataOverviewInstructions(language) {
91
+ return this.dataOverviewInstructions[language];
92
+ }
93
+ };
94
+
95
+ // ../connectors/src/connector-tool.ts
96
+ var ConnectorTool = class {
97
+ name;
98
+ description;
99
+ inputSchema;
100
+ outputSchema;
101
+ _execute;
102
+ constructor(config) {
103
+ this.name = config.name;
104
+ this.description = config.description;
105
+ this.inputSchema = config.inputSchema;
106
+ this.outputSchema = config.outputSchema;
107
+ this._execute = config.execute;
108
+ }
109
+ createTool(connections, config) {
110
+ return {
111
+ description: this.description,
112
+ inputSchema: this.inputSchema,
113
+ outputSchema: this.outputSchema,
114
+ execute: (input) => this._execute(input, connections, config)
115
+ };
116
+ }
117
+ };
118
+
119
+ // ../connectors/src/connector-plugin.ts
120
+ var ConnectorPlugin = class _ConnectorPlugin {
121
+ slug;
122
+ authType;
123
+ name;
124
+ description;
125
+ iconUrl;
126
+ parameters;
127
+ releaseFlag;
128
+ proxyPolicy;
129
+ experimentalAttributes;
130
+ onboarding;
131
+ systemPrompt;
132
+ tools;
133
+ query;
134
+ checkConnection;
135
+ constructor(config) {
136
+ this.slug = config.slug;
137
+ this.authType = config.authType;
138
+ this.name = config.name;
139
+ this.description = config.description;
140
+ this.iconUrl = config.iconUrl;
141
+ this.parameters = config.parameters;
142
+ this.releaseFlag = config.releaseFlag;
143
+ this.proxyPolicy = config.proxyPolicy;
144
+ this.experimentalAttributes = config.experimentalAttributes;
145
+ this.onboarding = config.onboarding;
146
+ this.systemPrompt = config.systemPrompt;
147
+ this.tools = config.tools;
148
+ this.query = config.query;
149
+ this.checkConnection = config.checkConnection;
150
+ }
151
+ get connectorKey() {
152
+ return _ConnectorPlugin.deriveKey(this.slug, this.authType);
153
+ }
154
+ /**
155
+ * Create tools for connections that belong to this connector.
156
+ * Filters connections by connectorKey internally.
157
+ * Returns tools keyed as `${connectorKey}_${toolName}`.
158
+ */
159
+ createTools(connections, config) {
160
+ const myConnections = connections.filter(
161
+ (c) => _ConnectorPlugin.deriveKey(c.connector.slug, c.connector.authType) === this.connectorKey
162
+ );
163
+ const result = {};
164
+ for (const t of Object.values(this.tools)) {
165
+ result[`${this.connectorKey}_${t.name}`] = t.createTool(
166
+ myConnections,
167
+ config
168
+ );
169
+ }
170
+ return result;
171
+ }
172
+ static deriveKey(slug, authType) {
173
+ return authType ? `${slug}-${authType}` : slug;
174
+ }
175
+ };
176
+
177
+ // ../connectors/src/auth-types.ts
178
+ var AUTH_TYPES = {
179
+ OAUTH: "oauth",
180
+ API_KEY: "api-key",
181
+ JWT: "jwt",
182
+ SERVICE_ACCOUNT: "service-account",
183
+ PAT: "pat",
184
+ USER_PASSWORD: "user-password"
185
+ };
186
+
187
+ // ../connectors/src/connectors/stripe-api-key/tools/request.ts
188
+ import { z } from "zod";
189
+ var BASE_URL2 = "https://api.stripe.com";
190
+ var REQUEST_TIMEOUT_MS = 6e4;
191
+ var inputSchema = z.object({
192
+ toolUseIntent: z.string().optional().describe(
193
+ "Brief description of what you intend to accomplish with this tool call"
194
+ ),
195
+ connectionId: z.string().describe("ID of the Stripe API Key connection to use"),
196
+ method: z.enum(["GET", "POST", "DELETE"]).describe(
197
+ "HTTP method. GET for reading resources, POST for creating or updating, DELETE for removing."
198
+ ),
199
+ path: z.string().describe(
200
+ "API path appended to https://api.stripe.com (e.g., '/v1/charges', '/v1/customers', '/v1/invoices')"
201
+ ),
202
+ queryParams: z.record(z.string(), z.string()).optional().describe("Query parameters to append to the URL"),
203
+ body: z.record(z.string(), z.unknown()).optional().describe(
204
+ "Request body for POST requests. Stripe uses form-encoded bodies \u2014 pass a flat key-value object and it will be encoded automatically."
205
+ )
206
+ });
207
+ var outputSchema = z.discriminatedUnion("success", [
208
+ z.object({
209
+ success: z.literal(true),
210
+ status: z.number(),
211
+ data: z.record(z.string(), z.unknown())
212
+ }),
213
+ z.object({
214
+ success: z.literal(false),
215
+ error: z.string()
216
+ })
217
+ ]);
218
+ var requestTool = new ConnectorTool({
219
+ name: "request",
220
+ description: `Send authenticated requests to the Stripe API.
221
+ Authentication is handled automatically using the configured API Key (Bearer token).
222
+ Use this tool for all Stripe API interactions: querying charges, customers, invoices, subscriptions, products, prices, payment intents, balances, and more.`,
223
+ inputSchema,
224
+ outputSchema,
225
+ async execute({ connectionId, method, path: path2, queryParams, body }, connections) {
226
+ const connection2 = connections.find((c) => c.id === connectionId);
227
+ if (!connection2) {
228
+ return {
229
+ success: false,
230
+ error: `Connection ${connectionId} not found`
231
+ };
232
+ }
233
+ console.log(
234
+ `[connector-request] stripe-api-key/${connection2.name}: ${method} ${path2}`
235
+ );
236
+ try {
237
+ const apiKey = parameters.apiKey.getValue(connection2);
238
+ let url = `${BASE_URL2}${path2.startsWith("/") ? "" : "/"}${path2}`;
239
+ if (queryParams) {
240
+ const searchParams = new URLSearchParams(queryParams);
241
+ url += `?${searchParams.toString()}`;
242
+ }
243
+ const controller = new AbortController();
244
+ const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS);
245
+ try {
246
+ const headers = {
247
+ Authorization: `Bearer ${apiKey}`
248
+ };
249
+ let requestBody;
250
+ if (body) {
251
+ headers["Content-Type"] = "application/x-www-form-urlencoded";
252
+ requestBody = new URLSearchParams(
253
+ Object.entries(body).map(([k, v]) => [k, String(v)])
254
+ ).toString();
255
+ }
256
+ const response = await fetch(url, {
257
+ method,
258
+ headers,
259
+ body: requestBody,
260
+ signal: controller.signal
261
+ });
262
+ const data = await response.json();
263
+ if (!response.ok) {
264
+ const errorObj = data?.error;
265
+ const errorMessage = typeof errorObj === "object" && errorObj !== null && "message" in errorObj ? String(errorObj.message) : typeof data?.message === "string" ? data.message : `HTTP ${response.status} ${response.statusText}`;
266
+ return { success: false, error: errorMessage };
267
+ }
268
+ return { success: true, status: response.status, data };
269
+ } finally {
270
+ clearTimeout(timeout);
271
+ }
272
+ } catch (err) {
273
+ const msg = err instanceof Error ? err.message : String(err);
274
+ return { success: false, error: msg };
275
+ }
276
+ }
277
+ });
278
+
279
+ // ../connectors/src/connectors/stripe-api-key/setup.ts
280
+ var requestToolName = `stripe-api-key_${requestTool.name}`;
281
+ var stripeApiKeyOnboarding = new ConnectorOnboarding({
282
+ connectionSetupInstructions: {
283
+ ja: `\u4EE5\u4E0B\u306E\u624B\u9806\u3067Stripe\u30B3\u30CD\u30AF\u30B7\u30E7\u30F3\u306E\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u3092\u884C\u3063\u3066\u304F\u3060\u3055\u3044\u3002
284
+
285
+ 1. \`${requestToolName}\` \u3092\u547C\u3073\u51FA\u3057\u3066\u3001\u30A2\u30AB\u30A6\u30F3\u30C8\u6B8B\u9AD8\u3092\u53D6\u5F97\u3059\u308B:
286
+ - \`method\`: \`"GET"\`
287
+ - \`path\`: \`"/v1/balance"\`
288
+ 2. \u30A8\u30E9\u30FC\u304C\u8FD4\u3055\u308C\u305F\u5834\u5408\u3001\u30E6\u30FC\u30B6\u30FC\u306BAPI\u30AD\u30FC\u306E\u8A2D\u5B9A\u3092\u78BA\u8A8D\u3059\u308B\u3088\u3046\u4F1D\u3048\u308B\uFF08Secret API Key\u307E\u305F\u306FRestricted API Key\u304C\u6B63\u3057\u304F\u8A2D\u5B9A\u3055\u308C\u3066\u3044\u308B\u304B\uFF09
289
+ 3. \`updateConnectionContext\` \u3092\u547C\u3073\u51FA\u3059:
290
+ - \`note\`: \u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u5185\u5BB9\u306E\u7C21\u5358\u306A\u8AAC\u660E
291
+
292
+ #### \u5236\u7D04
293
+ - **\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u4E2D\u306B\u6C7A\u6E08\u30C7\u30FC\u30BF\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\u30E1\u30BF\u30C7\u30FC\u30BF\u53D6\u5F97\u30EA\u30AF\u30A8\u30B9\u30C8\u306E\u307F
294
+ - \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`,
295
+ en: `Follow these steps to set up the Stripe connection.
296
+
297
+ 1. Call \`${requestToolName}\` to fetch account balance:
298
+ - \`method\`: \`"GET"\`
299
+ - \`path\`: \`"/v1/balance"\`
300
+ 2. If an error is returned, ask the user to check the API key settings (verify that the Secret API Key or Restricted API Key is configured correctly)
301
+ 3. Call \`updateConnectionContext\`:
302
+ - \`note\`: Brief description of the setup
303
+
304
+ #### Constraints
305
+ - **Do NOT read payment data during setup**. Only the metadata request specified in the steps above is allowed
306
+ - Write only 1 sentence between tool calls, then immediately call the next tool. Skip unnecessary explanations and proceed efficiently`
307
+ },
308
+ dataOverviewInstructions: {
309
+ en: `1. Call ${requestToolName} with GET /v1/customers?limit=5 to explore customers structure
310
+ 2. Call ${requestToolName} with GET /v1/charges?limit=5 to explore charges structure
311
+ 3. Explore other endpoints (invoices, subscriptions, products) as needed`,
312
+ ja: `1. ${requestToolName} \u3067 GET /v1/customers?limit=5 \u3092\u547C\u3073\u51FA\u3057\u3001\u9867\u5BA2\u306E\u69CB\u9020\u3092\u78BA\u8A8D
313
+ 2. ${requestToolName} \u3067 GET /v1/charges?limit=5 \u3092\u547C\u3073\u51FA\u3057\u3001\u8AB2\u91D1\u306E\u69CB\u9020\u3092\u78BA\u8A8D
314
+ 3. \u5FC5\u8981\u306B\u5FDC\u3058\u3066\u4ED6\u306E\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8\uFF08\u8ACB\u6C42\u66F8\u3001\u30B5\u30D6\u30B9\u30AF\u30EA\u30D7\u30B7\u30E7\u30F3\u3001\u5546\u54C1\uFF09\u3092\u63A2\u7D22`
315
+ }
316
+ });
317
+
318
+ // ../connectors/src/connectors/stripe-api-key/index.ts
319
+ var tools = { request: requestTool };
320
+ var stripeApiKeyConnector = new ConnectorPlugin({
321
+ slug: "stripe",
322
+ authType: AUTH_TYPES.API_KEY,
323
+ name: "Stripe",
324
+ description: "Connect to Stripe for payment, customer, and subscription data using a Secret API Key or Restricted API Key.",
325
+ iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/2QNK0u2doqp41uL0POS4Ks/7a92367e2388ec77c7f4ada143606f9a/stripe.jpeg",
326
+ parameters,
327
+ releaseFlag: { dev1: true, dev2: false, prod: false },
328
+ onboarding: stripeApiKeyOnboarding,
329
+ systemPrompt: {
330
+ en: `### Tools
331
+
332
+ - \`stripe-api-key_request\`: The only way to call the Stripe API. Use it to query charges, customers, invoices, subscriptions, products, prices, payment intents, balances, and more. Authentication is configured automatically using the API Key (Bearer token). Stripe uses cursor-based pagination with \`starting_after\` and \`has_more\`.
333
+
334
+ ### Stripe API Reference
335
+
336
+ #### Available Endpoints
337
+ - GET \`/v1/charges\` \u2014 List charges
338
+ - GET \`/v1/charges/{chargeId}\` \u2014 Get a charge
339
+ - GET \`/v1/customers\` \u2014 List customers
340
+ - GET \`/v1/customers/{customerId}\` \u2014 Get a customer
341
+ - GET \`/v1/invoices\` \u2014 List invoices
342
+ - GET \`/v1/invoices/{invoiceId}\` \u2014 Get an invoice
343
+ - GET \`/v1/subscriptions\` \u2014 List subscriptions
344
+ - GET \`/v1/subscriptions/{subscriptionId}\` \u2014 Get a subscription
345
+ - GET \`/v1/products\` \u2014 List products
346
+ - GET \`/v1/prices\` \u2014 List prices
347
+ - GET \`/v1/payment_intents\` \u2014 List payment intents
348
+ - GET \`/v1/balance\` \u2014 Get account balance
349
+ - GET \`/v1/balance_transactions\` \u2014 List balance transactions
350
+
351
+ ### Query Parameters
352
+ - \`limit\` \u2014 Number of results per page (max 100, default 10)
353
+ - \`starting_after\` \u2014 Pagination cursor (object ID)
354
+ - \`ending_before\` \u2014 Reverse pagination cursor
355
+ - \`created[gte]\`, \`created[lte]\` \u2014 Filter by creation date (Unix timestamp)
356
+ - \`status\` \u2014 Filter by status (varies by resource)
357
+
358
+ ### Tips
359
+ - Stripe uses cursor-based pagination with \`starting_after\` and \`has_more\`
360
+ - All timestamps are Unix timestamps in seconds
361
+ - Use \`expand[]\` query parameter to include related objects inline
362
+ - List responses have \`data\` array and \`has_more\` boolean
363
+ - POST request bodies are form-encoded (pass a flat key-value object)
364
+ - If using a Restricted API Key, some endpoints may return 403 depending on the key's permissions
365
+
366
+ ### Business Logic
367
+
368
+ 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.
369
+
370
+ #### Example
371
+
372
+ \`\`\`ts
373
+ import { connection } from "@squadbase/vite-server/connectors/stripe-api-key";
374
+
375
+ const stripe = connection("<connectionId>");
376
+
377
+ // Authenticated fetch (returns standard Response)
378
+ const res = await stripe.request("/v1/customers?limit=10");
379
+ const data = await res.json();
380
+ \`\`\``,
381
+ ja: `### \u30C4\u30FC\u30EB
382
+
383
+ - \`stripe-api-key_request\`: Stripe API\u3092\u547C\u3073\u51FA\u3059\u552F\u4E00\u306E\u624B\u6BB5\u3067\u3059\u3002\u8ACB\u6C42\u3001\u9867\u5BA2\u3001\u8ACB\u6C42\u66F8\u3001\u30B5\u30D6\u30B9\u30AF\u30EA\u30D7\u30B7\u30E7\u30F3\u3001\u5546\u54C1\u3001\u4FA1\u683C\u3001\u652F\u6255\u3044\u30A4\u30F3\u30C6\u30F3\u30C8\u3001\u6B8B\u9AD8\u306A\u3069\u306E\u30AF\u30A8\u30EA\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002API\u30AD\u30FC\uFF08Bearer\u30C8\u30FC\u30AF\u30F3\uFF09\u3067\u8A8D\u8A3C\u306F\u81EA\u52D5\u8A2D\u5B9A\u3055\u308C\u307E\u3059\u3002Stripe\u306F \`starting_after\` \u3068 \`has_more\` \u306B\u3088\u308B\u30AB\u30FC\u30BD\u30EB\u30D9\u30FC\u30B9\u306E\u30DA\u30FC\u30B8\u30CD\u30FC\u30B7\u30E7\u30F3\u3092\u4F7F\u7528\u3057\u307E\u3059\u3002
384
+
385
+ ### Stripe API \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9
386
+
387
+ #### \u5229\u7528\u53EF\u80FD\u306A\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8
388
+ - GET \`/v1/charges\` \u2014 \u8ACB\u6C42\u4E00\u89A7\u3092\u53D6\u5F97
389
+ - GET \`/v1/charges/{chargeId}\` \u2014 \u8ACB\u6C42\u3092\u53D6\u5F97
390
+ - GET \`/v1/customers\` \u2014 \u9867\u5BA2\u4E00\u89A7\u3092\u53D6\u5F97
391
+ - GET \`/v1/customers/{customerId}\` \u2014 \u9867\u5BA2\u3092\u53D6\u5F97
392
+ - GET \`/v1/invoices\` \u2014 \u8ACB\u6C42\u66F8\u4E00\u89A7\u3092\u53D6\u5F97
393
+ - GET \`/v1/invoices/{invoiceId}\` \u2014 \u8ACB\u6C42\u66F8\u3092\u53D6\u5F97
394
+ - GET \`/v1/subscriptions\` \u2014 \u30B5\u30D6\u30B9\u30AF\u30EA\u30D7\u30B7\u30E7\u30F3\u4E00\u89A7\u3092\u53D6\u5F97
395
+ - GET \`/v1/subscriptions/{subscriptionId}\` \u2014 \u30B5\u30D6\u30B9\u30AF\u30EA\u30D7\u30B7\u30E7\u30F3\u3092\u53D6\u5F97
396
+ - GET \`/v1/products\` \u2014 \u5546\u54C1\u4E00\u89A7\u3092\u53D6\u5F97
397
+ - GET \`/v1/prices\` \u2014 \u4FA1\u683C\u4E00\u89A7\u3092\u53D6\u5F97
398
+ - GET \`/v1/payment_intents\` \u2014 \u652F\u6255\u3044\u30A4\u30F3\u30C6\u30F3\u30C8\u4E00\u89A7\u3092\u53D6\u5F97
399
+ - GET \`/v1/balance\` \u2014 \u30A2\u30AB\u30A6\u30F3\u30C8\u6B8B\u9AD8\u3092\u53D6\u5F97
400
+ - GET \`/v1/balance_transactions\` \u2014 \u6B8B\u9AD8\u30C8\u30E9\u30F3\u30B6\u30AF\u30B7\u30E7\u30F3\u4E00\u89A7\u3092\u53D6\u5F97
401
+
402
+ ### \u30AF\u30A8\u30EA\u30D1\u30E9\u30E1\u30FC\u30BF
403
+ - \`limit\` \u2014 \u30DA\u30FC\u30B8\u3042\u305F\u308A\u306E\u7D50\u679C\u6570\uFF08\u6700\u5927100\u3001\u30C7\u30D5\u30A9\u30EB\u30C810\uFF09
404
+ - \`starting_after\` \u2014 \u30DA\u30FC\u30B8\u30CD\u30FC\u30B7\u30E7\u30F3\u30AB\u30FC\u30BD\u30EB\uFF08\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8ID\uFF09
405
+ - \`ending_before\` \u2014 \u9006\u65B9\u5411\u30DA\u30FC\u30B8\u30CD\u30FC\u30B7\u30E7\u30F3\u30AB\u30FC\u30BD\u30EB
406
+ - \`created[gte]\`, \`created[lte]\` \u2014 \u4F5C\u6210\u65E5\u3067\u30D5\u30A3\u30EB\u30BF\uFF08Unix\u30BF\u30A4\u30E0\u30B9\u30BF\u30F3\u30D7\uFF09
407
+ - \`status\` \u2014 \u30B9\u30C6\u30FC\u30BF\u30B9\u3067\u30D5\u30A3\u30EB\u30BF\uFF08\u30EA\u30BD\u30FC\u30B9\u306B\u3088\u308A\u7570\u306A\u308B\uFF09
408
+
409
+ ### \u30D2\u30F3\u30C8
410
+ - Stripe\u306F \`starting_after\` \u3068 \`has_more\` \u306B\u3088\u308B\u30AB\u30FC\u30BD\u30EB\u30D9\u30FC\u30B9\u306E\u30DA\u30FC\u30B8\u30CD\u30FC\u30B7\u30E7\u30F3\u3092\u4F7F\u7528\u3057\u307E\u3059
411
+ - \u3059\u3079\u3066\u306E\u30BF\u30A4\u30E0\u30B9\u30BF\u30F3\u30D7\u306F\u79D2\u5358\u4F4D\u306EUnix\u30BF\u30A4\u30E0\u30B9\u30BF\u30F3\u30D7\u3067\u3059
412
+ - \u95A2\u9023\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u3092\u30A4\u30F3\u30E9\u30A4\u30F3\u3067\u542B\u3081\u308B\u306B\u306F \`expand[]\` \u30AF\u30A8\u30EA\u30D1\u30E9\u30E1\u30FC\u30BF\u3092\u4F7F\u7528\u3057\u307E\u3059
413
+ - \u4E00\u89A7\u30EC\u30B9\u30DD\u30F3\u30B9\u306B\u306F \`data\` \u914D\u5217\u3068 \`has_more\` \u30D6\u30FC\u30EB\u5024\u304C\u542B\u307E\u308C\u307E\u3059
414
+ - POST\u30EA\u30AF\u30A8\u30B9\u30C8\u306E\u30DC\u30C7\u30A3\u306F\u30D5\u30A9\u30FC\u30E0\u30A8\u30F3\u30B3\u30FC\u30C9\u3067\u3059\uFF08\u30D5\u30E9\u30C3\u30C8\u306A\u30AD\u30FC\u30FB\u30D0\u30EA\u30E5\u30FC\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u3092\u6E21\u3057\u3066\u304F\u3060\u3055\u3044\uFF09
415
+ - Restricted API Key\u3092\u4F7F\u7528\u3057\u3066\u3044\u308B\u5834\u5408\u3001\u30AD\u30FC\u306E\u6A29\u9650\u306B\u3088\u3063\u3066\u306F\u4E00\u90E8\u306E\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8\u3067403\u304C\u8FD4\u308B\u3053\u3068\u304C\u3042\u308A\u307E\u3059
416
+
417
+ ### Business Logic
418
+
419
+ \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
420
+
421
+ #### Example
422
+
423
+ \`\`\`ts
424
+ import { connection } from "@squadbase/vite-server/connectors/stripe-api-key";
425
+
426
+ const stripe = connection("<connectionId>");
427
+
428
+ // Authenticated fetch (returns standard Response)
429
+ const res = await stripe.request("/v1/customers?limit=10");
430
+ const data = await res.json();
431
+ \`\`\``
432
+ },
433
+ tools,
434
+ async checkConnection(params) {
435
+ try {
436
+ const apiKey = params["api-key"];
437
+ if (!apiKey) {
438
+ return {
439
+ success: false,
440
+ error: "API Key is not configured"
441
+ };
442
+ }
443
+ const res = await fetch("https://api.stripe.com/v1/balance", {
444
+ method: "GET",
445
+ headers: { Authorization: `Bearer ${apiKey}` }
446
+ });
447
+ if (!res.ok) {
448
+ const errorText = await res.text().catch(() => res.statusText);
449
+ return {
450
+ success: false,
451
+ error: `Stripe API failed: HTTP ${res.status} ${errorText}`
452
+ };
453
+ }
454
+ return { success: true };
455
+ } catch (error) {
456
+ return {
457
+ success: false,
458
+ error: error instanceof Error ? error.message : String(error)
459
+ };
460
+ }
461
+ }
462
+ });
463
+
464
+ // src/connectors/create-connector-sdk.ts
465
+ import { readFileSync } from "fs";
466
+ import path from "path";
467
+
468
+ // src/connector-client/env.ts
469
+ function resolveEnvVar(entry, key, connectionId) {
470
+ const envVarName = entry.envVars[key];
471
+ if (!envVarName) {
472
+ throw new Error(`Connection "${connectionId}" is missing envVars mapping for key "${key}"`);
473
+ }
474
+ const value = process.env[envVarName];
475
+ if (!value) {
476
+ throw new Error(`Environment variable "${envVarName}" (for connection "${connectionId}", key "${key}") is not set`);
477
+ }
478
+ return value;
479
+ }
480
+ function resolveEnvVarOptional(entry, key) {
481
+ const envVarName = entry.envVars[key];
482
+ if (!envVarName) return void 0;
483
+ return process.env[envVarName] || void 0;
484
+ }
485
+
486
+ // src/connectors/create-connector-sdk.ts
487
+ function loadConnectionsSync() {
488
+ const filePath = process.env.CONNECTIONS_PATH ?? path.join(process.cwd(), ".squadbase/connections.json");
489
+ try {
490
+ const raw = readFileSync(filePath, "utf-8");
491
+ return JSON.parse(raw);
492
+ } catch {
493
+ return {};
494
+ }
495
+ }
496
+ function createConnectorSdk(plugin, createClient2) {
497
+ return (connectionId) => {
498
+ const connections = loadConnectionsSync();
499
+ const entry = connections[connectionId];
500
+ if (!entry) {
501
+ throw new Error(
502
+ `Connection "${connectionId}" not found in .squadbase/connections.json`
503
+ );
504
+ }
505
+ if (entry.connector.slug !== plugin.slug) {
506
+ throw new Error(
507
+ `Connection "${connectionId}" is not a ${plugin.slug} connection (got "${entry.connector.slug}")`
508
+ );
509
+ }
510
+ const params = {};
511
+ for (const param of Object.values(plugin.parameters)) {
512
+ if (param.required) {
513
+ params[param.slug] = resolveEnvVar(entry, param.slug, connectionId);
514
+ } else {
515
+ const val = resolveEnvVarOptional(entry, param.slug);
516
+ if (val !== void 0) params[param.slug] = val;
517
+ }
518
+ }
519
+ return createClient2(params);
520
+ };
521
+ }
522
+
523
+ // src/connectors/entries/stripe-api-key.ts
524
+ var connection = createConnectorSdk(stripeApiKeyConnector, createClient);
525
+ export {
526
+ connection
527
+ };
@@ -114,7 +114,8 @@ var AUTH_TYPES = {
114
114
  API_KEY: "api-key",
115
115
  JWT: "jwt",
116
116
  SERVICE_ACCOUNT: "service-account",
117
- PAT: "pat"
117
+ PAT: "pat",
118
+ USER_PASSWORD: "user-password"
118
119
  };
119
120
 
120
121
  // ../connectors/src/connectors/stripe-oauth/tools/request.ts
@@ -281,7 +282,7 @@ var tools = { request: requestTool };
281
282
  var stripeOauthConnector = new ConnectorPlugin({
282
283
  slug: "stripe",
283
284
  authType: AUTH_TYPES.OAUTH,
284
- name: "Stripe (OAuth)",
285
+ name: "Stripe",
285
286
  description: "Connect to Stripe for payment, customer, and subscription data using OAuth.",
286
287
  iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/2QNK0u2doqp41uL0POS4Ks/7a92367e2388ec77c7f4ada143606f9a/stripe.jpeg",
287
288
  parameters,
@@ -299,6 +299,16 @@ var ConnectorPlugin = class _ConnectorPlugin {
299
299
  }
300
300
  };
301
301
 
302
+ // ../connectors/src/auth-types.ts
303
+ var AUTH_TYPES = {
304
+ OAUTH: "oauth",
305
+ API_KEY: "api-key",
306
+ JWT: "jwt",
307
+ SERVICE_ACCOUNT: "service-account",
308
+ PAT: "pat",
309
+ USER_PASSWORD: "user-password"
310
+ };
311
+
302
312
  // ../connectors/src/connectors/wix-store/setup.ts
303
313
  var wixStoreOnboarding = new ConnectorOnboarding({
304
314
  dataOverviewInstructions: {
@@ -385,7 +395,7 @@ Authentication is handled automatically using the API Key and Site ID.`,
385
395
  var tools = { request: requestTool };
386
396
  var wixStoreConnector = new ConnectorPlugin({
387
397
  slug: "wix-store",
388
- authType: null,
398
+ authType: AUTH_TYPES.API_KEY,
389
399
  name: "Wix Store",
390
400
  description: "Connect to Wix Store.",
391
401
  iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/YyFxclQFzROIYpFam6vRK/e7e75d3feac49a1cc5e433c147216d23/Wix_logo_black.svg",
@@ -112,7 +112,8 @@ var AUTH_TYPES = {
112
112
  API_KEY: "api-key",
113
113
  JWT: "jwt",
114
114
  SERVICE_ACCOUNT: "service-account",
115
- PAT: "pat"
115
+ PAT: "pat",
116
+ USER_PASSWORD: "user-password"
116
117
  };
117
118
 
118
119
  // ../connectors/src/connectors/zendesk-oauth/tools/request.ts
@@ -283,7 +284,7 @@ var tools = { request: requestTool };
283
284
  var zendeskOauthConnector = new ConnectorPlugin({
284
285
  slug: "zendesk",
285
286
  authType: AUTH_TYPES.OAUTH,
286
- name: "Zendesk (OAuth)",
287
+ name: "Zendesk",
287
288
  description: "Connect to Zendesk Support for tickets, users, organizations, and customer service data using OAuth.",
288
289
  iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/7e9Q7PwV6MJRJMj543m2gl/55385fae903ccfa1599e35be9d3516aa/zendesk-icon.svg",
289
290
  parameters,
@@ -281,6 +281,16 @@ var ConnectorPlugin = class _ConnectorPlugin {
281
281
  }
282
282
  };
283
283
 
284
+ // ../connectors/src/auth-types.ts
285
+ var AUTH_TYPES = {
286
+ OAUTH: "oauth",
287
+ API_KEY: "api-key",
288
+ JWT: "jwt",
289
+ SERVICE_ACCOUNT: "service-account",
290
+ PAT: "pat",
291
+ USER_PASSWORD: "user-password"
292
+ };
293
+
284
294
  // ../connectors/src/connectors/zendesk/setup.ts
285
295
  var zendeskOnboarding = new ConnectorOnboarding({
286
296
  dataOverviewInstructions: {
@@ -381,7 +391,7 @@ Zendesk uses cursor-based pagination with page[size] and page[after] parameters.
381
391
  var tools = { request: requestTool };
382
392
  var zendeskConnector = new ConnectorPlugin({
383
393
  slug: "zendesk",
384
- authType: null,
394
+ authType: AUTH_TYPES.API_KEY,
385
395
  name: "Zendesk",
386
396
  description: "Connect to Zendesk Support for tickets, users, organizations, and customer service data using an API token.",
387
397
  iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/7e9Q7PwV6MJRJMj543m2gl/55385fae903ccfa1599e35be9d3516aa/zendesk-icon.svg",