@@ -9,7 +9,7 @@ import { RealtimeChannel, RealtimeClient, RealtimeClientOptions } from '@supabas
9
9
import { StorageClient as SupabaseStorageClient } from '@supabase/storage-js'
10
10
import { DEFAULT_HEADERS } from './lib/constants'
11
11
import { fetchWithAuth } from './lib/fetch'
12
- import { stripTrailingSlash } from './lib/helpers'
12
+ import { stripTrailingSlash , applySettingDefaults } from './lib/helpers'
13
13
import { SupabaseAuthClient } from './lib/SupabaseAuthClient'
14
14
import { SupabaseRealtimeChannel } from './lib/SupabaseRealtimeChannel'
15
15
import { Fetch , GenericSchema , SupabaseClientOptions , SupabaseAuthClientOptions } from './lib/types'
@@ -105,7 +105,7 @@ export default class SupabaseClient<
105
105
global : DEFAULT_GLOBAL_OPTIONS ,
106
106
}
107
107
108
- const settings = this . _applySettingDefaults ( options || { } , DEFAULTS )
108
+ const settings = applySettingDefaults ( options || { } , DEFAULTS )
109
109
110
110
this . storageKey = settings . auth ?. storageKey ?? ''
111
111
this . headers = settings . global ?. headers ?? { }
@@ -336,42 +336,4 @@ export default class SupabaseClient<
336
336
if ( source == 'STORAGE' ) this . auth . signOut ( )
337
337
}
338
338
}
339
-
340
- // TODO(Joel): Figure out how to properly type this
341
- private _applySettingDefaults (
342
- options : SupabaseClientOptions < SchemaName > ,
343
- defaults : any
344
- ) : SupabaseClientOptions < SchemaName > {
345
- const {
346
- db : dbOptions ,
347
- auth : authOptions ,
348
- realtime : realtimeOptions ,
349
- global : globalOptions ,
350
- } = options
351
- const {
352
- db : DEFAULT_DB_OPTIONS ,
353
- auth : DEFAULT_AUTH_OPTIONS ,
354
- realtime : DEFAULT_REALTIME_OPTIONS ,
355
- global : DEFAULT_GLOBAL_OPTIONS ,
356
- } = defaults
357
-
358
- return {
359
- db : {
360
- ...DEFAULT_DB_OPTIONS ,
361
- ...dbOptions ,
362
- } ,
363
- auth : {
364
- ...DEFAULT_AUTH_OPTIONS ,
365
- ...authOptions ,
366
- } ,
367
- realtime : {
368
- ...DEFAULT_REALTIME_OPTIONS ,
369
- ...realtimeOptions ,
370
- } ,
371
- global : {
372
- ...DEFAULT_GLOBAL_OPTIONS ,
373
- ...globalOptions ,
374
- } ,
375
- }
376
- }
377
339
}
0 commit comments