1
1
import { FunctionsClient } from '@supabase/functions-js'
2
- import { AuthChangeEvent } from '@supabase/auth-js'
2
+ import { AuthChangeEvent , Subscription } from '@supabase/auth-js'
3
3
import {
4
4
PostgrestClient ,
5
5
PostgrestFilterBuilder ,
@@ -278,7 +278,7 @@ export default class SupabaseClient<
278
278
return this . realtime . removeAllChannels ( )
279
279
}
280
280
281
- protected async _getAccessToken ( ) {
281
+ protected async _getAccessToken ( ) : Promise < string | null > {
282
282
if ( this . accessToken ) {
283
283
return await this . accessToken ( )
284
284
}
@@ -301,7 +301,7 @@ export default class SupabaseClient<
301
301
} : SupabaseAuthClientOptions ,
302
302
headers ?: Record < string , string > ,
303
303
fetch ?: Fetch
304
- ) {
304
+ ) : SupabaseAuthClient {
305
305
const authHeaders = {
306
306
Authorization : `Bearer ${ this . supabaseKey } ` ,
307
307
apikey : `${ this . supabaseKey } ` ,
@@ -324,14 +324,14 @@ export default class SupabaseClient<
324
324
} )
325
325
}
326
326
327
- protected _initRealtimeClient ( options : RealtimeClientOptions ) {
327
+ protected _initRealtimeClient ( options : RealtimeClientOptions ) : RealtimeClient {
328
328
return new RealtimeClient ( this . realtimeUrl . href , {
329
329
...options ,
330
330
params : { ...{ apikey : this . supabaseKey } , ...options ?. params } ,
331
331
} )
332
332
}
333
333
334
- protected async _listenForAuthEvents ( ) {
334
+ protected async _listenForAuthEvents ( ) : Promise < { data : { subscription : Subscription } } > {
335
335
return await this . auth . onAuthStateChange ( ( event , session ) => {
336
336
setTimeout (
337
337
async ( ) => await this . _handleTokenChanged ( event , 'CLIENT' , session ?. access_token ) ,
0 commit comments