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

Class Supabase

integrations/supabase/src/database/index.ts:48–169  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46 * ```
47 */
48export class Supabase<
49 Database = any,
50 SchemaName extends string & keyof Database = "public" extends keyof Database
51 ? "public"
52 : string & keyof Database,
53 Schema extends GenericSchema = Database[SchemaName] extends GenericSchema
54 ? Database[SchemaName]
55 : any,
56> implements TriggerIntegration
57{
58 // @internal
59 private _options: SupabaseIntegrationOptions<SchemaName>;
60 // @internal
61 private _client?: SupabaseClient<Database, SchemaName, Schema>;
62 // @internal
63 private _io?: IO;
64 // @internal
65 private _connectionKey?: string;
66
67 /**
68 * The native Supabase client. This is exposed for use outside of Trigger.dev jobs
69 *
70 * @example
71 * ```ts
72 * import { Supabase } from "@trigger.dev/supabase";
73 * import { Database } from "@/supabase.types";
74 *
75 * const supabase = new Supabase<Database>({
76 * id: "my-supabase",
77 * projectId: process.env.SUPABASE_ID!,
78 * supabaseKey: process.env.SUPABASE_API_KEY!,
79 * });
80 *
81 * const { data, error } = await supabase.native.from("users").select("*");
82 * ```
83 */
84 public readonly native: SupabaseClient<Database, SchemaName, Schema>;
85
86 constructor(private options: SupabaseIntegrationOptions<SchemaName>) {
87 this._options = options;
88
89 const supabaseOptions = options.options || {};
90 const supabaseUrl =
91 "projectId" in options ? `https://${options.projectId}.supabase.co` : options.supabaseUrl;
92
93 this.native = createClient(supabaseUrl, options.supabaseKey, {
94 ...supabaseOptions,
95 auth: {
96 ...supabaseOptions.auth,
97 persistSession: false,
98 },
99 });
100 }
101
102 get authSource() {
103 return "LOCAL" as const;
104 }
105

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…