Skip to content

Commit a5f32b9

Browse files
refactor: make db and auth optional
1 parent a927eeb commit a5f32b9

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

src/SupabaseClient.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ export default class SupabaseClient {
8787
this.functionsUrl = `${_supabaseUrl}/functions/v1`
8888
}
8989

90-
this.schema = settings.db?.schema || ''
91-
this.multiTab = settings.auth?.multiTab || false
90+
this.schema = settings.db?.schema ?? ''
91+
this.multiTab = settings.auth?.multiTab ?? false
9292
this.fetch = settings.fetch
9393
this.headers = { ...DEFAULT_HEADERS, ...options?.headers }
9494
this.shouldThrowOnError = settings.shouldThrowOnError || false

src/lib/types.ts

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
import { GoTrueClient } from '@supabase/gotrue-js'
22
import { RealtimeClientOptions } from '@supabase/realtime-js'
3-
// TODO(Joel): Validate if this is something we want
4-
// import { FunctionsOptions } from '@supabase/functions-js'
5-
// import { StorageOptions } from '@supabase/storage-js'
63

74
type GoTrueClientOptions = ConstructorParameters<typeof GoTrueClient>[0]
85

@@ -24,27 +21,27 @@ export type SupabaseClientOptions = {
2421
/**
2522
* Automatically refreshes the token for logged in users.
2623
*/
27-
autoRefreshToken: boolean
24+
autoRefreshToken?: boolean
2825
/**
2926
* Allows to enable/disable multi-tab/window events
3027
*/
31-
multiTab: boolean
28+
multiTab?: boolean
3229
/**
3330
* Whether to persist a logged in session to storage.
3431
*/
35-
persistSession: boolean
32+
persistSession?: boolean
3633
/**
3734
* Detect a session from the URL. Used for OAuth login callbacks.
3835
*/
39-
detectSessionInUrl: boolean
36+
detectSessionInUrl?: boolean
4037
/**
4138
* A storage provider. Used to store the logged in session.
4239
*/
43-
localStorage: SupabaseAuthClientOptions['localStorage']
40+
localStorage?: SupabaseAuthClientOptions['localStorage']
4441
/**
4542
* Options passed to the gotrue-js instance
4643
*/
47-
cookieOptions: SupabaseAuthClientOptions['cookieOptions']
44+
cookieOptions?: SupabaseAuthClientOptions['cookieOptions']
4845
}
4946

5047
/**
@@ -54,11 +51,13 @@ export type SupabaseClientOptions = {
5451
/**
5552
* Options passed to the storage-js instance
5653
*/
57-
storage?: StorageOptions
54+
// TODO: Add StorageOptions once ready
55+
storage?: GenericObject
5856
/**
5957
* Options passed to the functions-js instance
6058
*/
61-
functions?: FunctionsOptions
59+
// TODO: Add Function Options once ready
60+
functions?: GenericObject
6261
/**
6362
* A custom `fetch` implementation.
6463
*/

0 commit comments

Comments
 (0)