MCPcopy
hub / github.com/triggerdotdev/trigger.dev / SupabaseManagement

Class SupabaseManagement

integrations/supabase/src/management/index.ts:268–544  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

266}
267
268export class SupabaseManagement implements TriggerIntegration {
269 // @internal
270 private _options: SupabaseManagementIntegrationOptions;
271 // @internal
272 private _client?: SupabaseManagementAPI;
273 // @internal
274 private _io?: IO;
275 // @internal
276 private _connectionKey?: string;
277
278 constructor(private options: SupabaseManagementIntegrationOptions) {
279 this._options = options;
280
281 if ("apiKey" in options) {
282 if (!options.apiKey || options.apiKey === "") {
283 throw `Can't create SupabaseManagement integration (${options.id}) as apiKey is undefined`;
284 }
285 }
286 }
287
288 get id() {
289 return this.options.id;
290 }
291
292 get metadata() {
293 return { id: "supabase-management", name: "Supabase Management API" };
294 }
295
296 get source(): WebhookEventSource {
297 return createWebhookEventSource(this);
298 }
299
300 get authSource() {
301 if ("apiKey" in this._options) {
302 return "LOCAL";
303 }
304
305 return "HOSTED" as const;
306 }
307
308 cloneForRun(io: IO, connectionKey: string, auth?: ConnectionAuth) {
309 const supabase = new SupabaseManagement(this._options);
310 supabase._io = io;
311 supabase._connectionKey = connectionKey;
312
313 if ("apiKey" in this._options) {
314 if (!this._options.apiKey || this._options.apiKey === "") {
315 throw `Can't create SupabaseManagement integration (${this._options.id}) as apiKey is undefined`;
316 }
317 supabase._client = new SupabaseManagementAPI({ accessToken: this._options.apiKey });
318 } else if (auth) {
319 supabase._client = new SupabaseManagementAPI({ accessToken: auth.accessToken });
320 } else {
321 throw `Can't create SupabaseManagement integration (${this._options.id}) as auth is undefined`;
322 }
323
324 return supabase;
325 }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…