-
-
Notifications
You must be signed in to change notification settings - Fork 153
/
types.ts
75 lines (69 loc) · 1.76 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
export type Provider = 'bitbucket' | 'github' | 'gitlab' | 'google'
export type AuthChangeEvent = 'SIGNED_IN' | 'SIGNED_OUT' | 'USER_UPDATED' | 'PASSWORD_RECOVERY'
export interface Session {
access_token: string
expires_in: number
refresh_token: string
token_type: string
user: User
}
export interface User {
id: string
app_metadata: {
provider?: string
[key: string]: any
}
user_metadata: {
[key: string]: any
}
aud: string
email?: string
created_at: string
confirmed_at?: string
last_sign_in_at?: string
role?: string
updated_at?: string
}
export interface UserAttributes {
/**
* The user's email.
*/
email?: string
/**
* The user's password.
*/
password?: string
/**
* An email change token.
*/
email_change_token?: string
/**
* A custom data object. Can be any JSON.
*/
data?: object
}
export interface Subscription {
/**
* The subscriber UUID. This will be set by the client.
*/
id: string
/**
* The function to call every time there is an event. eg: (eventName) => {}
*/
callback: (event: AuthChangeEvent, session: Session | null) => void
/**
* Call this to remove the listener.
*/
unsubscribe: () => void
}
export interface CookieOptions {
// (Optional) The name of the cookie. Defaults to `sb:token`.
name?: string
// (Optional) The cookie lifetime (expiration) in seconds. Set to 8 hours by default.
lifetime?: number
// (Optional) The cookie domain this should run on. Leave it blank to restrict it to your domain.
domain?: string
path?: string
// (Optional) SameSite configuration for the session cookie. Defaults to 'lax', but can be changed to 'strict' or 'none'. Set it to false if you want to disable the SameSite setting.
sameSite?: string
}