@tool-bridge/server 0.1.1 → 0.3.0

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 (107) hide show
  1. package/dist/airtable-V6446SVY.js +792 -0
  2. package/dist/alt_text_generator_ai-HV7JZPDT.js +72 -0
  3. package/dist/amap-TTTVB6WS.js +755 -0
  4. package/dist/anthropic-JH3RA363.js +224 -0
  5. package/dist/apify-ETNN7ITU.js +262 -0
  6. package/dist/brave_search-3DDR2MMB.js +322 -0
  7. package/dist/chunk-CSJEZHQO.js +252 -0
  8. package/dist/chunk-JLTYA2B3.js +20121 -0
  9. package/dist/chunk-K7FVSFUX.js +333 -0
  10. package/dist/{chunk-MQEYFCJB.js → chunk-KGYJEEBI.js} +2770 -21574
  11. package/dist/circleci-MX3TX3HC.js +409 -0
  12. package/dist/clerk-MRPORVF4.js +1036 -0
  13. package/dist/cloudflare_dns-OWP7DD7L.js +605 -0
  14. package/dist/cohere-GPECP66S.js +197 -0
  15. package/dist/confluence-BN7LZ6BC.js +436 -0
  16. package/dist/convertapi-SBEOFOFQ.js +161 -0
  17. package/dist/currencyapi-P2YY7Y7P.js +306 -0
  18. package/dist/deepseek-MWB3NYIN.js +205 -0
  19. package/dist/docker_hub-3JSCIGQ3.js +946 -0
  20. package/dist/dropbox-RFIBDAXO.js +1308 -0
  21. package/dist/dub-YVP57ELQ.js +706 -0
  22. package/dist/e2b-NFSUHTZR.js +305 -0
  23. package/dist/exa-KTDY6IV3.js +360 -0
  24. package/dist/fal_ai-OCUENLNQ.js +405 -0
  25. package/dist/feishu-5CWBQ7E5.js +225 -0
  26. package/dist/feishu_custom_bot-ZJR22OK6.js +240 -0
  27. package/dist/figma-YULGANSA.js +798 -0
  28. package/dist/firehydrant-2V6YSYAP.js +573 -0
  29. package/dist/fixer-LTCDB3CJ.js +171 -0
  30. package/dist/fly-IXPKMAML.js +478 -0
  31. package/dist/front-KRFB4M5X.js +379 -0
  32. package/dist/geocodio-VVURKYHQ.js +236 -0
  33. package/dist/ghost-6J2RIOUB.js +341 -0
  34. package/dist/github-5Z6KQRYH.js +5410 -0
  35. package/dist/gmail-KU4NZ7VA.js +1894 -0
  36. package/dist/googlecalendar-X44DFFXG.js +2539 -0
  37. package/dist/googledocs-WSGLPKSF.js +1322 -0
  38. package/dist/grafana-4PKSSDXY.js +817 -0
  39. package/dist/graphhopper-DF65ZNGK.js +336 -0
  40. package/dist/index.d.ts +181 -2
  41. package/dist/index.js +2 -1
  42. package/dist/ip2proxy-UCAQ5P2J.js +118 -0
  43. package/dist/ipgeolocation_io-UX6FCA2S.js +333 -0
  44. package/dist/ipqualityscore-MKTRXIZJ.js +287 -0
  45. package/dist/jina_ai-MRHPCSV5.js +119 -0
  46. package/dist/jira-EG7ZPOIW.js +627 -0
  47. package/dist/langsmith-FNO3RCOZ.js +597 -0
  48. package/dist/lemlist-SN6BJHSG.js +298 -0
  49. package/dist/linear-H3VU4PSD.js +2163 -0
  50. package/dist/logsnag-OY2JJT2H.js +167 -0
  51. package/dist/main.js +246 -2
  52. package/dist/mattermost-C5SQ7PGD.js +320 -0
  53. package/dist/mem0-LMLE5BFC.js +567 -0
  54. package/dist/memos-UWFAMBZC.js +781 -0
  55. package/dist/metabase-SRYDSDJ6.js +365 -0
  56. package/dist/mistral_ai-YNIJ7VDM.js +1195 -0
  57. package/dist/mother_duck-CPGOFEXE.js +322 -0
  58. package/dist/ngrok-CDJFBSOM.js +375 -0
  59. package/dist/notes-DIVFH3P3.js +109 -0
  60. package/dist/notion-HGDKS4HK.js +945 -0
  61. package/dist/open_exchange_rates-COHHYJDD.js +216 -0
  62. package/dist/openai-4TRT66GW.js +795 -0
  63. package/dist/opengraph_io-YKVW4PXI.js +377 -0
  64. package/dist/openrouter-6CV7B7V5.js +444 -0
  65. package/dist/outline-YWDUK5F7.js +604 -0
  66. package/dist/paddle-MEU7HWDZ.js +464 -0
  67. package/dist/perplexity-MRQUDBIC.js +238 -0
  68. package/dist/pinecone-JI7X2TAF.js +599 -0
  69. package/dist/pipedrive-6JQPAW23.js +453 -0
  70. package/dist/polar-7BF56CMC.js +400 -0
  71. package/dist/posthog-YPU5ADEN.js +3462 -0
  72. package/dist/postmark-BEU5OFKU.js +441 -0
  73. package/dist/prerender-UT5GOOZH.js +180 -0
  74. package/dist/pubmed-3SGOE24Q.js +1052 -0
  75. package/dist/railway-CEK4GLRQ.js +452 -0
  76. package/dist/readwise-DXQUQU67.js +482 -0
  77. package/dist/render-7TGAU5AW.js +473 -0
  78. package/dist/replicate-VICFSQ5A.js +347 -0
  79. package/dist/resend-3E76WK3O.js +100 -0
  80. package/dist/rootly-36GY46BY.js +345 -0
  81. package/dist/scrapfly-VDVUYAHX.js +289 -0
  82. package/dist/scrapingbee-3KTPMAVY.js +247 -0
  83. package/dist/screenshot_fyi-LKG62C3J.js +116 -0
  84. package/dist/semantic_scholar-4WREECYO.js +626 -0
  85. package/dist/sentry-HUQTGXOV.js +1139 -0
  86. package/dist/shodan-SGRKU4KS.js +303 -0
  87. package/dist/shopify-YCZ4L5HT.js +620 -0
  88. package/dist/stripe-OEBKMELB.js +583 -0
  89. package/dist/supabase-I3DBY7L4.js +937 -0
  90. package/dist/tavily-B2YHCNRD.js +349 -0
  91. package/dist/telegram-2VYJELZX.js +1773 -0
  92. package/dist/telnyx-HHXD3CXL.js +237 -0
  93. package/dist/todoist-PHFDEEIS.js +672 -0
  94. package/dist/trello-WUSAK6YN.js +1091 -0
  95. package/dist/turso-FW56U2B3.js +432 -0
  96. package/dist/twilio-M5JI7XHA.js +321 -0
  97. package/dist/umami-HAYODRC4.js +411 -0
  98. package/dist/unsplash-EDPTNEHJ.js +364 -0
  99. package/dist/upstash_redis-GC2CLIWD.js +299 -0
  100. package/dist/uptimerobot-XMSNYLIT.js +481 -0
  101. package/dist/v2ex-KU4ECD65.js +672 -0
  102. package/dist/vercel-THPCEFHW.js +1096 -0
  103. package/dist/wolfram_alpha_api-WHHTH4GU.js +212 -0
  104. package/dist/wordpress-O6TQEQNF.js +822 -0
  105. package/dist/workos-A3VHHWI3.js +681 -0
  106. package/dist/zhihu-BJAI64YJ.js +273 -0
  107. package/package.json +5 -4
@@ -0,0 +1,937 @@
1
+ import {
2
+ createProviderPlugin,
3
+ guardedFetch,
4
+ requireApiKey,
5
+ upstreamError
6
+ } from "./chunk-CSJEZHQO.js";
7
+ import "./chunk-K7FVSFUX.js";
8
+ import {
9
+ TBError,
10
+ external_exports
11
+ } from "./chunk-JLTYA2B3.js";
12
+ import "./chunk-MLKGABMK.js";
13
+
14
+ // ../plugins/src/supabase/api.ts
15
+ var SERVICE = "supabase";
16
+ var API_BASE = "https://api.supabase.com/v1";
17
+ var PROJECT_STATUSES = /* @__PURE__ */ new Set([
18
+ "ACTIVE_HEALTHY",
19
+ "ACTIVE_UNHEALTHY",
20
+ "COMING_UP",
21
+ "GOING_DOWN",
22
+ "INACTIVE",
23
+ "INIT_FAILED",
24
+ "REMOVED",
25
+ "RESTARTING",
26
+ "UNKNOWN",
27
+ "UPGRADING",
28
+ "PAUSING",
29
+ "RESTORING",
30
+ "RESTORE_FAILED",
31
+ "PAUSE_FAILED",
32
+ "RESIZING"
33
+ ]);
34
+ var API_KEY_TYPES = /* @__PURE__ */ new Set(["legacy", "publishable", "secret", "unknown"]);
35
+ function text(value) {
36
+ if (typeof value !== "string") return void 0;
37
+ const trimmed = value.trim();
38
+ return trimmed === "" ? void 0 : trimmed;
39
+ }
40
+ function nullableText(value) {
41
+ return value === null ? null : text(value);
42
+ }
43
+ function record(value) {
44
+ return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
45
+ }
46
+ function compact(input) {
47
+ return Object.fromEntries(Object.entries(input).filter(([, value]) => value !== void 0));
48
+ }
49
+ function inputError(message) {
50
+ return new TBError("invalid_argument", message);
51
+ }
52
+ function malformed(message) {
53
+ return new TBError("unavailable", `malformed supabase response: ${message}`, { retryable: true });
54
+ }
55
+ function requireInputText(value, field) {
56
+ const result = text(value);
57
+ if (result === void 0) throw inputError(`${field} is required.`);
58
+ return result;
59
+ }
60
+ function requireRecord(value, label) {
61
+ const result = record(value);
62
+ if (result === void 0) throw malformed(`missing ${label}`);
63
+ return result;
64
+ }
65
+ function requireArray(value, label) {
66
+ if (!Array.isArray(value)) throw malformed(`malformed supabase ${label} response`);
67
+ return value;
68
+ }
69
+ function requireField(value, field) {
70
+ const result = text(value);
71
+ if (result === void 0) throw malformed(`missing ${field}`);
72
+ return result;
73
+ }
74
+ function requireBoolean(value, field) {
75
+ if (typeof value !== "boolean") throw malformed(`missing ${field}`);
76
+ return value;
77
+ }
78
+ function requireNumber(value, field) {
79
+ const parsed = typeof value === "number" ? value : Number(value);
80
+ if (!Number.isFinite(parsed)) throw malformed(`missing ${field}`);
81
+ return parsed;
82
+ }
83
+ function errorMessage(status, payload) {
84
+ const detail = record(payload);
85
+ if (detail === void 0) return `supabase request failed with ${status}`;
86
+ const code = text(detail.code) ?? text(detail.error);
87
+ if (code === "invalid_grant") return "supabase grant is invalid or expired";
88
+ return text(detail.message) ?? text(detail.msg) ?? text(detail.error_description) ?? `supabase request failed with ${status}`;
89
+ }
90
+ async function request(ctx, input) {
91
+ const url = new URL(`${API_BASE}${input.path}`);
92
+ for (const [key, value] of Object.entries(input.query ?? {})) {
93
+ if (value === void 0) continue;
94
+ if (Array.isArray(value)) {
95
+ for (const item of value) url.searchParams.append(key, item);
96
+ continue;
97
+ }
98
+ url.searchParams.set(key, String(value));
99
+ }
100
+ const hasBody = input.body !== void 0;
101
+ const response = await guardedFetch(url.toString(), {
102
+ method: input.method ?? "GET",
103
+ headers: {
104
+ accept: "application/json",
105
+ authorization: `Bearer ${requireApiKey(ctx, SERVICE)}`,
106
+ ...hasBody ? { "content-type": "application/json" } : {}
107
+ },
108
+ body: hasBody ? JSON.stringify(input.body) : void 0
109
+ });
110
+ const raw = await response.text();
111
+ let payload;
112
+ if (raw.trim() === "") {
113
+ payload = null;
114
+ } else {
115
+ try {
116
+ payload = JSON.parse(raw);
117
+ } catch {
118
+ if (response.ok) throw malformed("malformed supabase json response");
119
+ payload = { message: raw };
120
+ }
121
+ }
122
+ if (!response.ok) throw upstreamError(response.status, errorMessage(response.status, payload));
123
+ if (payload === null && input.allowEmpty !== true) throw malformed("empty body");
124
+ return payload;
125
+ }
126
+ function normalizeProjectStatus(value) {
127
+ if (value === void 0) return void 0;
128
+ return PROJECT_STATUSES.has(value) ? value : "UNKNOWN";
129
+ }
130
+ function normalizeApiKeyType(value) {
131
+ return API_KEY_TYPES.has(value) ? value : "unknown";
132
+ }
133
+ function normalizeOrganization(payload) {
134
+ const item = requireRecord(payload, "organization");
135
+ return {
136
+ id: requireField(item.id, "organization.id"),
137
+ name: requireField(item.name, "organization.name"),
138
+ slug: nullableText(item.slug)
139
+ };
140
+ }
141
+ function normalizeOrganizationDetail(payload) {
142
+ const item = requireRecord(payload, "organization");
143
+ return compact({
144
+ ...item,
145
+ id: requireField(item.id, "organization.id"),
146
+ name: requireField(item.name, "organization.name"),
147
+ plan: text(item.plan)
148
+ });
149
+ }
150
+ function normalizeOrganizationMember(payload) {
151
+ const item = requireRecord(payload, "member");
152
+ return compact({
153
+ ...item,
154
+ userId: requireField(item.user_id, "member.user_id"),
155
+ userName: requireField(item.user_name, "member.user_name"),
156
+ email: text(item.email),
157
+ roleName: requireField(item.role_name, "member.role_name"),
158
+ mfaEnabled: requireBoolean(item.mfa_enabled, "member.mfa_enabled")
159
+ });
160
+ }
161
+ function normalizeOrganizationProject(payload) {
162
+ const item = requireRecord(payload, "organization project");
163
+ return compact({
164
+ ...item,
165
+ ref: requireField(item.ref, "organizationProject.ref"),
166
+ name: requireField(item.name, "organizationProject.name"),
167
+ cloudProvider: text(item.cloud_provider),
168
+ region: requireField(item.region, "organizationProject.region"),
169
+ isBranch: typeof item.is_branch === "boolean" ? item.is_branch : void 0,
170
+ status: normalizeProjectStatus(requireField(item.status, "organizationProject.status")) ?? "UNKNOWN",
171
+ insertedAt: text(item.inserted_at),
172
+ databases: Array.isArray(item.databases) ? item.databases.map((entry) => requireRecord(entry, "database")) : void 0
173
+ });
174
+ }
175
+ function normalizePagination(payload) {
176
+ const item = requireRecord(payload, "pagination");
177
+ return {
178
+ count: requireNumber(item.count, "pagination.count"),
179
+ limit: requireNumber(item.limit, "pagination.limit"),
180
+ offset: requireNumber(item.offset, "pagination.offset")
181
+ };
182
+ }
183
+ function normalizeProjectDatabaseSummary(payload) {
184
+ if (payload === void 0 || payload === null) return void 0;
185
+ const item = requireRecord(payload, "project.database");
186
+ return compact({
187
+ host: text(item.host),
188
+ version: text(item.version),
189
+ postgresEngine: nullableText(item.postgres_engine),
190
+ releaseChannel: nullableText(item.release_channel)
191
+ });
192
+ }
193
+ function normalizeProjectDatabaseDetail(payload) {
194
+ const item = requireRecord(payload, "project.database");
195
+ return {
196
+ host: requireField(item.host, "project.database.host"),
197
+ version: requireField(item.version, "project.database.version"),
198
+ postgresEngine: nullableText(item.postgres_engine),
199
+ releaseChannel: nullableText(item.release_channel)
200
+ };
201
+ }
202
+ function normalizeProjectSummary(payload) {
203
+ const item = requireRecord(payload, "project");
204
+ return {
205
+ id: requireField(item.id, "project.id"),
206
+ organizationId: requireField(item.organization_id, "project.organization_id"),
207
+ name: requireField(item.name, "project.name"),
208
+ region: requireField(item.region, "project.region"),
209
+ status: normalizeProjectStatus(text(item.status)),
210
+ createdAt: requireField(item.created_at, "project.created_at"),
211
+ database: normalizeProjectDatabaseSummary(item.database)
212
+ };
213
+ }
214
+ function normalizeProjectDetail(payload) {
215
+ const item = requireRecord(payload, "project");
216
+ return {
217
+ id: requireField(item.id, "project.id"),
218
+ ref: requireField(item.ref, "project.ref"),
219
+ organizationId: requireField(item.organization_id, "project.organization_id"),
220
+ organizationSlug: requireField(item.organization_slug, "project.organization_slug"),
221
+ name: requireField(item.name, "project.name"),
222
+ region: requireField(item.region, "project.region"),
223
+ status: normalizeProjectStatus(requireField(item.status, "project.status")) ?? "UNKNOWN",
224
+ createdAt: requireField(item.created_at, "project.created_at"),
225
+ database: normalizeProjectDatabaseDetail(item.database)
226
+ };
227
+ }
228
+ function normalizeApiKey(payload) {
229
+ const item = requireRecord(payload, "api key");
230
+ return compact({
231
+ id: requireField(item.id, "apiKey.id"),
232
+ name: requireField(item.name, "apiKey.name"),
233
+ type: normalizeApiKeyType(requireField(item.type, "apiKey.type")),
234
+ prefix: requireField(item.prefix, "apiKey.prefix"),
235
+ hash: requireField(item.hash, "apiKey.hash"),
236
+ description: nullableText(item.description),
237
+ apiKey: text(item.api_key),
238
+ insertedAt: text(item.inserted_at),
239
+ updatedAt: text(item.updated_at),
240
+ secretJwtTemplate: item.secret_jwt_template === null ? null : record(item.secret_jwt_template)
241
+ });
242
+ }
243
+ function normalizeApiKeyList(payload) {
244
+ if (Array.isArray(payload)) return payload.map((item2) => normalizeApiKey(item2));
245
+ const item = requireRecord(payload, "api keys");
246
+ if (!Array.isArray(item.details)) throw malformed("malformed supabase api key list response");
247
+ return item.details.map((entry) => normalizeApiKey(entry));
248
+ }
249
+ function normalizeSecret(payload) {
250
+ const item = requireRecord(payload, "secret");
251
+ return compact({
252
+ name: requireField(item.name, "secret.name"),
253
+ value: text(item.value),
254
+ updatedAt: text(item.updated_at)
255
+ });
256
+ }
257
+ function normalizeHealthService(payload) {
258
+ const item = requireRecord(payload, "health");
259
+ return compact({
260
+ ...item,
261
+ name: requireField(item.name, "health.name"),
262
+ healthy: requireBoolean(item.healthy, "health.healthy"),
263
+ status: requireField(item.status, "health.status"),
264
+ error: text(item.error),
265
+ info: item.info === null ? null : record(item.info)
266
+ });
267
+ }
268
+ function normalizeRecordList(payload, label) {
269
+ return requireArray(payload, label).map((entry) => requireRecord(entry, label));
270
+ }
271
+ function secretInputList(payload) {
272
+ if (!Array.isArray(payload)) throw inputError("supabase secrets input must be an array");
273
+ return payload.map((entry) => {
274
+ const item = record(entry);
275
+ if (item === void 0) throw inputError("secret is required.");
276
+ return {
277
+ name: requireInputText(item.name, "secret.name"),
278
+ value: requireInputText(item.value, "secret.value")
279
+ };
280
+ });
281
+ }
282
+ function revealFlag(value) {
283
+ return value === true ? true : void 0;
284
+ }
285
+ async function listOrganizations(_input, ctx) {
286
+ const payload = await request(ctx, { path: "/organizations" });
287
+ return {
288
+ organizations: requireArray(payload, "organizations").map((item) => normalizeOrganization(item))
289
+ };
290
+ }
291
+ async function getOrganization(input, ctx) {
292
+ const slug = requireInputText(input.organizationSlug, "organizationSlug");
293
+ const payload = await request(ctx, { path: `/organizations/${encodeURIComponent(slug)}` });
294
+ return { organization: normalizeOrganizationDetail(payload) };
295
+ }
296
+ async function listOrganizationMembers(input, ctx) {
297
+ const slug = requireInputText(input.organizationSlug, "organizationSlug");
298
+ const payload = await request(ctx, { path: `/organizations/${encodeURIComponent(slug)}/members` });
299
+ return {
300
+ members: requireArray(payload, "organization members").map((item) => normalizeOrganizationMember(item))
301
+ };
302
+ }
303
+ async function listOrganizationProjects(input, ctx) {
304
+ const slug = requireInputText(input.organizationSlug, "organizationSlug");
305
+ const payload = await request(ctx, {
306
+ path: `/organizations/${encodeURIComponent(slug)}/projects`,
307
+ query: {
308
+ offset: input.offset,
309
+ limit: input.limit,
310
+ search: text(input.search),
311
+ sort: text(input.sort),
312
+ // statuses 是**逗号串**(不像 services 那样重复同名参数)。
313
+ statuses: input.statuses === void 0 ? void 0 : input.statuses.join(",")
314
+ }
315
+ });
316
+ const body = requireRecord(payload, "organization projects");
317
+ return {
318
+ projects: requireArray(body.projects, "organization projects").map((entry) => normalizeOrganizationProject(entry)),
319
+ pagination: normalizePagination(body.pagination)
320
+ };
321
+ }
322
+ async function listProjects(_input, ctx) {
323
+ const payload = await request(ctx, { path: "/projects" });
324
+ return { projects: requireArray(payload, "projects").map((item) => normalizeProjectSummary(item)) };
325
+ }
326
+ async function getProject(input, ctx) {
327
+ const ref = requireInputText(input.projectRef, "projectRef");
328
+ return { project: normalizeProjectDetail(await request(ctx, { path: `/projects/${encodeURIComponent(ref)}` })) };
329
+ }
330
+ async function listAvailableRegions(input, ctx) {
331
+ const payload = await request(ctx, {
332
+ path: "/projects/available-regions",
333
+ query: {
334
+ organization_slug: text(input.organizationSlug),
335
+ continent: text(input.continent),
336
+ desired_instance_size: text(input.desiredInstanceSize)
337
+ }
338
+ });
339
+ return { regions: requireRecord(payload, "regions") };
340
+ }
341
+ async function getProjectHealth(input, ctx) {
342
+ const ref = requireInputText(input.projectRef, "projectRef");
343
+ const payload = await request(ctx, {
344
+ path: `/projects/${encodeURIComponent(ref)}/health`,
345
+ query: {
346
+ // services 是**重复的同名参数**,不是逗号串。
347
+ services: input.services,
348
+ timeout_ms: input.timeoutMs
349
+ }
350
+ });
351
+ return {
352
+ services: requireArray(payload, "project health").map((item) => normalizeHealthService(item))
353
+ };
354
+ }
355
+ async function listProjectApiKeys(input, ctx) {
356
+ const ref = requireInputText(input.projectRef, "projectRef");
357
+ const payload = await request(ctx, {
358
+ path: `/projects/${encodeURIComponent(ref)}/api-keys`,
359
+ query: { reveal: revealFlag(input.reveal) }
360
+ });
361
+ return { apiKeys: normalizeApiKeyList(payload) };
362
+ }
363
+ async function getProjectApiKey(input, ctx) {
364
+ const ref = requireInputText(input.projectRef, "projectRef");
365
+ const apiKeyId = requireInputText(input.apiKeyId, "apiKeyId");
366
+ const payload = await request(ctx, {
367
+ path: `/projects/${encodeURIComponent(ref)}/api-keys/${encodeURIComponent(apiKeyId)}`,
368
+ query: { reveal: revealFlag(input.reveal) }
369
+ });
370
+ return { apiKey: normalizeApiKey(payload) };
371
+ }
372
+ async function createProjectApiKey(input, ctx) {
373
+ const ref = requireInputText(input.projectRef, "projectRef");
374
+ const type = text(input.type);
375
+ if (input.secretJwtTemplate !== void 0 && type !== "secret") {
376
+ throw inputError("secretJwtTemplate is only supported for secret API keys");
377
+ }
378
+ const payload = await request(ctx, {
379
+ method: "POST",
380
+ path: `/projects/${encodeURIComponent(ref)}/api-keys`,
381
+ query: { reveal: revealFlag(input.reveal) },
382
+ body: compact({
383
+ name: text(input.name),
384
+ type,
385
+ // description 不去空白:上游用 optionalRawString 原样发(空串是合法的"没有描述")。
386
+ description: typeof input.description === "string" ? input.description : void 0,
387
+ secret_jwt_template: record(input.secretJwtTemplate)
388
+ })
389
+ });
390
+ return { apiKey: normalizeApiKey(payload) };
391
+ }
392
+ async function updateProjectApiKey(input, ctx) {
393
+ const ref = requireInputText(input.projectRef, "projectRef");
394
+ const apiKeyId = requireInputText(input.apiKeyId, "apiKeyId");
395
+ if (input.name === void 0 && input.description === void 0 && input.secretJwtTemplate === void 0) {
396
+ throw inputError("Provide at least one field to update: name, description, or secretJwtTemplate.");
397
+ }
398
+ const payload = await request(ctx, {
399
+ method: "PATCH",
400
+ path: `/projects/${encodeURIComponent(ref)}/api-keys/${encodeURIComponent(apiKeyId)}`,
401
+ query: { reveal: revealFlag(input.reveal) },
402
+ // description 与 secret_jwt_template 是三态字段:未给不改、null 清空、有值改成它。
403
+ body: compact({
404
+ name: text(input.name),
405
+ description: typeof input.description === "string" || input.description === null ? input.description : void 0,
406
+ secret_jwt_template: input.secretJwtTemplate === null ? null : record(input.secretJwtTemplate)
407
+ })
408
+ });
409
+ return { apiKey: normalizeApiKey(payload) };
410
+ }
411
+ async function deleteProjectApiKey(input, ctx) {
412
+ const ref = requireInputText(input.projectRef, "projectRef");
413
+ const apiKeyId = requireInputText(input.apiKeyId, "apiKeyId");
414
+ const payload = await request(ctx, {
415
+ method: "DELETE",
416
+ path: `/projects/${encodeURIComponent(ref)}/api-keys/${encodeURIComponent(apiKeyId)}`,
417
+ query: {
418
+ reveal: revealFlag(input.reveal),
419
+ was_compromised: input.wasCompromised,
420
+ reason: text(input.reason)
421
+ }
422
+ });
423
+ return { apiKey: normalizeApiKey(payload) };
424
+ }
425
+ async function listProjectSecrets(input, ctx) {
426
+ const ref = requireInputText(input.projectRef, "projectRef");
427
+ const payload = await request(ctx, { path: `/projects/${encodeURIComponent(ref)}/secrets` });
428
+ return { secrets: requireArray(payload, "secrets").map((item) => normalizeSecret(item)) };
429
+ }
430
+ async function upsertProjectSecrets(input, ctx) {
431
+ const ref = requireInputText(input.projectRef, "projectRef");
432
+ await request(ctx, {
433
+ method: "POST",
434
+ path: `/projects/${encodeURIComponent(ref)}/secrets`,
435
+ // 请求体是**数组**(不是对象信封),且上游对这个端点允许空响应体。
436
+ body: secretInputList(input.secrets),
437
+ allowEmpty: true
438
+ });
439
+ return { success: true };
440
+ }
441
+ async function deleteProjectSecrets(input, ctx) {
442
+ const ref = requireInputText(input.projectRef, "projectRef");
443
+ if (!Array.isArray(input.names)) throw inputError("names must be an array");
444
+ await request(ctx, {
445
+ method: "DELETE",
446
+ path: `/projects/${encodeURIComponent(ref)}/secrets`,
447
+ // DELETE **带请求体**:要删的名字表是一个 JSON 数组。
448
+ body: input.names.map((name) => String(name)),
449
+ allowEmpty: true
450
+ });
451
+ return { success: true };
452
+ }
453
+ async function generateTypescriptTypes(input, ctx) {
454
+ const ref = requireInputText(input.projectRef, "projectRef");
455
+ const payload = await request(ctx, {
456
+ path: `/projects/${encodeURIComponent(ref)}/types/typescript`,
457
+ // included_schemas 是**逗号串**。
458
+ query: {
459
+ included_schemas: input.includedSchemas === void 0 ? void 0 : input.includedSchemas.join(",")
460
+ }
461
+ });
462
+ return {
463
+ typescript: requireField(requireRecord(payload, "typescript").types, "typescript.types")
464
+ };
465
+ }
466
+ async function runReadOnlyQuery(input, ctx) {
467
+ const ref = requireInputText(input.projectRef, "projectRef");
468
+ const result = await request(ctx, {
469
+ method: "POST",
470
+ path: `/projects/${encodeURIComponent(ref)}/database/query/read-only`,
471
+ body: compact({
472
+ // SQL 不去空白:缩进与换行是语义的一部分(上游 optionalRawString)。
473
+ query: typeof input.query === "string" ? input.query : void 0,
474
+ parameters: Array.isArray(input.parameters) ? input.parameters : void 0
475
+ }),
476
+ allowEmpty: true
477
+ });
478
+ return { result: result ?? null };
479
+ }
480
+ async function listStorageBuckets(input, ctx) {
481
+ const ref = requireInputText(input.projectRef, "projectRef");
482
+ const payload = await request(ctx, { path: `/projects/${encodeURIComponent(ref)}/storage/buckets` });
483
+ return { buckets: normalizeRecordList(payload, "storage buckets") };
484
+ }
485
+ async function listEdgeFunctions(input, ctx) {
486
+ const ref = requireInputText(input.projectRef, "projectRef");
487
+ const payload = await request(ctx, { path: `/projects/${encodeURIComponent(ref)}/functions` });
488
+ return { functions: normalizeRecordList(payload, "edge functions") };
489
+ }
490
+ async function getEdgeFunction(input, ctx) {
491
+ const ref = requireInputText(input.projectRef, "projectRef");
492
+ const slug = requireInputText(input.functionSlug, "functionSlug");
493
+ const payload = await request(ctx, {
494
+ path: `/projects/${encodeURIComponent(ref)}/functions/${encodeURIComponent(slug)}`
495
+ });
496
+ return { function: requireRecord(payload, "edge function") };
497
+ }
498
+
499
+ // ../plugins/src/supabase/schema.ts
500
+ var listOrganizationsInput = external_exports.strictObject({}).describe("No input parameters are required for this action.");
501
+ var listOrganizationsOutput = external_exports.strictObject({
502
+ organizations: external_exports.array(external_exports.strictObject({
503
+ id: external_exports.string().describe("The unique identifier of the organization."),
504
+ name: external_exports.string().describe("The name of the organization."),
505
+ slug: external_exports.string().describe("The URL slug of the organization.").nullable().optional()
506
+ }).describe("A Supabase organization summary.")).describe("The list of organizations.")
507
+ }).describe("Action output.");
508
+ var getOrganizationInput = external_exports.strictObject({
509
+ organizationSlug: external_exports.string().min(1).describe("The Supabase organization slug.")
510
+ }).describe("Input parameters for fetching an organization.");
511
+ var getOrganizationOutput = external_exports.strictObject({
512
+ organization: external_exports.looseObject({
513
+ id: external_exports.string().describe("The unique identifier of the organization."),
514
+ name: external_exports.string().describe("The name of the organization."),
515
+ plan: external_exports.string().describe("The subscription plan of the organization.")
516
+ }).describe("The Supabase organization detail payload.")
517
+ }).describe("Action output.");
518
+ var listOrganizationMembersInput = external_exports.strictObject({
519
+ organizationSlug: external_exports.string().min(1).describe("The Supabase organization slug.")
520
+ }).describe("Input parameters for listing organization members.");
521
+ var listOrganizationMembersOutput = external_exports.strictObject({
522
+ members: external_exports.array(external_exports.looseObject({
523
+ userId: external_exports.string().describe("The unique identifier of the member."),
524
+ userName: external_exports.string().describe("The display name of the member."),
525
+ email: external_exports.string().describe("The email address of the member."),
526
+ roleName: external_exports.string().describe("The organization role name of the member."),
527
+ mfaEnabled: external_exports.boolean().describe("Whether the member has MFA enabled.")
528
+ }).describe("A Supabase organization member.")).describe("The organization members.")
529
+ }).describe("Action output.");
530
+ var listOrganizationProjectsInput = external_exports.strictObject({
531
+ organizationSlug: external_exports.string().min(1).describe("The Supabase organization slug."),
532
+ offset: external_exports.int().min(0).describe("The number of projects to skip.").optional(),
533
+ limit: external_exports.int().min(1).max(100).describe("The maximum number of projects to return, up to 100.").optional(),
534
+ search: external_exports.string().min(1).describe("Search projects by name.").optional(),
535
+ sort: external_exports.enum(["name_asc", "name_desc", "created_asc", "created_desc"]).describe("The sort order for projects.").optional(),
536
+ statuses: external_exports.array(external_exports.enum(["ACTIVE_HEALTHY", "ACTIVE_UNHEALTHY", "COMING_UP", "GOING_DOWN", "INACTIVE", "INIT_FAILED", "REMOVED", "RESTARTING", "UNKNOWN", "UPGRADING", "PAUSING", "RESTORING", "RESTORE_FAILED", "PAUSE_FAILED", "RESIZING"]).describe("The current status of the Supabase project.")).min(1).describe("Project statuses to include.").optional()
537
+ }).describe("Input parameters for listing organization projects.");
538
+ var listOrganizationProjectsOutput = external_exports.strictObject({
539
+ projects: external_exports.array(external_exports.looseObject({
540
+ ref: external_exports.string().describe("The project reference identifier."),
541
+ name: external_exports.string().describe("The project name."),
542
+ region: external_exports.string().describe("The project region."),
543
+ status: external_exports.enum(["ACTIVE_HEALTHY", "ACTIVE_UNHEALTHY", "COMING_UP", "GOING_DOWN", "INACTIVE", "INIT_FAILED", "REMOVED", "RESTARTING", "UNKNOWN", "UPGRADING", "PAUSING", "RESTORING", "RESTORE_FAILED", "PAUSE_FAILED", "RESIZING"]).describe("The current status of the Supabase project.")
544
+ }).describe("A project returned from an organization listing.")).describe("The projects in the organization."),
545
+ pagination: external_exports.strictObject({
546
+ count: external_exports.number().describe("The total number of matching records."),
547
+ limit: external_exports.number().describe("The maximum number of records returned."),
548
+ offset: external_exports.number().describe("The number of records skipped.")
549
+ }).describe("Pagination metadata returned by Supabase.")
550
+ }).describe("Action output.");
551
+ var listProjectsInput = external_exports.strictObject({}).describe("No input parameters are required for this action.");
552
+ var listProjectsOutput = external_exports.strictObject({
553
+ projects: external_exports.array(external_exports.strictObject({
554
+ id: external_exports.string().describe("The unique identifier of the project."),
555
+ organizationId: external_exports.string().describe("The organization ID this project belongs to."),
556
+ name: external_exports.string().describe("The name of the project."),
557
+ region: external_exports.string().describe("The cloud region of the project."),
558
+ status: external_exports.enum(["ACTIVE_HEALTHY", "ACTIVE_UNHEALTHY", "COMING_UP", "GOING_DOWN", "INACTIVE", "INIT_FAILED", "REMOVED", "RESTARTING", "UNKNOWN", "UPGRADING", "PAUSING", "RESTORING", "RESTORE_FAILED", "PAUSE_FAILED", "RESIZING"]).describe("The current status of the Supabase project.").optional(),
559
+ createdAt: external_exports.string().describe("The timestamp when the project was created."),
560
+ database: external_exports.strictObject({
561
+ host: external_exports.string().describe("The database host address."),
562
+ version: external_exports.string().describe("The database version."),
563
+ postgresEngine: external_exports.string().describe("The Postgres engine identifier.").nullable().optional(),
564
+ releaseChannel: external_exports.string().describe("The release channel of the database.").nullable().optional()
565
+ }).describe("A Supabase project database configuration.").optional()
566
+ }).describe("A Supabase project summary.")).describe("The list of projects.")
567
+ }).describe("Action output.");
568
+ var getProjectInput = external_exports.strictObject({
569
+ projectRef: external_exports.string().min(1).max(64).describe("The Supabase project reference, for example 'abcdefghijklmnopqrst'.")
570
+ }).describe("Input parameters identifying a Supabase project.");
571
+ var getProjectOutput = external_exports.strictObject({
572
+ project: external_exports.strictObject({
573
+ id: external_exports.string().describe("The unique identifier of the project."),
574
+ ref: external_exports.string().describe("The project reference identifier."),
575
+ organizationId: external_exports.string().describe("The organization ID this project belongs to."),
576
+ organizationSlug: external_exports.string().describe("The organization slug."),
577
+ name: external_exports.string().describe("The name of the project."),
578
+ region: external_exports.string().describe("The cloud region of the project."),
579
+ status: external_exports.enum(["ACTIVE_HEALTHY", "ACTIVE_UNHEALTHY", "COMING_UP", "GOING_DOWN", "INACTIVE", "INIT_FAILED", "REMOVED", "RESTARTING", "UNKNOWN", "UPGRADING", "PAUSING", "RESTORING", "RESTORE_FAILED", "PAUSE_FAILED", "RESIZING"]).describe("The current status of the Supabase project."),
580
+ createdAt: external_exports.string().describe("The timestamp when the project was created."),
581
+ database: external_exports.strictObject({
582
+ host: external_exports.string().describe("The database host address."),
583
+ version: external_exports.string().describe("The database version."),
584
+ postgresEngine: external_exports.string().describe("The Postgres engine identifier.").nullable().optional(),
585
+ releaseChannel: external_exports.string().describe("The release channel of the database.").nullable().optional()
586
+ }).describe("A Supabase project database configuration.")
587
+ }).describe("A Supabase project detail record.")
588
+ }).describe("Action output.");
589
+ var listAvailableRegionsInput = external_exports.strictObject({
590
+ organizationSlug: external_exports.string().min(1).describe("The Supabase organization slug."),
591
+ continent: external_exports.enum(["NA", "SA", "EU", "AF", "AS", "OC", "AN"]).describe("Optional continent code for regional recommendations.").optional(),
592
+ desiredInstanceSize: external_exports.string().min(1).describe("Optional desired instance size for availability.").optional()
593
+ }).describe("Input parameters for listing available project regions.");
594
+ var listAvailableRegionsOutput = external_exports.strictObject({
595
+ regions: external_exports.looseObject({}).describe("A JSON object returned by Supabase.")
596
+ }).describe("Action output.");
597
+ var getProjectHealthInput = external_exports.strictObject({
598
+ projectRef: external_exports.string().min(1).max(64).describe("The Supabase project reference, for example 'abcdefghijklmnopqrst'."),
599
+ services: external_exports.array(external_exports.enum(["auth", "db", "db_postgres_user", "pooler", "realtime", "rest", "storage", "pg_bouncer"]).describe("A Supabase service name to check health for.")).min(1).describe("The services to check."),
600
+ timeoutMs: external_exports.int().min(0).max(1e4).describe("Optional timeout in milliseconds, up to 10000.").optional()
601
+ }).describe("Input parameters for checking project service health.");
602
+ var getProjectHealthOutput = external_exports.strictObject({
603
+ services: external_exports.array(external_exports.looseObject({
604
+ name: external_exports.enum(["auth", "db", "db_postgres_user", "pooler", "realtime", "rest", "storage", "pg_bouncer"]).describe("A Supabase service name to check health for."),
605
+ healthy: external_exports.boolean().describe("Deprecated upstream health flag. Prefer status when present."),
606
+ status: external_exports.string().describe("The service health status."),
607
+ error: external_exports.string().describe("The service health error message when present.")
608
+ }).describe("A Supabase service health result.")).describe("The health results returned by Supabase.")
609
+ }).describe("Action output.");
610
+ var listProjectApiKeysInput = external_exports.strictObject({
611
+ projectRef: external_exports.string().min(1).max(64).describe("The Supabase project reference, for example 'abcdefghijklmnopqrst'."),
612
+ reveal: external_exports.boolean().describe("Whether to reveal the full API key values.").optional()
613
+ }).describe("Input parameters for listing project API keys.");
614
+ var listProjectApiKeysOutput = external_exports.strictObject({
615
+ apiKeys: external_exports.array(external_exports.strictObject({
616
+ id: external_exports.string().describe("The unique identifier of the API key."),
617
+ name: external_exports.string().describe("The name of the API key."),
618
+ type: external_exports.enum(["legacy", "publishable", "secret", "unknown"]).describe("The type of the API key."),
619
+ prefix: external_exports.string().describe("The prefix portion of the API key."),
620
+ hash: external_exports.string().describe("The hash of the API key."),
621
+ description: external_exports.string().describe("The description of the API key.").nullable().optional(),
622
+ apiKey: external_exports.string().describe("The full API key value when reveal is true and Supabase returns it.").optional(),
623
+ insertedAt: external_exports.string().describe("The timestamp when the API key was created.").optional(),
624
+ updatedAt: external_exports.string().describe("The timestamp when the API key was last updated.").optional(),
625
+ secretJwtTemplate: external_exports.looseObject({}).describe("The JWT template for secret API keys.").nullable().optional()
626
+ }).describe("A Supabase API key record.")).describe("The list of API keys.")
627
+ }).describe("Action output.");
628
+ var getProjectApiKeyInput = external_exports.strictObject({
629
+ projectRef: external_exports.string().min(1).max(64).describe("The Supabase project reference, for example 'abcdefghijklmnopqrst'."),
630
+ apiKeyId: external_exports.string().min(1).describe("The unique identifier of the project API key."),
631
+ reveal: external_exports.boolean().describe("Whether to reveal the full API key value.").optional()
632
+ }).describe("Input parameters for fetching one project API key.");
633
+ var getProjectApiKeyOutput = external_exports.strictObject({
634
+ apiKey: external_exports.strictObject({
635
+ id: external_exports.string().describe("The unique identifier of the API key."),
636
+ name: external_exports.string().describe("The name of the API key."),
637
+ type: external_exports.enum(["legacy", "publishable", "secret", "unknown"]).describe("The type of the API key."),
638
+ prefix: external_exports.string().describe("The prefix portion of the API key."),
639
+ hash: external_exports.string().describe("The hash of the API key."),
640
+ description: external_exports.string().describe("The description of the API key.").nullable().optional(),
641
+ apiKey: external_exports.string().describe("The full API key value when reveal is true and Supabase returns it.").optional(),
642
+ insertedAt: external_exports.string().describe("The timestamp when the API key was created.").optional(),
643
+ updatedAt: external_exports.string().describe("The timestamp when the API key was last updated.").optional(),
644
+ secretJwtTemplate: external_exports.looseObject({}).describe("The JWT template for secret API keys.").nullable().optional()
645
+ }).describe("A Supabase API key record.")
646
+ }).describe("Action output.");
647
+ var createProjectApiKeyInput = external_exports.strictObject({
648
+ projectRef: external_exports.string().min(1).max(64).describe("The Supabase project reference, for example 'abcdefghijklmnopqrst'."),
649
+ name: external_exports.string().min(4).max(64).regex(new RegExp("^[a-z_][a-z0-9_]+$")).describe("The API key name. Use lowercase letters, numbers, and underscores; it must start with a lowercase letter or underscore."),
650
+ type: external_exports.enum(["publishable", "secret"]).describe("The type of API key to create."),
651
+ description: external_exports.string().min(1).describe("The optional description for the API key.").optional(),
652
+ reveal: external_exports.boolean().describe("Whether to reveal the full API key value in the response.").optional(),
653
+ secretJwtTemplate: external_exports.looseObject({}).describe("The JWT template for secret API keys.").optional()
654
+ }).describe("Input parameters for creating a project API key.");
655
+ var createProjectApiKeyOutput = external_exports.strictObject({
656
+ apiKey: external_exports.strictObject({
657
+ id: external_exports.string().describe("The unique identifier of the API key."),
658
+ name: external_exports.string().describe("The name of the API key."),
659
+ type: external_exports.enum(["legacy", "publishable", "secret", "unknown"]).describe("The type of the API key."),
660
+ prefix: external_exports.string().describe("The prefix portion of the API key."),
661
+ hash: external_exports.string().describe("The hash of the API key."),
662
+ description: external_exports.string().describe("The description of the API key.").nullable().optional(),
663
+ apiKey: external_exports.string().describe("The full API key value when reveal is true and Supabase returns it.").optional(),
664
+ insertedAt: external_exports.string().describe("The timestamp when the API key was created.").optional(),
665
+ updatedAt: external_exports.string().describe("The timestamp when the API key was last updated.").optional(),
666
+ secretJwtTemplate: external_exports.looseObject({}).describe("The JWT template for secret API keys.").nullable().optional()
667
+ }).describe("A Supabase API key record.")
668
+ }).describe("Action output.");
669
+ var updateProjectApiKeyInput = external_exports.strictObject({
670
+ projectRef: external_exports.string().min(1).max(64).describe("The Supabase project reference, for example 'abcdefghijklmnopqrst'."),
671
+ apiKeyId: external_exports.string().min(1).describe("The unique identifier of the project API key."),
672
+ name: external_exports.string().min(4).max(64).regex(new RegExp("^[a-z_][a-z0-9_]+$")).describe("The API key name. Use lowercase letters, numbers, and underscores; it must start with a lowercase letter or underscore.").optional(),
673
+ description: external_exports.string().describe("The updated API key description.").nullable().optional(),
674
+ reveal: external_exports.boolean().describe("Whether to reveal the full API key value in the response.").optional(),
675
+ secretJwtTemplate: external_exports.looseObject({}).describe("The updated JWT template for secret API keys.").nullable().optional()
676
+ }).describe("Input parameters for updating a project API key.");
677
+ var updateProjectApiKeyOutput = external_exports.strictObject({
678
+ apiKey: external_exports.strictObject({
679
+ id: external_exports.string().describe("The unique identifier of the API key."),
680
+ name: external_exports.string().describe("The name of the API key."),
681
+ type: external_exports.enum(["legacy", "publishable", "secret", "unknown"]).describe("The type of the API key."),
682
+ prefix: external_exports.string().describe("The prefix portion of the API key."),
683
+ hash: external_exports.string().describe("The hash of the API key."),
684
+ description: external_exports.string().describe("The description of the API key.").nullable().optional(),
685
+ apiKey: external_exports.string().describe("The full API key value when reveal is true and Supabase returns it.").optional(),
686
+ insertedAt: external_exports.string().describe("The timestamp when the API key was created.").optional(),
687
+ updatedAt: external_exports.string().describe("The timestamp when the API key was last updated.").optional(),
688
+ secretJwtTemplate: external_exports.looseObject({}).describe("The JWT template for secret API keys.").nullable().optional()
689
+ }).describe("A Supabase API key record.")
690
+ }).describe("Action output.");
691
+ var deleteProjectApiKeyInput = external_exports.strictObject({
692
+ projectRef: external_exports.string().min(1).max(64).describe("The Supabase project reference, for example 'abcdefghijklmnopqrst'."),
693
+ apiKeyId: external_exports.string().min(1).describe("The unique identifier of the project API key."),
694
+ reveal: external_exports.boolean().describe("Whether Supabase should reveal key data in the delete response.").optional(),
695
+ wasCompromised: external_exports.boolean().describe("Whether the key is being deleted because it was compromised.").optional(),
696
+ reason: external_exports.string().min(1).describe("Optional deletion reason sent to Supabase.").optional()
697
+ }).describe("Input parameters for deleting a project API key.");
698
+ var deleteProjectApiKeyOutput = external_exports.strictObject({
699
+ apiKey: external_exports.strictObject({
700
+ id: external_exports.string().describe("The unique identifier of the API key."),
701
+ name: external_exports.string().describe("The name of the API key."),
702
+ type: external_exports.enum(["legacy", "publishable", "secret", "unknown"]).describe("The type of the API key."),
703
+ prefix: external_exports.string().describe("The prefix portion of the API key."),
704
+ hash: external_exports.string().describe("The hash of the API key."),
705
+ description: external_exports.string().describe("The description of the API key.").nullable().optional(),
706
+ apiKey: external_exports.string().describe("The full API key value when reveal is true and Supabase returns it.").optional(),
707
+ insertedAt: external_exports.string().describe("The timestamp when the API key was created.").optional(),
708
+ updatedAt: external_exports.string().describe("The timestamp when the API key was last updated.").optional(),
709
+ secretJwtTemplate: external_exports.looseObject({}).describe("The JWT template for secret API keys.").nullable().optional()
710
+ }).describe("A Supabase API key record.")
711
+ }).describe("Action output.");
712
+ var listProjectSecretsInput = external_exports.strictObject({
713
+ projectRef: external_exports.string().min(1).max(64).describe("The Supabase project reference, for example 'abcdefghijklmnopqrst'.")
714
+ }).describe("Input parameters identifying a Supabase project.");
715
+ var listProjectSecretsOutput = external_exports.strictObject({
716
+ secrets: external_exports.array(external_exports.strictObject({
717
+ name: external_exports.string().describe("The secret name."),
718
+ value: external_exports.string().describe("The secret value when Supabase returns it.").optional(),
719
+ updatedAt: external_exports.string().describe("The timestamp when the secret was last updated.").optional()
720
+ }).describe("A Supabase project secret.")).describe("The project secrets returned by Supabase.")
721
+ }).describe("Action output.");
722
+ var upsertProjectSecretsInput = external_exports.strictObject({
723
+ projectRef: external_exports.string().min(1).max(64).describe("The Supabase project reference, for example 'abcdefghijklmnopqrst'."),
724
+ secrets: external_exports.array(external_exports.strictObject({
725
+ name: external_exports.string().min(1).max(256).describe("The secret name. It must not start with the reserved SUPABASE_ prefix."),
726
+ value: external_exports.string().max(24576).describe("The secret value.")
727
+ }).describe("A secret name/value pair to upsert.")).min(1).describe("The secrets to create or update.")
728
+ }).describe("Input parameters for upserting project secrets.");
729
+ var upsertProjectSecretsOutput = external_exports.strictObject({
730
+ success: external_exports.boolean().describe("Whether Supabase accepted the secret upsert request.")
731
+ }).describe("Action output.");
732
+ var deleteProjectSecretsInput = external_exports.strictObject({
733
+ projectRef: external_exports.string().min(1).max(64).describe("The Supabase project reference, for example 'abcdefghijklmnopqrst'."),
734
+ names: external_exports.array(external_exports.string().min(1).describe("A secret name.")).min(1).describe("The names of secrets to delete.")
735
+ }).describe("Input parameters for deleting project secrets.");
736
+ var deleteProjectSecretsOutput = external_exports.strictObject({
737
+ success: external_exports.boolean().describe("Whether Supabase accepted the secret delete request.")
738
+ }).describe("Action output.");
739
+ var generateTypescriptTypesInput = external_exports.strictObject({
740
+ projectRef: external_exports.string().min(1).max(64).describe("The Supabase project reference, for example 'abcdefghijklmnopqrst'."),
741
+ includedSchemas: external_exports.array(external_exports.string().min(1)).min(1).describe("Database schemas to include, such as public or auth.").optional()
742
+ }).describe("Input parameters for generating TypeScript types.");
743
+ var generateTypescriptTypesOutput = external_exports.strictObject({
744
+ typescript: external_exports.string().describe("The generated TypeScript type definitions.")
745
+ }).describe("Action output.");
746
+ var runReadOnlyQueryInput = external_exports.strictObject({
747
+ projectRef: external_exports.string().min(1).max(64).describe("The Supabase project reference, for example 'abcdefghijklmnopqrst'."),
748
+ query: external_exports.string().min(1).describe("The SQL query to run with read-only permissions."),
749
+ parameters: external_exports.array(external_exports.unknown().describe("A query parameter.")).describe("Optional positional query parameters.").optional()
750
+ }).describe("Input parameters for running a read-only SQL query.");
751
+ var runReadOnlyQueryOutput = external_exports.strictObject({
752
+ result: external_exports.unknown().describe("The raw read-only query response returned by Supabase, or null when Supabase returns no response body.")
753
+ }).describe("Action output.");
754
+ var listStorageBucketsInput = external_exports.strictObject({
755
+ projectRef: external_exports.string().min(1).max(64).describe("The Supabase project reference, for example 'abcdefghijklmnopqrst'.")
756
+ }).describe("Input parameters identifying a Supabase project.");
757
+ var listStorageBucketsOutput = external_exports.strictObject({
758
+ buckets: external_exports.array(external_exports.looseObject({}).describe("A JSON object returned by Supabase.")).describe("The Storage buckets returned by Supabase.")
759
+ }).describe("Action output.");
760
+ var listEdgeFunctionsInput = external_exports.strictObject({
761
+ projectRef: external_exports.string().min(1).max(64).describe("The Supabase project reference, for example 'abcdefghijklmnopqrst'.")
762
+ }).describe("Input parameters identifying a Supabase project.");
763
+ var listEdgeFunctionsOutput = external_exports.strictObject({
764
+ functions: external_exports.array(external_exports.looseObject({}).describe("A JSON object returned by Supabase.")).describe("The Edge Functions returned by Supabase.")
765
+ }).describe("Action output.");
766
+ var getEdgeFunctionInput = external_exports.strictObject({
767
+ projectRef: external_exports.string().min(1).max(64).describe("The Supabase project reference, for example 'abcdefghijklmnopqrst'."),
768
+ functionSlug: external_exports.string().min(1).describe("The Edge Function slug.")
769
+ }).describe("Input parameters for fetching an Edge Function.");
770
+ var getEdgeFunctionOutput = external_exports.strictObject({
771
+ function: external_exports.looseObject({}).describe("A JSON object returned by Supabase.")
772
+ }).describe("Action output.");
773
+ var supabaseActions = {
774
+ list_organizations: {
775
+ description: "List the organizations available to the authenticated Supabase account.",
776
+ effect: "read",
777
+ inputSchema: listOrganizationsInput,
778
+ outputSchema: external_exports.toJSONSchema(listOrganizationsOutput, { io: "output", unrepresentable: "any" })
779
+ },
780
+ get_organization: {
781
+ description: "Get details for a Supabase organization by slug.",
782
+ effect: "read",
783
+ inputSchema: getOrganizationInput,
784
+ outputSchema: external_exports.toJSONSchema(getOrganizationOutput, { io: "output", unrepresentable: "any" })
785
+ },
786
+ list_organization_members: {
787
+ description: "List members of a Supabase organization.",
788
+ effect: "read",
789
+ inputSchema: listOrganizationMembersInput,
790
+ outputSchema: external_exports.toJSONSchema(listOrganizationMembersOutput, { io: "output", unrepresentable: "any" })
791
+ },
792
+ list_organization_projects: {
793
+ description: "List projects in a Supabase organization with optional search and pagination.",
794
+ effect: "read",
795
+ inputSchema: listOrganizationProjectsInput,
796
+ outputSchema: external_exports.toJSONSchema(listOrganizationProjectsOutput, { io: "output", unrepresentable: "any" })
797
+ },
798
+ list_projects: {
799
+ description: "List Supabase projects visible to the authenticated account.",
800
+ effect: "read",
801
+ inputSchema: listProjectsInput,
802
+ outputSchema: external_exports.toJSONSchema(listProjectsOutput, { io: "output", unrepresentable: "any" })
803
+ },
804
+ get_project: {
805
+ description: "Get detailed metadata for a Supabase project by project ref.",
806
+ effect: "read",
807
+ inputSchema: getProjectInput,
808
+ outputSchema: external_exports.toJSONSchema(getProjectOutput, { io: "output", unrepresentable: "any" })
809
+ },
810
+ list_available_regions: {
811
+ description: "List Supabase regions available for creating projects in an organization.",
812
+ effect: "read",
813
+ inputSchema: listAvailableRegionsInput,
814
+ outputSchema: external_exports.toJSONSchema(listAvailableRegionsOutput, { io: "output", unrepresentable: "any" })
815
+ },
816
+ get_project_health: {
817
+ description: "Check health for selected services in a Supabase project.",
818
+ effect: "read",
819
+ inputSchema: getProjectHealthInput,
820
+ outputSchema: external_exports.toJSONSchema(getProjectHealthOutput, { io: "output", unrepresentable: "any" })
821
+ },
822
+ list_project_api_keys: {
823
+ description: "List API keys for a Supabase project.",
824
+ effect: "read",
825
+ inputSchema: listProjectApiKeysInput,
826
+ outputSchema: external_exports.toJSONSchema(listProjectApiKeysOutput, { io: "output", unrepresentable: "any" })
827
+ },
828
+ get_project_api_key: {
829
+ description: "Get one API key record from a Supabase project.",
830
+ effect: "read",
831
+ inputSchema: getProjectApiKeyInput,
832
+ outputSchema: external_exports.toJSONSchema(getProjectApiKeyOutput, { io: "output", unrepresentable: "any" })
833
+ },
834
+ create_project_api_key: {
835
+ description: "Create a publishable or secret API key for a Supabase project.",
836
+ effect: "write",
837
+ inputSchema: createProjectApiKeyInput,
838
+ outputSchema: external_exports.toJSONSchema(createProjectApiKeyOutput, { io: "output", unrepresentable: "any" })
839
+ },
840
+ update_project_api_key: {
841
+ description: "Update the name, description, or JWT template for a Supabase project API key.",
842
+ effect: "write",
843
+ inputSchema: updateProjectApiKeyInput,
844
+ outputSchema: external_exports.toJSONSchema(updateProjectApiKeyOutput, { io: "output", unrepresentable: "any" })
845
+ },
846
+ delete_project_api_key: {
847
+ description: "Delete a Supabase project API key.",
848
+ effect: "destructive",
849
+ inputSchema: deleteProjectApiKeyInput,
850
+ outputSchema: external_exports.toJSONSchema(deleteProjectApiKeyOutput, { io: "output", unrepresentable: "any" })
851
+ },
852
+ list_project_secrets: {
853
+ description: "List secrets configured for a Supabase project.",
854
+ effect: "read",
855
+ inputSchema: listProjectSecretsInput,
856
+ outputSchema: external_exports.toJSONSchema(listProjectSecretsOutput, { io: "output", unrepresentable: "any" })
857
+ },
858
+ upsert_project_secrets: {
859
+ description: "Bulk create or update secrets for a Supabase project.",
860
+ effect: "write",
861
+ inputSchema: upsertProjectSecretsInput,
862
+ outputSchema: external_exports.toJSONSchema(upsertProjectSecretsOutput, { io: "output", unrepresentable: "any" })
863
+ },
864
+ delete_project_secrets: {
865
+ description: "Bulk delete secrets from a Supabase project.",
866
+ effect: "destructive",
867
+ inputSchema: deleteProjectSecretsInput,
868
+ outputSchema: external_exports.toJSONSchema(deleteProjectSecretsOutput, { io: "output", unrepresentable: "any" })
869
+ },
870
+ generate_typescript_types: {
871
+ description: "Generate TypeScript database types for a Supabase project.",
872
+ effect: "read",
873
+ inputSchema: generateTypescriptTypesInput,
874
+ outputSchema: external_exports.toJSONSchema(generateTypescriptTypesOutput, { io: "output", unrepresentable: "any" })
875
+ },
876
+ run_read_only_query: {
877
+ description: "Run a SQL query through Supabase as the read-only database user.",
878
+ effect: "write",
879
+ inputSchema: runReadOnlyQueryInput,
880
+ outputSchema: external_exports.toJSONSchema(runReadOnlyQueryOutput, { io: "output", unrepresentable: "any" })
881
+ },
882
+ list_storage_buckets: {
883
+ description: "List Storage buckets for a Supabase project.",
884
+ effect: "read",
885
+ inputSchema: listStorageBucketsInput,
886
+ outputSchema: external_exports.toJSONSchema(listStorageBucketsOutput, { io: "output", unrepresentable: "any" })
887
+ },
888
+ list_edge_functions: {
889
+ description: "List Edge Functions in a Supabase project.",
890
+ effect: "read",
891
+ inputSchema: listEdgeFunctionsInput,
892
+ outputSchema: external_exports.toJSONSchema(listEdgeFunctionsOutput, { io: "output", unrepresentable: "any" })
893
+ },
894
+ get_edge_function: {
895
+ description: "Get metadata for one Supabase Edge Function by slug.",
896
+ effect: "read",
897
+ inputSchema: getEdgeFunctionInput,
898
+ outputSchema: external_exports.toJSONSchema(getEdgeFunctionOutput, { io: "output", unrepresentable: "any" })
899
+ }
900
+ };
901
+
902
+ // ../plugins/src/supabase/index.ts
903
+ function createSupabasePlugin() {
904
+ return createProviderPlugin({
905
+ description: "Supabase (Management API)",
906
+ actions: supabaseActions,
907
+ credentialProbe: "list_organizations",
908
+ handlers: {
909
+ list_organizations: listOrganizations,
910
+ get_organization: getOrganization,
911
+ list_organization_members: listOrganizationMembers,
912
+ list_organization_projects: listOrganizationProjects,
913
+ list_projects: listProjects,
914
+ get_project: getProject,
915
+ list_available_regions: listAvailableRegions,
916
+ get_project_health: getProjectHealth,
917
+ list_project_api_keys: listProjectApiKeys,
918
+ get_project_api_key: getProjectApiKey,
919
+ create_project_api_key: createProjectApiKey,
920
+ update_project_api_key: updateProjectApiKey,
921
+ delete_project_api_key: deleteProjectApiKey,
922
+ list_project_secrets: listProjectSecrets,
923
+ upsert_project_secrets: upsertProjectSecrets,
924
+ delete_project_secrets: deleteProjectSecrets,
925
+ generate_typescript_types: generateTypescriptTypes,
926
+ run_read_only_query: runReadOnlyQuery,
927
+ list_storage_buckets: listStorageBuckets,
928
+ list_edge_functions: listEdgeFunctions,
929
+ get_edge_function: getEdgeFunction
930
+ }
931
+ });
932
+ }
933
+ var supabase_default = createSupabasePlugin();
934
+ export {
935
+ createSupabasePlugin,
936
+ supabase_default as default
937
+ };