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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli/index.js CHANGED
@@ -7216,8 +7216,8 @@ var init_body = __esm({
7216
7216
  const ct = this.headers.get("content-type");
7217
7217
  if (ct.startsWith("application/x-www-form-urlencoded")) {
7218
7218
  const formData = new FormData2();
7219
- const parameters60 = new URLSearchParams(await this.text());
7220
- for (const [name, value] of parameters60) {
7219
+ const parameters62 = new URLSearchParams(await this.text());
7220
+ for (const [name, value] of parameters62) {
7221
7221
  formData.append(name, value);
7222
7222
  }
7223
7223
  return formData;
@@ -10165,11 +10165,11 @@ var require_bignumber = __commonJS({
10165
10165
  return n6 > 0 || n6 === i7 ? i7 : i7 - 1;
10166
10166
  }
10167
10167
  function coeffToString(a6) {
10168
- var s7, z77, i7 = 1, j6 = a6.length, r7 = a6[0] + "";
10168
+ var s7, z80, i7 = 1, j6 = a6.length, r7 = a6[0] + "";
10169
10169
  for (; i7 < j6; ) {
10170
10170
  s7 = a6[i7++] + "";
10171
- z77 = LOG_BASE - s7.length;
10172
- for (; z77--; s7 = "0" + s7) ;
10171
+ z80 = LOG_BASE - s7.length;
10172
+ for (; z80--; s7 = "0" + s7) ;
10173
10173
  r7 += s7;
10174
10174
  }
10175
10175
  for (j6 = r7.length; r7.charCodeAt(--j6) === 48; ) ;
@@ -10202,15 +10202,15 @@ var require_bignumber = __commonJS({
10202
10202
  function toExponential(str, e7) {
10203
10203
  return (str.length > 1 ? str.charAt(0) + "." + str.slice(1) : str) + (e7 < 0 ? "e" : "e+") + e7;
10204
10204
  }
10205
- function toFixedPoint(str, e7, z77) {
10205
+ function toFixedPoint(str, e7, z80) {
10206
10206
  var len, zs;
10207
10207
  if (e7 < 0) {
10208
- for (zs = z77 + "."; ++e7; zs += z77) ;
10208
+ for (zs = z80 + "."; ++e7; zs += z80) ;
10209
10209
  str = zs + str;
10210
10210
  } else {
10211
10211
  len = str.length;
10212
10212
  if (++e7 > len) {
10213
- for (zs = z77, e7 -= len; --e7; zs += z77) ;
10213
+ for (zs = z80, e7 -= len; --e7; zs += z80) ;
10214
10214
  str += zs;
10215
10215
  } else if (e7 < len) {
10216
10216
  str = str.slice(0, e7) + "." + str.slice(e7);
@@ -37123,14 +37123,14 @@ var init_NormalizedSchema = __esm({
37123
37123
  throw new Error("@smithy/core/schema - cannot iterate non-struct schema.");
37124
37124
  }
37125
37125
  const struct = this.getSchema();
37126
- const z77 = struct[4].length;
37126
+ const z80 = struct[4].length;
37127
37127
  let it = struct[anno.it];
37128
- if (it && z77 === it.length) {
37128
+ if (it && z80 === it.length) {
37129
37129
  yield* it;
37130
37130
  return;
37131
37131
  }
37132
- it = Array(z77);
37133
- for (let i7 = 0; i7 < z77; ++i7) {
37132
+ it = Array(z80);
37133
+ for (let i7 = 0; i7 < z80; ++i7) {
37134
37134
  const k6 = struct[4][i7];
37135
37135
  const v7 = member([struct[5][i7], 0], k6);
37136
37136
  yield it[i7] = [k6, v7];
@@ -37806,12 +37806,12 @@ var init_split_header = __esm({
37806
37806
  "../../node_modules/@smithy/core/dist-es/submodules/serde/split-header.js"() {
37807
37807
  "use strict";
37808
37808
  splitHeader = (value) => {
37809
- const z77 = value.length;
37809
+ const z80 = value.length;
37810
37810
  const values = [];
37811
37811
  let withinQuotes = false;
37812
37812
  let prevChar = void 0;
37813
37813
  let anchor = 0;
37814
- for (let i7 = 0; i7 < z77; ++i7) {
37814
+ for (let i7 = 0; i7 < z80; ++i7) {
37815
37815
  const char = value[i7];
37816
37816
  switch (char) {
37817
37817
  case `"`:
@@ -37832,12 +37832,12 @@ var init_split_header = __esm({
37832
37832
  values.push(value.slice(anchor));
37833
37833
  return values.map((v7) => {
37834
37834
  v7 = v7.trim();
37835
- const z78 = v7.length;
37836
- if (z78 < 2) {
37835
+ const z81 = v7.length;
37836
+ if (z81 < 2) {
37837
37837
  return v7;
37838
37838
  }
37839
- if (v7[0] === `"` && v7[z78 - 1] === `"`) {
37840
- v7 = v7.slice(1, z78 - 1);
37839
+ if (v7[0] === `"` && v7[z81 - 1] === `"`) {
37840
+ v7 = v7.slice(1, z81 - 1);
37841
37841
  }
37842
37842
  return v7.replace(/\\"/g, '"');
37843
37843
  });
@@ -39235,11 +39235,11 @@ var init_EndpointCache = __esm({
39235
39235
  }
39236
39236
  hash(endpointParams) {
39237
39237
  let buffer = "";
39238
- const { parameters: parameters60 } = this;
39239
- if (parameters60.length === 0) {
39238
+ const { parameters: parameters62 } = this;
39239
+ if (parameters62.length === 0) {
39240
39240
  return false;
39241
39241
  }
39242
- for (const param of parameters60) {
39242
+ for (const param of parameters62) {
39243
39243
  const val = String(endpointParams[param] ?? "");
39244
39244
  if (val.includes("|;")) {
39245
39245
  return false;
@@ -39956,15 +39956,15 @@ var init_resolveEndpoint = __esm({
39956
39956
  init_utils3();
39957
39957
  resolveEndpoint = (ruleSetObject, options) => {
39958
39958
  const { endpointParams, logger: logger2 } = options;
39959
- const { parameters: parameters60, rules } = ruleSetObject;
39959
+ const { parameters: parameters62, rules } = ruleSetObject;
39960
39960
  options.logger?.debug?.(`${debugId} Initial EndpointParams: ${toDebugString(endpointParams)}`);
39961
- const paramsWithDefault = Object.entries(parameters60).filter(([, v7]) => v7.default != null).map(([k6, v7]) => [k6, v7.default]);
39961
+ const paramsWithDefault = Object.entries(parameters62).filter(([, v7]) => v7.default != null).map(([k6, v7]) => [k6, v7.default]);
39962
39962
  if (paramsWithDefault.length > 0) {
39963
39963
  for (const [paramKey, paramDefaultValue] of paramsWithDefault) {
39964
39964
  endpointParams[paramKey] = endpointParams[paramKey] ?? paramDefaultValue;
39965
39965
  }
39966
39966
  }
39967
- const requiredParams = Object.entries(parameters60).filter(([, v7]) => v7.required).map(([k6]) => k6);
39967
+ const requiredParams = Object.entries(parameters62).filter(([, v7]) => v7.required).map(([k6]) => k6);
39968
39968
  for (const requiredParam of requiredParams) {
39969
39969
  if (endpointParams[requiredParam] == null) {
39970
39970
  throw new EndpointError(`Missing required parameter: '${requiredParam}'`);
@@ -45574,8 +45574,8 @@ var init_ProtocolLib = __esm({
45574
45574
  constructor(queryCompat = false) {
45575
45575
  this.queryCompat = queryCompat;
45576
45576
  }
45577
- resolveRestContentType(defaultContentType, inputSchema74) {
45578
- const members = inputSchema74.getMemberSchemas();
45577
+ resolveRestContentType(defaultContentType, inputSchema77) {
45578
+ const members = inputSchema77.getMemberSchemas();
45579
45579
  const httpPayloadMember = Object.values(members).find((m7) => {
45580
45580
  return !!m7.getMergedTraits().httpPayload;
45581
45581
  });
@@ -45590,7 +45590,7 @@ var init_ProtocolLib = __esm({
45590
45590
  } else {
45591
45591
  return defaultContentType;
45592
45592
  }
45593
- } else if (!inputSchema74.isUnitSchema()) {
45593
+ } else if (!inputSchema77.isUnitSchema()) {
45594
45594
  const hasBody = Object.values(members).find((m7) => {
45595
45595
  const { httpQuery, httpQueryParams, httpHeader, httpLabel, httpPrefixHeaders } = m7.getMergedTraits();
45596
45596
  const noPrefixHeaders = httpPrefixHeaders === void 0;
@@ -46433,9 +46433,9 @@ var init_AwsRestJsonProtocol = __esm({
46433
46433
  }
46434
46434
  async serializeRequest(operationSchema, input, context) {
46435
46435
  const request2 = await super.serializeRequest(operationSchema, input, context);
46436
- const inputSchema74 = NormalizedSchema.of(operationSchema.input);
46436
+ const inputSchema77 = NormalizedSchema.of(operationSchema.input);
46437
46437
  if (!request2.headers["content-type"]) {
46438
- const contentType = this.mixin.resolveRestContentType(this.getDefaultContentType(), inputSchema74);
46438
+ const contentType = this.mixin.resolveRestContentType(this.getDefaultContentType(), inputSchema77);
46439
46439
  if (contentType) {
46440
46440
  request2.headers["content-type"] = contentType;
46441
46441
  }
@@ -46447,8 +46447,8 @@ var init_AwsRestJsonProtocol = __esm({
46447
46447
  }
46448
46448
  async deserializeResponse(operationSchema, context, response) {
46449
46449
  const output = await super.deserializeResponse(operationSchema, context, response);
46450
- const outputSchema74 = NormalizedSchema.of(operationSchema.output);
46451
- for (const [name, member2] of outputSchema74.structIterator()) {
46450
+ const outputSchema77 = NormalizedSchema.of(operationSchema.output);
46451
+ for (const [name, member2] of outputSchema77.structIterator()) {
46452
46452
  if (member2.getMemberTraits().httpPayload && !(name in output)) {
46453
46453
  output[name] = null;
46454
46454
  }
@@ -50312,22 +50312,22 @@ var init_loadCognitoIdentity = __esm({
50312
50312
  });
50313
50313
 
50314
50314
  // ../../node_modules/@aws-sdk/credential-provider-cognito-identity/dist-es/fromCognitoIdentity.js
50315
- function fromCognitoIdentity(parameters60) {
50315
+ function fromCognitoIdentity(parameters62) {
50316
50316
  return async (awsIdentityProperties) => {
50317
- parameters60.logger?.debug("@aws-sdk/credential-provider-cognito-identity - fromCognitoIdentity");
50317
+ parameters62.logger?.debug("@aws-sdk/credential-provider-cognito-identity - fromCognitoIdentity");
50318
50318
  const { GetCredentialsForIdentityCommand: GetCredentialsForIdentityCommand2, CognitoIdentityClient: CognitoIdentityClient2 } = await Promise.resolve().then(() => (init_loadCognitoIdentity(), loadCognitoIdentity_exports));
50319
- const fromConfigs = (property) => parameters60.clientConfig?.[property] ?? parameters60.parentClientConfig?.[property] ?? awsIdentityProperties?.callerClientConfig?.[property];
50320
- const { Credentials: { AccessKeyId = throwOnMissingAccessKeyId(parameters60.logger), Expiration, SecretKey = throwOnMissingSecretKey(parameters60.logger), SessionToken } = throwOnMissingCredentials(parameters60.logger) } = await (parameters60.client ?? new CognitoIdentityClient2(Object.assign({}, parameters60.clientConfig ?? {}, {
50319
+ const fromConfigs = (property) => parameters62.clientConfig?.[property] ?? parameters62.parentClientConfig?.[property] ?? awsIdentityProperties?.callerClientConfig?.[property];
50320
+ const { Credentials: { AccessKeyId = throwOnMissingAccessKeyId(parameters62.logger), Expiration, SecretKey = throwOnMissingSecretKey(parameters62.logger), SessionToken } = throwOnMissingCredentials(parameters62.logger) } = await (parameters62.client ?? new CognitoIdentityClient2(Object.assign({}, parameters62.clientConfig ?? {}, {
50321
50321
  region: fromConfigs("region"),
50322
50322
  profile: fromConfigs("profile"),
50323
50323
  userAgentAppId: fromConfigs("userAgentAppId")
50324
50324
  }))).send(new GetCredentialsForIdentityCommand2({
50325
- CustomRoleArn: parameters60.customRoleArn,
50326
- IdentityId: parameters60.identityId,
50327
- Logins: parameters60.logins ? await resolveLogins(parameters60.logins) : void 0
50325
+ CustomRoleArn: parameters62.customRoleArn,
50326
+ IdentityId: parameters62.identityId,
50327
+ Logins: parameters62.logins ? await resolveLogins(parameters62.logins) : void 0
50328
50328
  }));
50329
50329
  return {
50330
- identityId: parameters60.identityId,
50330
+ identityId: parameters62.identityId,
50331
50331
  accessKeyId: AccessKeyId,
50332
50332
  secretAccessKey: SecretKey,
50333
50333
  sessionToken: SessionToken,
@@ -89225,7 +89225,9 @@ Use this tool for all Stripe API interactions: querying charges, customers, invo
89225
89225
  if (body) {
89226
89226
  headers["Content-Type"] = "application/x-www-form-urlencoded";
89227
89227
  requestBody = new URLSearchParams(
89228
- Object.entries(body).map(([k6, v7]) => [k6, String(v7)])
89228
+ Object.entries(body).map(
89229
+ ([k6, v7]) => [k6, String(v7)]
89230
+ )
89229
89231
  ).toString();
89230
89232
  }
89231
89233
  const response = await fetch(url, {
@@ -101011,6 +101013,714 @@ export default async function handler(c: Context) {
101011
101013
  tools: tools59
101012
101014
  });
101013
101015
 
101016
+ // ../connectors/src/connectors/backlog/setup.ts
101017
+ var backlogOnboarding = new ConnectorOnboarding({
101018
+ dataOverviewInstructions: {
101019
+ en: `1. Call backlog-api-key_request with GET space to verify the connection and get space information
101020
+ 2. Call backlog-api-key_request with GET projects to list all accessible projects
101021
+ 3. For key projects, call backlog-api-key_request with GET issues?projectId[]={projectId}&count=5&order=desc to retrieve recent issues
101022
+ 4. Call backlog-api-key_request with GET projects/{projectIdOrKey}/statuses to understand the workflow statuses`,
101023
+ ja: `1. backlog-api-key_request \u3067 GET space \u3092\u547C\u3073\u51FA\u3057\u3001\u63A5\u7D9A\u78BA\u8A8D\u3068\u30B9\u30DA\u30FC\u30B9\u60C5\u5831\u3092\u53D6\u5F97
101024
+ 2. backlog-api-key_request \u3067 GET projects \u3092\u547C\u3073\u51FA\u3057\u3001\u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u306A\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u4E00\u89A7\u3092\u53D6\u5F97
101025
+ 3. \u4E3B\u8981\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306B\u3064\u3044\u3066 backlog-api-key_request \u3067 GET issues?projectId[]={projectId}&count=5&order=desc \u3092\u547C\u3073\u51FA\u3057\u3001\u6700\u8FD1\u306E\u8AB2\u984C\u3092\u53D6\u5F97
101026
+ 4. backlog-api-key_request \u3067 GET projects/{projectIdOrKey}/statuses \u3092\u547C\u3073\u51FA\u3057\u3001\u30EF\u30FC\u30AF\u30D5\u30ED\u30FC\u306E\u30B9\u30C6\u30FC\u30BF\u30B9\u3092\u78BA\u8A8D`
101027
+ }
101028
+ });
101029
+
101030
+ // ../connectors/src/connectors/backlog/parameters.ts
101031
+ var parameters60 = {
101032
+ spaceUrl: new ParameterDefinition({
101033
+ slug: "space-url",
101034
+ name: "Backlog Space URL",
101035
+ description: "Your Backlog space URL \u2014 just the base address, without any trailing path. For example: https://your-space.backlog.com or https://your-space.backlog.jp",
101036
+ envVarBaseKey: "BACKLOG_SPACE_URL",
101037
+ type: "text",
101038
+ secret: false,
101039
+ required: true
101040
+ }),
101041
+ apiKey: new ParameterDefinition({
101042
+ slug: "api-key",
101043
+ name: "API Key",
101044
+ description: "Your Backlog API key. You can generate one at: Your Space > Personal Settings > API (https://your-space.backlog.com/EditApiSettings.action).",
101045
+ envVarBaseKey: "BACKLOG_API_KEY",
101046
+ type: "text",
101047
+ secret: true,
101048
+ required: true
101049
+ })
101050
+ };
101051
+
101052
+ // ../connectors/src/connectors/backlog/tools/request.ts
101053
+ import { z as z76 } from "zod";
101054
+ var REQUEST_TIMEOUT_MS59 = 6e4;
101055
+ var inputSchema74 = z76.object({
101056
+ toolUseIntent: z76.string().optional().describe("Brief description of what you intend to accomplish with this tool call"),
101057
+ connectionId: z76.string().describe("ID of the Backlog connection to use"),
101058
+ method: z76.enum(["GET", "POST", "PUT", "PATCH", "DELETE"]).describe("HTTP method. Use GET to read resources, POST to create, PATCH/PUT to update, DELETE to remove."),
101059
+ path: z76.string().describe("API path relative to /api/v2/ (e.g., 'space', 'projects', 'issues?projectId[]=12345'). Query parameters can be appended. The apiKey query parameter is added automatically \u2014 do NOT include it."),
101060
+ body: z76.record(z76.string(), z76.unknown()).optional().describe("Request body as JSON object. Required for POST, PUT, and PATCH requests (e.g., issue creation, comment addition).")
101061
+ });
101062
+ var outputSchema74 = z76.discriminatedUnion("success", [
101063
+ z76.object({
101064
+ success: z76.literal(true),
101065
+ status: z76.number(),
101066
+ data: z76.union([z76.record(z76.string(), z76.unknown()), z76.array(z76.unknown())])
101067
+ }),
101068
+ z76.object({
101069
+ success: z76.literal(false),
101070
+ error: z76.string()
101071
+ })
101072
+ ]);
101073
+ var requestTool45 = new ConnectorTool({
101074
+ name: "request",
101075
+ description: `Send authenticated requests to the Backlog REST API (v2).
101076
+ Authentication is handled automatically by appending the apiKey query parameter to every request.
101077
+ Use this tool for all Backlog operations: listing projects, searching and creating issues, managing wikis, retrieving users, and more.
101078
+ The base URL and API key are configured per connection \u2014 only specify the API path relative to /api/v2/.
101079
+ Do NOT include the apiKey parameter yourself; it is injected automatically.`,
101080
+ inputSchema: inputSchema74,
101081
+ outputSchema: outputSchema74,
101082
+ async execute({ connectionId, method, path: path5, body }, connections) {
101083
+ const connection = connections.find((c6) => c6.id === connectionId);
101084
+ if (!connection) {
101085
+ return { success: false, error: `Connection ${connectionId} not found` };
101086
+ }
101087
+ console.log(`[connector-request] backlog-api-key/${connection.name}: ${method} ${path5}`);
101088
+ try {
101089
+ const spaceUrl = parameters60.spaceUrl.getValue(connection);
101090
+ const apiKey = parameters60.apiKey.getValue(connection);
101091
+ const separator = path5.includes("?") ? "&" : "?";
101092
+ const url = `${spaceUrl.replace(/\/+$/, "")}/api/v2/${path5}${separator}apiKey=${apiKey}`;
101093
+ const controller = new AbortController();
101094
+ const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS59);
101095
+ try {
101096
+ const headers = {
101097
+ Accept: "application/json"
101098
+ };
101099
+ if (body) {
101100
+ headers["Content-Type"] = "application/json";
101101
+ }
101102
+ const response = await fetch(url, {
101103
+ method,
101104
+ headers,
101105
+ body: body ? JSON.stringify(body) : void 0,
101106
+ signal: controller.signal
101107
+ });
101108
+ if (response.status === 204) {
101109
+ return { success: true, status: 204, data: {} };
101110
+ }
101111
+ const data = await response.json();
101112
+ if (!response.ok) {
101113
+ const errData = data;
101114
+ const errors2 = errData?.errors;
101115
+ const errorMessage = Array.isArray(errors2) ? errors2.map((e7) => e7.message).join("; ") : errData?.message ?? `HTTP ${response.status} ${response.statusText}`;
101116
+ return { success: false, error: errorMessage };
101117
+ }
101118
+ return { success: true, status: response.status, data };
101119
+ } finally {
101120
+ clearTimeout(timeout);
101121
+ }
101122
+ } catch (err) {
101123
+ const msg = err instanceof Error ? err.message : String(err);
101124
+ return { success: false, error: msg };
101125
+ }
101126
+ }
101127
+ });
101128
+
101129
+ // ../connectors/src/connectors/backlog/index.ts
101130
+ var tools60 = { request: requestTool45 };
101131
+ var backlogConnector = new ConnectorPlugin({
101132
+ slug: "backlog",
101133
+ authType: AUTH_TYPES.API_KEY,
101134
+ name: "Backlog",
101135
+ description: "Connect to Nulab Backlog for project management, issue tracking, and wiki data retrieval using API key authentication.",
101136
+ iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/6KcVBGf3mUHnuCOQgQMvtT/e8558c7990e40e3be46948e9476190fb/backlog-favicon.svg",
101137
+ parameters: parameters60,
101138
+ releaseFlag: { dev1: true, dev2: true, prod: false },
101139
+ onboarding: backlogOnboarding,
101140
+ systemPrompt: {
101141
+ en: `### Tools
101142
+
101143
+ - \`backlog-api-key_request\`: The only way to call the Backlog REST API (v2). Use it to list projects, search issues, get issue details, create/update issues, manage wikis, and retrieve users. Authentication (API key as query parameter) and space URL are configured automatically.
101144
+
101145
+ ### Business Logic
101146
+
101147
+ 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.
101148
+
101149
+ #### Example
101150
+
101151
+ \`\`\`ts
101152
+ import { connection } from "@squadbase/vite-server/connectors/backlog-api-key";
101153
+
101154
+ const backlog = connection("<connectionId>");
101155
+
101156
+ // List projects
101157
+ const res = await backlog.request("/api/v2/projects");
101158
+ const projects = await res.json();
101159
+
101160
+ // Get issues for a project
101161
+ const issuesRes = await backlog.request("/api/v2/issues?projectId[]=12345&count=20&sort=updated&order=desc");
101162
+ const issues = await issuesRes.json();
101163
+
101164
+ // Create an issue
101165
+ await backlog.request("/api/v2/issues", {
101166
+ method: "POST",
101167
+ body: JSON.stringify({
101168
+ projectId: 12345,
101169
+ summary: "New issue title",
101170
+ issueTypeId: 67890,
101171
+ priorityId: 3,
101172
+ }),
101173
+ });
101174
+ \`\`\`
101175
+
101176
+ ### Backlog REST API v2 Reference
101177
+
101178
+ #### Space
101179
+ - GET space \u2014 Get space information
101180
+ - GET space/activities \u2014 Get recent activities in the space
101181
+
101182
+ #### Projects
101183
+ - GET projects \u2014 List all projects (query params: archived, all)
101184
+ - GET projects/{projectIdOrKey} \u2014 Get project details
101185
+ - GET projects/{projectIdOrKey}/statuses \u2014 List issue statuses
101186
+ - GET projects/{projectIdOrKey}/issueTypes \u2014 List issue types
101187
+ - GET projects/{projectIdOrKey}/categories \u2014 List issue categories
101188
+
101189
+ #### Issues
101190
+ - GET issues \u2014 Search issues (query params: projectId[], statusId[], assigneeId[], sort, order, count, offset, keyword)
101191
+ - GET issues/{issueIdOrKey} \u2014 Get issue details
101192
+ - GET issues/count \u2014 Get issue count
101193
+ - POST issues \u2014 Create an issue (body: projectId, summary, issueTypeId, priorityId, and optional fields)
101194
+ - PATCH issues/{issueIdOrKey} \u2014 Update an issue
101195
+ - DELETE issues/{issueIdOrKey} \u2014 Delete an issue
101196
+ - GET issues/{issueIdOrKey}/comments \u2014 List comments
101197
+ - POST issues/{issueIdOrKey}/comments \u2014 Add a comment (body: { content: "comment text" })
101198
+
101199
+ #### Wiki
101200
+ - GET wikis \u2014 List wiki pages (query params: projectIdOrKey, keyword)
101201
+ - GET wikis/{wikiId} \u2014 Get wiki page details
101202
+ - POST wikis \u2014 Create a wiki page (body: projectId, name, content)
101203
+ - PATCH wikis/{wikiId} \u2014 Update a wiki page
101204
+
101205
+ #### Users
101206
+ - GET users \u2014 List users in the space
101207
+ - GET users/myself \u2014 Get authenticated user info
101208
+
101209
+ #### Pagination
101210
+ - Use count (max 100, default 20) and offset parameters for pagination
101211
+ - sort: "created", "updated", "issueType", "category", "priority", etc.
101212
+ - order: "asc" or "desc"`,
101213
+ ja: `### \u30C4\u30FC\u30EB
101214
+
101215
+ - \`backlog-api-key_request\`: Backlog REST API\uFF08v2\uFF09\u3092\u547C\u3073\u51FA\u3059\u552F\u4E00\u306E\u624B\u6BB5\u3067\u3059\u3002\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u4E00\u89A7\u306E\u53D6\u5F97\u3001\u8AB2\u984C\u306E\u691C\u7D22\u3001\u8AB2\u984C\u8A73\u7D30\u306E\u53D6\u5F97\u3001\u8AB2\u984C\u306E\u4F5C\u6210\u30FB\u66F4\u65B0\u3001Wiki\u7BA1\u7406\u3001\u30E6\u30FC\u30B6\u30FC\u53D6\u5F97\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002\u8A8D\u8A3C\uFF08API\u30AD\u30FC\u3092\u30AF\u30A8\u30EA\u30D1\u30E9\u30E1\u30FC\u30BF\u3068\u3057\u3066\u4ED8\u4E0E\uFF09\u3068\u30B9\u30DA\u30FC\u30B9URL\u306F\u81EA\u52D5\u7684\u306B\u8A2D\u5B9A\u3055\u308C\u307E\u3059\u3002
101216
+
101217
+ ### Business Logic
101218
+
101219
+ \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
101220
+
101221
+ #### Example
101222
+
101223
+ \`\`\`ts
101224
+ import { connection } from "@squadbase/vite-server/connectors/backlog-api-key";
101225
+
101226
+ const backlog = connection("<connectionId>");
101227
+
101228
+ // \u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u4E00\u89A7\u3092\u53D6\u5F97
101229
+ const res = await backlog.request("/api/v2/projects");
101230
+ const projects = await res.json();
101231
+
101232
+ // \u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306E\u8AB2\u984C\u3092\u53D6\u5F97
101233
+ const issuesRes = await backlog.request("/api/v2/issues?projectId[]=12345&count=20&sort=updated&order=desc");
101234
+ const issues = await issuesRes.json();
101235
+
101236
+ // \u8AB2\u984C\u3092\u4F5C\u6210
101237
+ await backlog.request("/api/v2/issues", {
101238
+ method: "POST",
101239
+ body: JSON.stringify({
101240
+ projectId: 12345,
101241
+ summary: "\u65B0\u3057\u3044\u8AB2\u984C",
101242
+ issueTypeId: 67890,
101243
+ priorityId: 3,
101244
+ }),
101245
+ });
101246
+ \`\`\`
101247
+
101248
+ ### Backlog REST API v2 \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9
101249
+
101250
+ #### \u30B9\u30DA\u30FC\u30B9
101251
+ - GET space \u2014 \u30B9\u30DA\u30FC\u30B9\u60C5\u5831\u306E\u53D6\u5F97
101252
+ - GET space/activities \u2014 \u30B9\u30DA\u30FC\u30B9\u306E\u6700\u8FD1\u306E\u6D3B\u52D5\u3092\u53D6\u5F97
101253
+
101254
+ #### \u30D7\u30ED\u30B8\u30A7\u30AF\u30C8
101255
+ - GET projects \u2014 \u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u4E00\u89A7\u306E\u53D6\u5F97\uFF08\u30AF\u30A8\u30EA\u30D1\u30E9\u30E1\u30FC\u30BF: archived, all\uFF09
101256
+ - GET projects/{projectIdOrKey} \u2014 \u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u8A73\u7D30\u306E\u53D6\u5F97
101257
+ - GET projects/{projectIdOrKey}/statuses \u2014 \u8AB2\u984C\u30B9\u30C6\u30FC\u30BF\u30B9\u4E00\u89A7
101258
+ - GET projects/{projectIdOrKey}/issueTypes \u2014 \u8AB2\u984C\u7A2E\u5225\u4E00\u89A7
101259
+ - GET projects/{projectIdOrKey}/categories \u2014 \u8AB2\u984C\u30AB\u30C6\u30B4\u30EA\u4E00\u89A7
101260
+
101261
+ #### \u8AB2\u984C
101262
+ - GET issues \u2014 \u8AB2\u984C\u306E\u691C\u7D22\uFF08\u30AF\u30A8\u30EA\u30D1\u30E9\u30E1\u30FC\u30BF: projectId[], statusId[], assigneeId[], sort, order, count, offset, keyword\uFF09
101263
+ - GET issues/{issueIdOrKey} \u2014 \u8AB2\u984C\u8A73\u7D30\u306E\u53D6\u5F97
101264
+ - GET issues/count \u2014 \u8AB2\u984C\u6570\u306E\u53D6\u5F97
101265
+ - POST issues \u2014 \u8AB2\u984C\u306E\u4F5C\u6210\uFF08body: projectId, summary, issueTypeId, priorityId, \u305D\u306E\u4ED6\u30AA\u30D7\u30B7\u30E7\u30F3\u30D5\u30A3\u30FC\u30EB\u30C9\uFF09
101266
+ - PATCH issues/{issueIdOrKey} \u2014 \u8AB2\u984C\u306E\u66F4\u65B0
101267
+ - DELETE issues/{issueIdOrKey} \u2014 \u8AB2\u984C\u306E\u524A\u9664
101268
+ - GET issues/{issueIdOrKey}/comments \u2014 \u30B3\u30E1\u30F3\u30C8\u4E00\u89A7
101269
+ - POST issues/{issueIdOrKey}/comments \u2014 \u30B3\u30E1\u30F3\u30C8\u306E\u8FFD\u52A0\uFF08body: { content: "\u30B3\u30E1\u30F3\u30C8\u5185\u5BB9" }\uFF09
101270
+
101271
+ #### Wiki
101272
+ - GET wikis \u2014 Wiki\u30DA\u30FC\u30B8\u4E00\u89A7\u306E\u53D6\u5F97\uFF08\u30AF\u30A8\u30EA\u30D1\u30E9\u30E1\u30FC\u30BF: projectIdOrKey, keyword\uFF09
101273
+ - GET wikis/{wikiId} \u2014 Wiki\u30DA\u30FC\u30B8\u8A73\u7D30\u306E\u53D6\u5F97
101274
+ - POST wikis \u2014 Wiki\u30DA\u30FC\u30B8\u306E\u4F5C\u6210\uFF08body: projectId, name, content\uFF09
101275
+ - PATCH wikis/{wikiId} \u2014 Wiki\u30DA\u30FC\u30B8\u306E\u66F4\u65B0
101276
+
101277
+ #### \u30E6\u30FC\u30B6\u30FC
101278
+ - GET users \u2014 \u30B9\u30DA\u30FC\u30B9\u5185\u306E\u30E6\u30FC\u30B6\u30FC\u4E00\u89A7
101279
+ - GET users/myself \u2014 \u8A8D\u8A3C\u6E08\u307F\u30E6\u30FC\u30B6\u30FC\u60C5\u5831\u306E\u53D6\u5F97
101280
+
101281
+ #### \u30DA\u30FC\u30B8\u30CD\u30FC\u30B7\u30E7\u30F3
101282
+ - count\uFF08\u6700\u5927100\u3001\u30C7\u30D5\u30A9\u30EB\u30C820\uFF09\u3068 offset \u30D1\u30E9\u30E1\u30FC\u30BF\u3067\u30DA\u30FC\u30B8\u30CD\u30FC\u30B7\u30E7\u30F3
101283
+ - sort: "created", "updated", "issueType", "category", "priority" \u7B49
101284
+ - order: "asc" \u307E\u305F\u306F "desc"`
101285
+ },
101286
+ tools: tools60
101287
+ });
101288
+
101289
+ // ../connectors/src/connectors/gamma/setup.ts
101290
+ var gammaOnboarding = new ConnectorOnboarding({
101291
+ dataOverviewInstructions: {
101292
+ en: `1. Call gamma_request with GET /themes to list available themes in the workspace
101293
+ 2. Call gamma_request with GET /folders to list workspace folders
101294
+ 3. Try generating a simple presentation with gamma_generate: inputText "Sample presentation about AI", textMode "generate", numCards 3`,
101295
+ ja: `1. gamma_request \u3067 GET /themes \u3092\u547C\u3073\u51FA\u3057\u3001\u30EF\u30FC\u30AF\u30B9\u30DA\u30FC\u30B9\u3067\u5229\u7528\u53EF\u80FD\u306A\u30C6\u30FC\u30DE\u4E00\u89A7\u3092\u53D6\u5F97
101296
+ 2. gamma_request \u3067 GET /folders \u3092\u547C\u3073\u51FA\u3057\u3001\u30EF\u30FC\u30AF\u30B9\u30DA\u30FC\u30B9\u306E\u30D5\u30A9\u30EB\u30C0\u4E00\u89A7\u3092\u53D6\u5F97
101297
+ 3. gamma_generate \u3067\u30B7\u30F3\u30D7\u30EB\u306A\u30D7\u30EC\u30BC\u30F3\u30C6\u30FC\u30B7\u30E7\u30F3\u3092\u8A66\u4F5C: inputText "AI\u306B\u3064\u3044\u3066\u306E\u30B5\u30F3\u30D7\u30EB\u30D7\u30EC\u30BC\u30F3\u30C6\u30FC\u30B7\u30E7\u30F3", textMode "generate", numCards 3`
101298
+ }
101299
+ });
101300
+
101301
+ // ../connectors/src/connectors/gamma/parameters.ts
101302
+ var parameters61 = {
101303
+ apiKey: new ParameterDefinition({
101304
+ slug: "api-key",
101305
+ name: "Gamma API Key",
101306
+ description: "The Gamma API key for authentication. Generate from Account Settings > API Keys. Requires Pro, Ultra, Teams, or Business plan.",
101307
+ envVarBaseKey: "GAMMA_API_KEY",
101308
+ type: "text",
101309
+ secret: true,
101310
+ required: true
101311
+ })
101312
+ };
101313
+
101314
+ // ../connectors/src/connectors/gamma/tools/request.ts
101315
+ import { z as z77 } from "zod";
101316
+ var BASE_URL40 = "https://public-api.gamma.app/v1.0";
101317
+ var REQUEST_TIMEOUT_MS60 = 6e4;
101318
+ var inputSchema75 = z77.object({
101319
+ toolUseIntent: z77.string().optional().describe(
101320
+ "Brief description of what you intend to accomplish with this tool call"
101321
+ ),
101322
+ connectionId: z77.string().describe("ID of the Gamma connection to use"),
101323
+ method: z77.enum(["GET", "POST"]).describe("HTTP method. GET for listing resources, POST for creating."),
101324
+ path: z77.string().describe(
101325
+ "API path (e.g., '/themes', '/folders', '/generations', '/generations/{generationId}')"
101326
+ ),
101327
+ body: z77.record(z77.string(), z77.unknown()).optional().describe("Request body (JSON) for POST requests")
101328
+ });
101329
+ var outputSchema75 = z77.discriminatedUnion("success", [
101330
+ z77.object({
101331
+ success: z77.literal(true),
101332
+ status: z77.number(),
101333
+ data: z77.unknown()
101334
+ }),
101335
+ z77.object({
101336
+ success: z77.literal(false),
101337
+ error: z77.string()
101338
+ })
101339
+ ]);
101340
+ var requestTool46 = new ConnectorTool({
101341
+ name: "request",
101342
+ description: `Send authenticated requests to the Gamma REST API.
101343
+ Authentication is handled automatically using the API Key (X-API-KEY header).
101344
+ Use this tool for listing themes, listing folders, checking generation status, and other read operations.
101345
+ For creating presentations/documents, prefer the gamma_generate tool instead.`,
101346
+ inputSchema: inputSchema75,
101347
+ outputSchema: outputSchema75,
101348
+ async execute({ connectionId, method, path: path5, body }, connections) {
101349
+ const connection = connections.find((c6) => c6.id === connectionId);
101350
+ if (!connection) {
101351
+ return {
101352
+ success: false,
101353
+ error: `Connection ${connectionId} not found`
101354
+ };
101355
+ }
101356
+ console.log(
101357
+ `[connector-request] gamma/${connection.name}: ${method} ${path5}`
101358
+ );
101359
+ try {
101360
+ const apiKey = parameters61.apiKey.getValue(connection);
101361
+ const url = `${BASE_URL40}${path5}`;
101362
+ const controller = new AbortController();
101363
+ const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS60);
101364
+ try {
101365
+ const response = await fetch(url, {
101366
+ method,
101367
+ headers: {
101368
+ "X-API-KEY": apiKey,
101369
+ "Content-Type": "application/json"
101370
+ },
101371
+ body: body ? JSON.stringify(body) : void 0,
101372
+ signal: controller.signal
101373
+ });
101374
+ const data = await response.json();
101375
+ if (!response.ok) {
101376
+ const err = data;
101377
+ const errorMessage = typeof err?.message === "string" ? err.message : typeof err?.error === "string" ? err.error : `HTTP ${response.status} ${response.statusText}`;
101378
+ return { success: false, error: errorMessage };
101379
+ }
101380
+ return { success: true, status: response.status, data };
101381
+ } finally {
101382
+ clearTimeout(timeout);
101383
+ }
101384
+ } catch (err) {
101385
+ const msg = err instanceof Error ? err.message : String(err);
101386
+ return { success: false, error: msg };
101387
+ }
101388
+ }
101389
+ });
101390
+
101391
+ // ../connectors/src/connectors/gamma/tools/generate.ts
101392
+ import { z as z78 } from "zod";
101393
+ var BASE_URL41 = "https://public-api.gamma.app/v1.0";
101394
+ var POLL_INTERVAL_MS3 = 5e3;
101395
+ var MAX_POLL_DURATION_MS = 3e5;
101396
+ var inputSchema76 = z78.object({
101397
+ toolUseIntent: z78.string().optional().describe(
101398
+ "Brief description of what you intend to accomplish with this tool call"
101399
+ ),
101400
+ connectionId: z78.string().describe("ID of the Gamma connection to use"),
101401
+ inputText: z78.string().describe(
101402
+ "Content for the generation. Can include text and image URLs. Max ~400,000 characters."
101403
+ ),
101404
+ textMode: z78.enum(["generate", "condense", "preserve"]).describe(
101405
+ "How inputText is modified: 'generate' creates new content from the topic, 'condense' shortens existing text, 'preserve' keeps text as-is."
101406
+ ),
101407
+ format: z78.enum(["presentation", "document", "webpage", "social"]).optional().describe("Type of artifact to create. Defaults to 'presentation'."),
101408
+ numCards: z78.number().int().min(1).max(75).optional().describe("Number of cards/slides. Defaults to 10."),
101409
+ themeId: z78.string().optional().describe(
101410
+ "Theme ID for look and feel. Use gamma_request GET /themes to list available themes."
101411
+ ),
101412
+ tone: z78.string().optional().describe(
101413
+ "Tone/voice of the output (e.g., 'professional', 'casual', 'academic'). Max 500 chars."
101414
+ ),
101415
+ audience: z78.string().optional().describe(
101416
+ "Target audience description (e.g., 'marketing executives'). Max 500 chars."
101417
+ ),
101418
+ language: z78.string().optional().describe("Output language code (e.g., 'en', 'ja'). Defaults to 'en'."),
101419
+ textAmount: z78.enum(["brief", "medium", "detailed", "extensive"]).optional().describe("Text volume per card. Defaults to 'medium'."),
101420
+ imageSource: z78.enum([
101421
+ "aiGenerated",
101422
+ "pictographic",
101423
+ "pexels",
101424
+ "giphy",
101425
+ "webAllImages",
101426
+ "webFreeToUse",
101427
+ "webFreeToUseCommercially",
101428
+ "themeAccent",
101429
+ "placeholder",
101430
+ "noImages"
101431
+ ]).optional().describe("Image source. Defaults to 'aiGenerated'."),
101432
+ additionalInstructions: z78.string().optional().describe(
101433
+ "Additional specifications for content, layout, and aesthetics. Max 5000 chars."
101434
+ ),
101435
+ exportAs: z78.enum(["pdf", "pptx", "png"]).optional().describe("Export file format. If omitted, no export file is generated.")
101436
+ });
101437
+ var outputSchema76 = z78.discriminatedUnion("success", [
101438
+ z78.object({
101439
+ success: z78.literal(true),
101440
+ generationId: z78.string(),
101441
+ gammaId: z78.string(),
101442
+ gammaUrl: z78.string(),
101443
+ exportUrl: z78.string().optional(),
101444
+ credits: z78.object({
101445
+ deducted: z78.number(),
101446
+ remaining: z78.number()
101447
+ }).optional()
101448
+ }),
101449
+ z78.object({
101450
+ success: z78.literal(false),
101451
+ error: z78.string()
101452
+ })
101453
+ ]);
101454
+ var generateTool = new ConnectorTool({
101455
+ name: "generate",
101456
+ description: `Generate a presentation, document, webpage, or social post using Gamma AI.
101457
+ This tool creates the generation, then automatically polls until completion and returns the result URL.
101458
+ Use gamma_request GET /themes first if you want to pick a specific theme.`,
101459
+ inputSchema: inputSchema76,
101460
+ outputSchema: outputSchema76,
101461
+ async execute({
101462
+ connectionId,
101463
+ inputText,
101464
+ textMode,
101465
+ format: format2,
101466
+ numCards,
101467
+ themeId,
101468
+ tone,
101469
+ audience,
101470
+ language,
101471
+ textAmount,
101472
+ imageSource,
101473
+ additionalInstructions,
101474
+ exportAs
101475
+ }, connections) {
101476
+ const connection = connections.find((c6) => c6.id === connectionId);
101477
+ if (!connection) {
101478
+ return {
101479
+ success: false,
101480
+ error: `Connection ${connectionId} not found`
101481
+ };
101482
+ }
101483
+ console.log(
101484
+ `[connector-generate] gamma/${connection.name}: creating ${format2 ?? "presentation"}`
101485
+ );
101486
+ try {
101487
+ const apiKey = parameters61.apiKey.getValue(connection);
101488
+ const headers = {
101489
+ "X-API-KEY": apiKey,
101490
+ "Content-Type": "application/json"
101491
+ };
101492
+ const body = {
101493
+ inputText,
101494
+ textMode
101495
+ };
101496
+ if (format2) body.format = format2;
101497
+ if (numCards) body.numCards = numCards;
101498
+ if (themeId) body.themeId = themeId;
101499
+ if (additionalInstructions)
101500
+ body.additionalInstructions = additionalInstructions;
101501
+ if (exportAs) body.exportAs = exportAs;
101502
+ const textOptions = {};
101503
+ if (tone) textOptions.tone = tone;
101504
+ if (audience) textOptions.audience = audience;
101505
+ if (language) textOptions.language = language;
101506
+ if (textAmount) textOptions.amount = textAmount;
101507
+ if (Object.keys(textOptions).length > 0) body.textOptions = textOptions;
101508
+ if (imageSource) body.imageOptions = { source: imageSource };
101509
+ const createRes = await fetch(`${BASE_URL41}/generations`, {
101510
+ method: "POST",
101511
+ headers,
101512
+ body: JSON.stringify(body)
101513
+ });
101514
+ const createData = await createRes.json();
101515
+ if (!createRes.ok) {
101516
+ const errorMessage = typeof createData?.message === "string" ? createData.message : typeof createData?.error === "string" ? createData.error : `HTTP ${createRes.status} ${createRes.statusText}`;
101517
+ return { success: false, error: errorMessage };
101518
+ }
101519
+ const generationId = createData.generationId;
101520
+ if (!generationId) {
101521
+ return {
101522
+ success: false,
101523
+ error: "No generationId returned from API"
101524
+ };
101525
+ }
101526
+ const deadline = Date.now() + MAX_POLL_DURATION_MS;
101527
+ while (Date.now() < deadline) {
101528
+ await new Promise((resolve) => setTimeout(resolve, POLL_INTERVAL_MS3));
101529
+ const pollRes = await fetch(`${BASE_URL41}/generations/${generationId}`, {
101530
+ method: "GET",
101531
+ headers
101532
+ });
101533
+ const pollData = await pollRes.json();
101534
+ if (!pollRes.ok) {
101535
+ const errorMessage = typeof pollData?.message === "string" ? pollData.message : `Polling failed: HTTP ${pollRes.status}`;
101536
+ return { success: false, error: errorMessage };
101537
+ }
101538
+ const status = pollData.status;
101539
+ if (status === "completed") {
101540
+ return {
101541
+ success: true,
101542
+ generationId,
101543
+ gammaId: pollData.gammaId,
101544
+ gammaUrl: pollData.gammaUrl,
101545
+ exportUrl: pollData.exportUrl || void 0,
101546
+ credits: pollData.credits
101547
+ };
101548
+ }
101549
+ if (status === "failed") {
101550
+ const error2 = pollData.error;
101551
+ const errorMessage = typeof error2?.message === "string" ? error2.message : "Generation failed";
101552
+ return { success: false, error: errorMessage };
101553
+ }
101554
+ }
101555
+ return {
101556
+ success: false,
101557
+ error: `Generation timed out after ${MAX_POLL_DURATION_MS / 1e3}s. generationId: ${generationId} \u2014 you can check status with GET /generations/${generationId}`
101558
+ };
101559
+ } catch (err) {
101560
+ const msg = err instanceof Error ? err.message : String(err);
101561
+ return { success: false, error: msg };
101562
+ }
101563
+ }
101564
+ });
101565
+
101566
+ // ../connectors/src/connectors/gamma/index.ts
101567
+ var tools61 = { request: requestTool46, generate: generateTool };
101568
+ var gammaConnector = new ConnectorPlugin({
101569
+ slug: "gamma",
101570
+ authType: AUTH_TYPES.API_KEY,
101571
+ name: "Gamma",
101572
+ description: "Connect to Gamma for AI-powered presentation, document, webpage, and social post generation.",
101573
+ iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/KoMGPpPcgtB9oDYe1OBjS/1ba7eb061c4497106bf6d249866dc471/gamma.svg",
101574
+ parameters: parameters61,
101575
+ releaseFlag: { dev1: true, dev2: false, prod: false },
101576
+ onboarding: gammaOnboarding,
101577
+ systemPrompt: {
101578
+ en: `### Tools
101579
+
101580
+ - \`gamma_request\`: Send authenticated requests to the Gamma REST API. Use for listing themes, folders, and checking generation status. Authentication (X-API-KEY) is configured automatically.
101581
+ - \`gamma_generate\`: Generate a presentation, document, webpage, or social post using Gamma AI. This tool handles the full workflow: creates the generation, polls for completion, and returns the result URL. Prefer this over manually calling POST /generations + polling.
101582
+
101583
+ ### Business Logic
101584
+
101585
+ The business logic type for this connector is "typescript". Use the connector SDK in your handler. Do NOT read credentials from environment variables.
101586
+
101587
+ SDK methods (client created via \`connection(connectionId)\`):
101588
+ - \`client.request(path, init?)\` \u2014 low-level authenticated fetch
101589
+ - \`client.listThemes(options?)\` \u2014 list available themes (query, limit, after)
101590
+ - \`client.listFolders(options?)\` \u2014 list workspace folders (query, limit, after)
101591
+ - \`client.createGeneration(options)\` \u2014 create a generation, returns generationId
101592
+ - \`client.getGeneration(generationId)\` \u2014 get generation status and result
101593
+ - \`client.generateAndWait(options)\` \u2014 create generation and poll until completion
101594
+
101595
+ \`\`\`ts
101596
+ import type { Context } from "hono";
101597
+ import { connection } from "@squadbase/vite-server/connectors/gamma";
101598
+
101599
+ const gamma = connection("<connectionId>");
101600
+
101601
+ export default async function handler(c: Context) {
101602
+ const { topic, numCards = 5 } = await c.req.json<{
101603
+ topic: string;
101604
+ numCards?: number;
101605
+ }>();
101606
+
101607
+ const result = await gamma.generateAndWait({
101608
+ inputText: topic,
101609
+ textMode: "generate",
101610
+ format: "presentation",
101611
+ numCards,
101612
+ });
101613
+
101614
+ return c.json(result);
101615
+ }
101616
+ \`\`\`
101617
+
101618
+ ### Gamma REST API Reference
101619
+
101620
+ - Base URL: \`https://public-api.gamma.app/v1.0\`
101621
+ - Authentication: X-API-KEY header (handled automatically)
101622
+
101623
+ #### Endpoints
101624
+
101625
+ - POST \`/generations\` \u2014 Create a generation (presentation, document, webpage, social)
101626
+ - Required: \`inputText\` (string), \`textMode\` ("generate" | "condense" | "preserve")
101627
+ - Optional: \`format\`, \`numCards\`, \`themeId\`, \`textOptions\` (tone, audience, language, amount), \`imageOptions\` (source, model, style), \`additionalInstructions\`, \`exportAs\` (pdf, pptx, png), \`folderIds\`, \`sharingOptions\`
101628
+ - Returns: \`{ generationId }\`
101629
+ - GET \`/generations/{generationId}\` \u2014 Poll generation status
101630
+ - Returns: \`{ generationId, status, gammaId?, gammaUrl?, exportUrl?, credits?, error? }\`
101631
+ - Status values: "pending", "completed", "failed"
101632
+ - Poll every 5 seconds until status changes from "pending"
101633
+ - GET \`/themes\` \u2014 List available themes (query, limit, after for pagination)
101634
+ - GET \`/folders\` \u2014 List workspace folders (query, limit, after for pagination)
101635
+
101636
+ #### Generation Formats
101637
+ - \`presentation\` \u2014 Slide deck (dimensions: fluid, 16x9, 4x3)
101638
+ - \`document\` \u2014 Document (dimensions: fluid, pageless, letter, a4)
101639
+ - \`webpage\` \u2014 Web page
101640
+ - \`social\` \u2014 Social media post (dimensions: 1x1, 4x5, 9x16)
101641
+
101642
+ #### Text Modes
101643
+ - \`generate\` \u2014 AI generates new content from the input topic
101644
+ - \`condense\` \u2014 AI shortens the provided text
101645
+ - \`preserve\` \u2014 Input text is used as-is
101646
+
101647
+ #### Image Sources
101648
+ - \`aiGenerated\`, \`pictographic\`, \`pexels\`, \`giphy\`, \`webFreeToUseCommercially\`, \`noImages\`, etc.`,
101649
+ ja: `### \u30C4\u30FC\u30EB
101650
+
101651
+ - \`gamma_request\`: Gamma REST API\u306B\u8A8D\u8A3C\u6E08\u307F\u30EA\u30AF\u30A8\u30B9\u30C8\u3092\u9001\u4FE1\u3057\u307E\u3059\u3002\u30C6\u30FC\u30DE\u4E00\u89A7\u3001\u30D5\u30A9\u30EB\u30C0\u4E00\u89A7\u3001\u751F\u6210\u30B9\u30C6\u30FC\u30BF\u30B9\u306E\u78BA\u8A8D\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002\u8A8D\u8A3C\uFF08X-API-KEY\uFF09\u306F\u81EA\u52D5\u7684\u306B\u8A2D\u5B9A\u3055\u308C\u307E\u3059\u3002
101652
+ - \`gamma_generate\`: Gamma AI\u3092\u4F7F\u3063\u3066\u30D7\u30EC\u30BC\u30F3\u30C6\u30FC\u30B7\u30E7\u30F3\u3001\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u3001\u30A6\u30A7\u30D6\u30DA\u30FC\u30B8\u3001\u30BD\u30FC\u30B7\u30E3\u30EB\u6295\u7A3F\u3092\u751F\u6210\u3057\u307E\u3059\u3002\u751F\u6210\u306E\u4F5C\u6210\u304B\u3089\u30DD\u30FC\u30EA\u30F3\u30B0\u3001\u7D50\u679CURL\u306E\u8FD4\u5374\u307E\u3067\u4E00\u62EC\u3067\u51E6\u7406\u3057\u307E\u3059\u3002\u624B\u52D5\u3067POST /generations + \u30DD\u30FC\u30EA\u30F3\u30B0\u3059\u308B\u3088\u308A\u3082\u3053\u3061\u3089\u3092\u63A8\u5968\u3057\u307E\u3059\u3002
101653
+
101654
+ ### Business Logic
101655
+
101656
+ \u3053\u306E\u30B3\u30CD\u30AF\u30BF\u306E\u30D3\u30B8\u30CD\u30B9\u30ED\u30B8\u30C3\u30AF\u30BF\u30A4\u30D7\u306F "typescript" \u3067\u3059\u3002\u30CF\u30F3\u30C9\u30E9\u5185\u3067\u306F\u30B3\u30CD\u30AF\u30BFSDK\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u74B0\u5883\u5909\u6570\u304B\u3089\u8A8D\u8A3C\u60C5\u5831\u3092\u8AAD\u307F\u53D6\u3089\u306A\u3044\u3067\u304F\u3060\u3055\u3044\u3002
101657
+
101658
+ SDK\u30E1\u30BD\u30C3\u30C9 (\`connection(connectionId)\` \u3067\u4F5C\u6210\u3057\u305F\u30AF\u30E9\u30A4\u30A2\u30F3\u30C8):
101659
+ - \`client.request(path, init?)\` \u2014 \u4F4E\u30EC\u30D9\u30EB\u306E\u8A8D\u8A3C\u4ED8\u304Dfetch
101660
+ - \`client.listThemes(options?)\` \u2014 \u30C6\u30FC\u30DE\u4E00\u89A7\u306E\u53D6\u5F97\uFF08query, limit, after\uFF09
101661
+ - \`client.listFolders(options?)\` \u2014 \u30EF\u30FC\u30AF\u30B9\u30DA\u30FC\u30B9\u30D5\u30A9\u30EB\u30C0\u4E00\u89A7\u306E\u53D6\u5F97\uFF08query, limit, after\uFF09
101662
+ - \`client.createGeneration(options)\` \u2014 \u751F\u6210\u306E\u4F5C\u6210\u3001generationId\u3092\u8FD4\u3059
101663
+ - \`client.getGeneration(generationId)\` \u2014 \u751F\u6210\u30B9\u30C6\u30FC\u30BF\u30B9\u3068\u7D50\u679C\u306E\u53D6\u5F97
101664
+ - \`client.generateAndWait(options)\` \u2014 \u751F\u6210\u3092\u4F5C\u6210\u3057\u5B8C\u4E86\u307E\u3067\u30DD\u30FC\u30EA\u30F3\u30B0
101665
+
101666
+ \`\`\`ts
101667
+ import type { Context } from "hono";
101668
+ import { connection } from "@squadbase/vite-server/connectors/gamma";
101669
+
101670
+ const gamma = connection("<connectionId>");
101671
+
101672
+ export default async function handler(c: Context) {
101673
+ const { topic, numCards = 5 } = await c.req.json<{
101674
+ topic: string;
101675
+ numCards?: number;
101676
+ }>();
101677
+
101678
+ const result = await gamma.generateAndWait({
101679
+ inputText: topic,
101680
+ textMode: "generate",
101681
+ format: "presentation",
101682
+ numCards,
101683
+ });
101684
+
101685
+ return c.json(result);
101686
+ }
101687
+ \`\`\`
101688
+
101689
+ ### Gamma REST API \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9
101690
+
101691
+ - \u30D9\u30FC\u30B9URL: \`https://public-api.gamma.app/v1.0\`
101692
+ - \u8A8D\u8A3C: X-API-KEY\u30D8\u30C3\u30C0\u30FC\uFF08\u81EA\u52D5\u8A2D\u5B9A\uFF09
101693
+
101694
+ #### \u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8
101695
+
101696
+ - POST \`/generations\` \u2014 \u751F\u6210\u306E\u4F5C\u6210\uFF08\u30D7\u30EC\u30BC\u30F3\u30C6\u30FC\u30B7\u30E7\u30F3\u3001\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u3001\u30A6\u30A7\u30D6\u30DA\u30FC\u30B8\u3001\u30BD\u30FC\u30B7\u30E3\u30EB\uFF09
101697
+ - \u5FC5\u9808: \`inputText\`\uFF08\u6587\u5B57\u5217\uFF09\u3001\`textMode\`\uFF08"generate" | "condense" | "preserve"\uFF09
101698
+ - \u30AA\u30D7\u30B7\u30E7\u30F3: \`format\`, \`numCards\`, \`themeId\`, \`textOptions\`\uFF08tone, audience, language, amount\uFF09, \`imageOptions\`\uFF08source, model, style\uFF09, \`additionalInstructions\`, \`exportAs\`\uFF08pdf, pptx, png\uFF09, \`folderIds\`, \`sharingOptions\`
101699
+ - \u8FD4\u5374: \`{ generationId }\`
101700
+ - GET \`/generations/{generationId}\` \u2014 \u751F\u6210\u30B9\u30C6\u30FC\u30BF\u30B9\u306E\u30DD\u30FC\u30EA\u30F3\u30B0
101701
+ - \u8FD4\u5374: \`{ generationId, status, gammaId?, gammaUrl?, exportUrl?, credits?, error? }\`
101702
+ - \u30B9\u30C6\u30FC\u30BF\u30B9\u5024: "pending", "completed", "failed"
101703
+ - status\u304C"pending"\u3067\u306A\u304F\u306A\u308B\u307E\u30675\u79D2\u3054\u3068\u306B\u30DD\u30FC\u30EA\u30F3\u30B0
101704
+ - GET \`/themes\` \u2014 \u30C6\u30FC\u30DE\u4E00\u89A7\uFF08query, limit, after\u3067\u30DA\u30FC\u30B8\u30CD\u30FC\u30B7\u30E7\u30F3\uFF09
101705
+ - GET \`/folders\` \u2014 \u30D5\u30A9\u30EB\u30C0\u4E00\u89A7\uFF08query, limit, after\u3067\u30DA\u30FC\u30B8\u30CD\u30FC\u30B7\u30E7\u30F3\uFF09
101706
+
101707
+ #### \u751F\u6210\u30D5\u30A9\u30FC\u30DE\u30C3\u30C8
101708
+ - \`presentation\` \u2014 \u30B9\u30E9\u30A4\u30C9\u30C7\u30C3\u30AD\uFF08\u5BF8\u6CD5: fluid, 16x9, 4x3\uFF09
101709
+ - \`document\` \u2014 \u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\uFF08\u5BF8\u6CD5: fluid, pageless, letter, a4\uFF09
101710
+ - \`webpage\` \u2014 \u30A6\u30A7\u30D6\u30DA\u30FC\u30B8
101711
+ - \`social\` \u2014 \u30BD\u30FC\u30B7\u30E3\u30EB\u30E1\u30C7\u30A3\u30A2\u6295\u7A3F\uFF08\u5BF8\u6CD5: 1x1, 4x5, 9x16\uFF09
101712
+
101713
+ #### \u30C6\u30AD\u30B9\u30C8\u30E2\u30FC\u30C9
101714
+ - \`generate\` \u2014 AI\u304C\u5165\u529B\u30C8\u30D4\u30C3\u30AF\u304B\u3089\u65B0\u3057\u3044\u30B3\u30F3\u30C6\u30F3\u30C4\u3092\u751F\u6210
101715
+ - \`condense\` \u2014 AI\u304C\u63D0\u4F9B\u3055\u308C\u305F\u30C6\u30AD\u30B9\u30C8\u3092\u77ED\u7E2E
101716
+ - \`preserve\` \u2014 \u5165\u529B\u30C6\u30AD\u30B9\u30C8\u3092\u305D\u306E\u307E\u307E\u4F7F\u7528
101717
+
101718
+ #### \u753B\u50CF\u30BD\u30FC\u30B9
101719
+ - \`aiGenerated\`, \`pictographic\`, \`pexels\`, \`giphy\`, \`webFreeToUseCommercially\`, \`noImages\` \u306A\u3069`
101720
+ },
101721
+ tools: tools61
101722
+ });
101723
+
101014
101724
  // ../connectors/src/connectors/registry.ts
101015
101725
  var plugins = {
101016
101726
  snowflake: snowflakeConnector,
@@ -101071,7 +101781,9 @@ var plugins = {
101071
101781
  intercom: intercomConnector,
101072
101782
  intercomOauth: intercomOauthConnector,
101073
101783
  mixpanel: mixpanelConnector,
101074
- grafana: grafanaConnector
101784
+ grafana: grafanaConnector,
101785
+ backlog: backlogConnector,
101786
+ gamma: gammaConnector
101075
101787
  };
101076
101788
  var connectors = {
101077
101789
  ...plugins,
@@ -101288,62 +102000,62 @@ import { watch as fsWatch2 } from "fs";
101288
102000
  import path2 from "path";
101289
102001
 
101290
102002
  // src/types/server-logic.ts
101291
- import { z as z76 } from "zod";
101292
- var parameterMetaSchema = z76.object({
101293
- name: z76.string(),
101294
- type: z76.enum(["string", "number", "boolean"]),
101295
- description: z76.string(),
101296
- required: z76.boolean().optional(),
101297
- default: z76.union([z76.string(), z76.number(), z76.boolean()]).optional()
101298
- });
101299
- var serverLogicCacheConfigSchema = z76.object({
101300
- ttl: z76.number(),
101301
- staleWhileRevalidate: z76.boolean().optional()
101302
- });
101303
- var serverLogicSchemaObjectSchema = z76.lazy(
101304
- () => z76.object({
101305
- type: z76.enum(["string", "number", "integer", "boolean", "object", "array", "null"]).optional(),
101306
- format: z76.string().optional(),
101307
- description: z76.string().optional(),
101308
- nullable: z76.boolean().optional(),
101309
- enum: z76.array(z76.union([z76.string(), z76.number(), z76.boolean(), z76.null()])).optional(),
102003
+ import { z as z79 } from "zod";
102004
+ var parameterMetaSchema = z79.object({
102005
+ name: z79.string(),
102006
+ type: z79.enum(["string", "number", "boolean"]),
102007
+ description: z79.string(),
102008
+ required: z79.boolean().optional(),
102009
+ default: z79.union([z79.string(), z79.number(), z79.boolean()]).optional()
102010
+ });
102011
+ var serverLogicCacheConfigSchema = z79.object({
102012
+ ttl: z79.number(),
102013
+ staleWhileRevalidate: z79.boolean().optional()
102014
+ });
102015
+ var serverLogicSchemaObjectSchema = z79.lazy(
102016
+ () => z79.object({
102017
+ type: z79.enum(["string", "number", "integer", "boolean", "object", "array", "null"]).optional(),
102018
+ format: z79.string().optional(),
102019
+ description: z79.string().optional(),
102020
+ nullable: z79.boolean().optional(),
102021
+ enum: z79.array(z79.union([z79.string(), z79.number(), z79.boolean(), z79.null()])).optional(),
101310
102022
  items: serverLogicSchemaObjectSchema.optional(),
101311
- properties: z76.record(z76.string(), serverLogicSchemaObjectSchema).optional(),
101312
- required: z76.array(z76.string()).optional(),
101313
- additionalProperties: z76.union([z76.boolean(), serverLogicSchemaObjectSchema]).optional(),
101314
- minimum: z76.number().optional(),
101315
- maximum: z76.number().optional(),
101316
- minLength: z76.number().optional(),
101317
- maxLength: z76.number().optional(),
101318
- pattern: z76.string().optional()
102023
+ properties: z79.record(z79.string(), serverLogicSchemaObjectSchema).optional(),
102024
+ required: z79.array(z79.string()).optional(),
102025
+ additionalProperties: z79.union([z79.boolean(), serverLogicSchemaObjectSchema]).optional(),
102026
+ minimum: z79.number().optional(),
102027
+ maximum: z79.number().optional(),
102028
+ minLength: z79.number().optional(),
102029
+ maxLength: z79.number().optional(),
102030
+ pattern: z79.string().optional()
101319
102031
  })
101320
102032
  );
101321
- var serverLogicMediaTypeSchema = z76.object({
102033
+ var serverLogicMediaTypeSchema = z79.object({
101322
102034
  schema: serverLogicSchemaObjectSchema.optional(),
101323
- example: z76.unknown().optional()
102035
+ example: z79.unknown().optional()
101324
102036
  });
101325
- var serverLogicResponseSchema = z76.object({
101326
- description: z76.string().optional(),
101327
- content: z76.record(z76.string(), serverLogicMediaTypeSchema).optional()
102037
+ var serverLogicResponseSchema = z79.object({
102038
+ description: z79.string().optional(),
102039
+ content: z79.record(z79.string(), serverLogicMediaTypeSchema).optional()
101328
102040
  });
101329
102041
  var jsonBaseFields = {
101330
- description: z76.string(),
101331
- parameters: z76.array(parameterMetaSchema).optional(),
102042
+ description: z79.string(),
102043
+ parameters: z79.array(parameterMetaSchema).optional(),
101332
102044
  response: serverLogicResponseSchema.optional(),
101333
102045
  cache: serverLogicCacheConfigSchema.optional()
101334
102046
  };
101335
- var jsonSqlServerLogicSchema = z76.object({
102047
+ var jsonSqlServerLogicSchema = z79.object({
101336
102048
  ...jsonBaseFields,
101337
- type: z76.literal("sql").optional(),
101338
- query: z76.string(),
101339
- connectionId: z76.string()
102049
+ type: z79.literal("sql").optional(),
102050
+ query: z79.string(),
102051
+ connectionId: z79.string()
101340
102052
  });
101341
- var jsonTypeScriptServerLogicSchema = z76.object({
102053
+ var jsonTypeScriptServerLogicSchema = z79.object({
101342
102054
  ...jsonBaseFields,
101343
- type: z76.literal("typescript"),
101344
- handlerPath: z76.string()
102055
+ type: z79.literal("typescript"),
102056
+ handlerPath: z79.string()
101345
102057
  });
101346
- var anyJsonServerLogicSchema = z76.union([
102058
+ var anyJsonServerLogicSchema = z79.union([
101347
102059
  jsonTypeScriptServerLogicSchema,
101348
102060
  jsonSqlServerLogicSchema
101349
102061
  ]);