1+ import  type  {  AuthChangeEvent  }  from  '@supabase/auth-js' 
12import  {  FunctionsClient  }  from  '@supabase/functions-js' 
2- import  {  AuthChangeEvent  }  from  '@supabase/auth -js' 
3+ import  {  PostgrestClient  }  from  '@supabase/postgrest -js' 
34import  { 
4-   PostgrestClient , 
5-   PostgrestFilterBuilder , 
6-   PostgrestQueryBuilder , 
7- }  from  '@supabase/postgrest-js' 
8- import  { 
9-   RealtimeChannel , 
10-   RealtimeChannelOptions , 
5+   type  RealtimeChannel , 
6+   type  RealtimeChannelOptions , 
117  RealtimeClient , 
12-   RealtimeClientOptions , 
8+   type   RealtimeClientOptions , 
139}  from  '@supabase/realtime-js' 
1410import  {  StorageClient  as  SupabaseStorageClient  }  from  '@supabase/storage-js' 
1511import  { 
16-   DEFAULT_GLOBAL_OPTIONS , 
17-   DEFAULT_DB_OPTIONS , 
1812  DEFAULT_AUTH_OPTIONS , 
13+   DEFAULT_DB_OPTIONS , 
14+   DEFAULT_GLOBAL_OPTIONS , 
1915  DEFAULT_REALTIME_OPTIONS , 
2016}  from  './lib/constants' 
2117import  {  fetchWithAuth  }  from  './lib/fetch' 
2218import  {  applySettingDefaults ,  validateSupabaseUrl  }  from  './lib/helpers' 
2319import  {  SupabaseAuthClient  }  from  './lib/SupabaseAuthClient' 
24- import  {  Fetch ,  GenericSchema ,  SupabaseClientOptions ,  SupabaseAuthClientOptions  }  from  './lib/types' 
20+ import  type  { 
21+   Fetch , 
22+   GenericSchema , 
23+   SupabaseAuthClientOptions , 
24+   SupabaseClientOptions , 
25+ }  from  './lib/types' 
2526
2627/** 
2728 * Supabase Client. 
@@ -178,20 +179,14 @@ export default class SupabaseClient<
178179    } ) 
179180  } 
180181
181-   // NOTE: signatures must be kept in sync with PostgrestClient.from 
182-   from < 
183-     TableName  extends  string  &  keyof  Schema [ 'Tables' ] , 
184-     Table  extends  Schema [ 'Tables' ] [ TableName ] , 
185-   > ( relation : TableName ) : PostgrestQueryBuilder < ClientOptions ,  Schema ,  Table ,  TableName > 
186-   from < ViewName  extends  string  &  keyof  Schema [ 'Views' ] ,  View  extends  Schema [ 'Views' ] [ ViewName ] > ( 
187-     relation : ViewName 
188-   ) : PostgrestQueryBuilder < ClientOptions ,  Schema ,  View ,  ViewName > 
189182  /** 
190183   * Perform a query on a table or a view. 
191184   * 
192185   * @param  relation - The table or view name to query 
193186   */ 
194-   from ( relation : string ) : PostgrestQueryBuilder < ClientOptions ,  Schema ,  any >  { 
187+   from < RelationName  extends  string  &  ( keyof  Schema [ 'Tables' ]  |  keyof  Schema [ 'Views' ] ) > ( 
188+     relation : RelationName 
189+   )  { 
195190    return  this . rest . from ( relation ) 
196191  } 
197192
@@ -205,13 +200,8 @@ export default class SupabaseClient<
205200   */ 
206201  schema < DynamicSchema  extends  string  &  keyof  Omit < Database ,  '__InternalSupabase' > > ( 
207202    schema : DynamicSchema 
208-   ) : PostgrestClient < 
209-     Database , 
210-     ClientOptions , 
211-     DynamicSchema , 
212-     Database [ DynamicSchema ]  extends  GenericSchema  ? Database [ DynamicSchema ]  : any 
213-   >  { 
214-     return  this . rest . schema < DynamicSchema > ( schema ) 
203+   )  { 
204+     return  this . rest . schema ( schema ) 
215205  } 
216206
217207  // NOTE: signatures must be kept in sync with PostgrestClient.rpc 
@@ -238,27 +228,22 @@ export default class SupabaseClient<
238228   * `"estimated"`: Uses exact count for low numbers and planned count for high 
239229   * numbers. 
240230   */ 
241-   rpc < FnName  extends  string  &  keyof  Schema [ 'Functions' ] ,  Fn  extends  Schema [ 'Functions' ] [ FnName ] > ( 
231+   rpc < 
232+     FnName  extends  string  &  keyof  Schema [ 'Functions' ] , 
233+     Args  extends  Schema [ 'Functions' ] [ FnName ] [ 'Args' ]  =  never , 
234+   > ( 
242235    fn : FnName , 
243-     args : Fn [ ' Args' ]  =  { } , 
236+     args : Args  =  { }   as   Args , 
244237    options : { 
245238      head ?: boolean 
246239      get ?: boolean 
247240      count ?: 'exact'  |  'planned'  |  'estimated' 
248-     }  =  { } 
249-   ) : PostgrestFilterBuilder < 
250-     ClientOptions , 
251-     Schema , 
252-     Fn [ 'Returns' ]  extends  any [ ] 
253-       ? Fn [ 'Returns' ] [ number ]  extends  Record < string ,  unknown > 
254-         ? Fn [ 'Returns' ] [ number ] 
255-         : never 
256-       : never , 
257-     Fn [ 'Returns' ] , 
258-     FnName , 
259-     null , 
260-     'RPC' 
261-   >  { 
241+     }  =  { 
242+       head : false , 
243+       get : false , 
244+       count : undefined , 
245+     } 
246+   )  { 
262247    return  this . rest . rpc ( fn ,  args ,  options ) 
263248  } 
264249
@@ -355,7 +340,7 @@ export default class SupabaseClient<
355340  } 
356341
357342  private  _listenForAuthEvents ( )  { 
358-     let  data  =  this . auth . onAuthStateChange ( ( event ,  session )  =>  { 
343+     const  data  =  this . auth . onAuthStateChange ( ( event ,  session )  =>  { 
359344      this . _handleTokenChanged ( event ,  'CLIENT' ,  session ?. access_token ) 
360345    } ) 
361346    return  data 
@@ -374,7 +359,7 @@ export default class SupabaseClient<
374359      this . realtime . setAuth ( token ) 
375360    }  else  if  ( event  ===  'SIGNED_OUT' )  { 
376361      this . realtime . setAuth ( ) 
377-       if  ( source  ==  'STORAGE' )  this . auth . signOut ( ) 
362+       if  ( source  ===   'STORAGE' )  this . auth . signOut ( ) 
378363      this . changedAccessToken  =  undefined 
379364    } 
380365  } 
0 commit comments