File tree 3 files changed +10
-10
lines changed
3 files changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -92,20 +92,20 @@ export default class SupabaseClient<
92
92
93
93
const settings = applySettingDefaults ( options ?? { } , DEFAULTS )
94
94
95
- this . storageKey = settings . auth ? .storageKey ?? ''
96
- this . headers = settings . global ? .headers ?? { }
95
+ this . storageKey = settings . auth . storageKey ?? ''
96
+ this . headers = settings . global . headers ?? { }
97
97
98
98
this . auth = this . _initSupabaseAuthClient (
99
99
settings . auth ?? { } ,
100
100
this . headers ,
101
- settings . global ? .fetch
101
+ settings . global . fetch
102
102
)
103
- this . fetch = fetchWithAuth ( supabaseKey , this . _getAccessToken . bind ( this ) , settings . global ? .fetch )
103
+ this . fetch = fetchWithAuth ( supabaseKey , this . _getAccessToken . bind ( this ) , settings . global . fetch )
104
104
105
105
this . realtime = this . _initRealtimeClient ( { headers : this . headers , ...settings . realtime } )
106
106
this . rest = new PostgrestClient ( `${ _supabaseUrl } /rest/v1` , {
107
107
headers : this . headers ,
108
- schema : settings . db ? .schema ,
108
+ schema : settings . db . schema ,
109
109
fetch : this . fetch ,
110
110
} )
111
111
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ export function applySettingDefaults<
23
23
> (
24
24
options : SupabaseClientOptions < SchemaName > ,
25
25
defaults : SupabaseClientOptions < any >
26
- ) : SupabaseClientOptions < SchemaName > {
26
+ ) : Required < SupabaseClientOptions < SchemaName > > {
27
27
const {
28
28
db : dbOptions ,
29
29
auth : authOptions ,
Original file line number Diff line number Diff line change @@ -33,10 +33,10 @@ test('override setting defaults', async () => {
33
33
} ,
34
34
}
35
35
let settings = helpers . applySettingDefaults ( options , defaults )
36
- expect ( settings ? .auth ? .autoRefreshToken ) . toBe ( autoRefreshOption )
36
+ expect ( settings . auth . autoRefreshToken ) . toBe ( autoRefreshOption )
37
37
// Existing default properties should not be overwritten
38
- expect ( settings ? .auth ? .persistSession ) . not . toBeNull ( )
39
- expect ( settings ? .global ? .headers ) . toBe ( DEFAULT_HEADERS )
38
+ expect ( settings . auth . persistSession ) . not . toBeNull ( )
39
+ expect ( settings . global . headers ) . toBe ( DEFAULT_HEADERS )
40
40
// Existing property values should remain constant
41
- expect ( settings ? .db ? .schema ) . toBe ( defaults . db . schema )
41
+ expect ( settings . db . schema ) . toBe ( defaults . db . schema )
42
42
} )
You can’t perform that action at this time.
0 commit comments