-
-
Notifications
You must be signed in to change notification settings - Fork 333
/
Copy pathtypes.ts
95 lines (80 loc) · 2.16 KB
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
import { GoTrueClient } from '@supabase/gotrue-js'
import { RealtimeClientOptions } from '@supabase/realtime-js'
type GoTrueClientOptions = ConstructorParameters<typeof GoTrueClient>[0]
export interface SupabaseAuthClientOptions extends GoTrueClientOptions {}
export type GenericObject = { [key: string]: string }
export type Fetch = typeof fetch
export type SupabaseClientOptions = {
/**
* The Postgres schema which your tables belong to. Must be on the list of exposed schemas in Supabase. Defaults to 'public'.
*/
schema?: string
/**
* Optional headers for initializing the client.
*/
headers?: GenericObject
/**
* Automatically refreshes the token for logged in users.
*/
autoRefreshToken?: boolean
/**
* Allows to enable/disable multi-tab/window events
*/
multiTab?: boolean
/**
* Whether to persist a logged in session to storage.
*/
persistSession?: boolean
/**
* Detect a session from the URL. Used for OAuth login callbacks.
*/
detectSessionInUrl?: boolean
/**
* A storage provider. Used to store the logged in session.
*/
localStorage?: SupabaseAuthClientOptions['localStorage']
/**
* Options passed to the realtime-js instance
*/
realtime?: RealtimeClientOptions
/**
* A custom `fetch` implementation.
*/
fetch?: Fetch
/**
* Throw errors, instead of returning them.
*/
shouldThrowOnError?: boolean
/**
* Options passed to the gotrue-js instance
*/
cookieOptions?: SupabaseAuthClientOptions['cookieOptions']
/**
* Override the restUrl
*/
restUrl?: string
/**
* Override the realtimeUrl (must be ws:// scheme)
*/
realtimeUrl?: string
/**
* Override the authUrl
*/
authUrl?: string
/**
* Override the storageUrl
*/
storageUrl?: string
}
export type SupabaseRealtimePayload<T> = {
commit_timestamp: string
eventType: 'INSERT' | 'UPDATE' | 'DELETE'
schema: string
table: string
/** The new record. Present for 'INSERT' and 'UPDATE' events. */
new: T
/** The previous record. Present for 'UPDATE' and 'DELETE' events. */
old: T
errors: string[] | null
}
export type SupabaseEventTypes = 'INSERT' | 'UPDATE' | 'DELETE' | '*'