@@ -42,6 +42,10 @@ export default class SupabaseClient<
4242 */
4343 auth : SupabaseAuthClient
4444 realtime : RealtimeClient
45+ /**
46+ * Supabase Storage allows you to manage user-generated content, such as photos or videos.
47+ */
48+ storage : SupabaseStorageClient
4549
4650 protected realtimeUrl : URL
4751 protected authUrl : URL
@@ -64,6 +68,7 @@ export default class SupabaseClient<
6468 * @param options.auth.persistSession Set to "true" if you want to automatically save the user session into local storage.
6569 * @param options.auth.detectSessionInUrl Set to "true" if you want to automatically detects OAuth grants in the URL and signs in the user.
6670 * @param options.realtime Options passed along to realtime-js constructor.
71+ * @param options.storage Options passed along to the storage-js constructor.
6772 * @param options.global.fetch A custom fetch implementation.
6873 * @param options.global.headers Any additional headers to send with each network request.
6974 */
@@ -130,6 +135,13 @@ export default class SupabaseClient<
130135 fetch : this . fetch ,
131136 } )
132137
138+ this . storage = new SupabaseStorageClient (
139+ this . storageUrl . href ,
140+ this . headers ,
141+ this . fetch ,
142+ options ?. storage
143+ )
144+
133145 if ( ! settings . accessToken ) {
134146 this . _listenForAuthEvents ( )
135147 }
@@ -145,13 +157,6 @@ export default class SupabaseClient<
145157 } )
146158 }
147159
148- /**
149- * Supabase Storage allows you to manage user-generated content, such as photos or videos.
150- */
151- get storage ( ) : SupabaseStorageClient {
152- return new SupabaseStorageClient ( this . storageUrl . href , this . headers , this . fetch )
153- }
154-
155160 // NOTE: signatures must be kept in sync with PostgrestClient.from
156161 from <
157162 TableName extends string & keyof Schema [ 'Tables' ] ,
0 commit comments