@terreno/rtk 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/betterAuthClient.d.ts +734 -0
- package/dist/betterAuthClient.d.ts.map +1 -0
- package/dist/betterAuthClient.js +79 -0
- package/dist/betterAuthClient.js.map +1 -0
- package/dist/betterAuthSlice.d.ts +338 -0
- package/dist/betterAuthSlice.d.ts.map +1 -0
- package/dist/betterAuthSlice.js +220 -0
- package/dist/betterAuthSlice.js.map +1 -0
- package/dist/betterAuthSlice.test.d.ts +2 -0
- package/dist/betterAuthSlice.test.d.ts.map +1 -0
- package/dist/betterAuthSlice.test.js +258 -0
- package/dist/betterAuthSlice.test.js.map +1 -0
- package/dist/betterAuthTypes.d.ts +74 -0
- package/dist/betterAuthTypes.d.ts.map +1 -0
- package/dist/betterAuthTypes.js +8 -0
- package/dist/betterAuthTypes.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/package.json +6 -2
- package/src/betterAuthClient.ts +107 -0
- package/src/betterAuthSlice.test.ts +329 -0
- package/src/betterAuthSlice.ts +307 -0
- package/src/betterAuthTypes.ts +81 -0
- package/src/index.ts +3 -0
|
@@ -0,0 +1,734 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Better Auth client factory for React Native/Expo applications.
|
|
3
|
+
*
|
|
4
|
+
* Provides a configured Better Auth client with Expo-specific storage
|
|
5
|
+
* and deep linking support.
|
|
6
|
+
*/
|
|
7
|
+
import type { BetterAuthClientConfig } from "./betterAuthTypes";
|
|
8
|
+
export type { BetterAuthClientConfig, BetterAuthOAuthProvider, BetterAuthSession, BetterAuthSessionData, BetterAuthUser, } from "./betterAuthTypes";
|
|
9
|
+
/**
|
|
10
|
+
* Creates a Better Auth client configured for Expo/React Native.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* const authClient = createBetterAuthClient({
|
|
15
|
+
* baseURL: "http://localhost:3000",
|
|
16
|
+
* scheme: "terreno",
|
|
17
|
+
* });
|
|
18
|
+
*
|
|
19
|
+
* // Use for social login
|
|
20
|
+
* await authClient.signIn.social({
|
|
21
|
+
* provider: "google",
|
|
22
|
+
* });
|
|
23
|
+
*
|
|
24
|
+
* // Get current session
|
|
25
|
+
* const session = await authClient.getSession();
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare const createBetterAuthClient: (config: BetterAuthClientConfig) => {
|
|
29
|
+
signIn: {
|
|
30
|
+
social: <FetchOptions extends import("better-auth").ClientFetchOption<Partial<{
|
|
31
|
+
provider: "google" | "github" | "apple" | (string & {}) | "atlassian" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "huggingface" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linear" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "vercel";
|
|
32
|
+
callbackURL?: string | undefined;
|
|
33
|
+
newUserCallbackURL?: string | undefined;
|
|
34
|
+
errorCallbackURL?: string | undefined;
|
|
35
|
+
disableRedirect?: boolean | undefined;
|
|
36
|
+
idToken?: {
|
|
37
|
+
token: string;
|
|
38
|
+
nonce?: string | undefined;
|
|
39
|
+
accessToken?: string | undefined;
|
|
40
|
+
refreshToken?: string | undefined;
|
|
41
|
+
expiresAt?: number | undefined;
|
|
42
|
+
} | undefined;
|
|
43
|
+
scopes?: string[] | undefined;
|
|
44
|
+
requestSignUp?: boolean | undefined;
|
|
45
|
+
loginHint?: string | undefined;
|
|
46
|
+
additionalData?: Record<string, any> | undefined;
|
|
47
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth").Prettify<{
|
|
48
|
+
provider: "google" | "github" | "apple" | (string & {}) | "atlassian" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "huggingface" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linear" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "vercel";
|
|
49
|
+
callbackURL?: string | undefined;
|
|
50
|
+
newUserCallbackURL?: string | undefined;
|
|
51
|
+
errorCallbackURL?: string | undefined;
|
|
52
|
+
disableRedirect?: boolean | undefined;
|
|
53
|
+
idToken?: {
|
|
54
|
+
token: string;
|
|
55
|
+
nonce?: string | undefined;
|
|
56
|
+
accessToken?: string | undefined;
|
|
57
|
+
refreshToken?: string | undefined;
|
|
58
|
+
expiresAt?: number | undefined;
|
|
59
|
+
} | undefined;
|
|
60
|
+
scopes?: string[] | undefined;
|
|
61
|
+
requestSignUp?: boolean | undefined;
|
|
62
|
+
loginHint?: string | undefined;
|
|
63
|
+
additionalData?: Record<string, any> | undefined;
|
|
64
|
+
} & {
|
|
65
|
+
fetchOptions?: FetchOptions | undefined;
|
|
66
|
+
}>, data_1?: FetchOptions | undefined) => Promise<import("better-auth/client").BetterFetchResponse<NonNullable<{
|
|
67
|
+
redirect: boolean;
|
|
68
|
+
url: string;
|
|
69
|
+
} | {
|
|
70
|
+
redirect: boolean;
|
|
71
|
+
token: string;
|
|
72
|
+
url: undefined;
|
|
73
|
+
user: {
|
|
74
|
+
id: string;
|
|
75
|
+
createdAt: Date;
|
|
76
|
+
updatedAt: Date;
|
|
77
|
+
email: string;
|
|
78
|
+
emailVerified: boolean;
|
|
79
|
+
name: string;
|
|
80
|
+
image?: string | null | undefined | undefined;
|
|
81
|
+
};
|
|
82
|
+
}>, {
|
|
83
|
+
code?: string | undefined;
|
|
84
|
+
message?: string | undefined;
|
|
85
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
86
|
+
};
|
|
87
|
+
} & {
|
|
88
|
+
signOut: <FetchOptions extends import("better-auth").ClientFetchOption<never, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import("better-auth").Prettify<{
|
|
89
|
+
query?: Record<string, any> | undefined;
|
|
90
|
+
fetchOptions?: FetchOptions | undefined;
|
|
91
|
+
}> | undefined, data_1?: FetchOptions | undefined) => Promise<import("better-auth/client").BetterFetchResponse<{
|
|
92
|
+
success: boolean;
|
|
93
|
+
}, {
|
|
94
|
+
code?: string | undefined;
|
|
95
|
+
message?: string | undefined;
|
|
96
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
97
|
+
} & {
|
|
98
|
+
signUp: {
|
|
99
|
+
email: <FetchOptions extends import("better-auth").ClientFetchOption<Partial<{
|
|
100
|
+
name: string;
|
|
101
|
+
email: string;
|
|
102
|
+
password: string;
|
|
103
|
+
image?: string | undefined;
|
|
104
|
+
callbackURL?: string | undefined;
|
|
105
|
+
rememberMe?: boolean | undefined;
|
|
106
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth").Prettify<{
|
|
107
|
+
email: string;
|
|
108
|
+
name: string;
|
|
109
|
+
password: string;
|
|
110
|
+
image?: string | undefined;
|
|
111
|
+
callbackURL?: string | undefined;
|
|
112
|
+
fetchOptions?: FetchOptions | undefined;
|
|
113
|
+
}>, data_1?: FetchOptions | undefined) => Promise<import("better-auth/client").BetterFetchResponse<NonNullable<{
|
|
114
|
+
token: null;
|
|
115
|
+
user: {
|
|
116
|
+
id: string;
|
|
117
|
+
createdAt: Date;
|
|
118
|
+
updatedAt: Date;
|
|
119
|
+
email: string;
|
|
120
|
+
emailVerified: boolean;
|
|
121
|
+
name: string;
|
|
122
|
+
image?: string | null | undefined | undefined;
|
|
123
|
+
};
|
|
124
|
+
} | {
|
|
125
|
+
token: string;
|
|
126
|
+
user: {
|
|
127
|
+
id: string;
|
|
128
|
+
createdAt: Date;
|
|
129
|
+
updatedAt: Date;
|
|
130
|
+
email: string;
|
|
131
|
+
emailVerified: boolean;
|
|
132
|
+
name: string;
|
|
133
|
+
image?: string | null | undefined | undefined;
|
|
134
|
+
};
|
|
135
|
+
}>, {
|
|
136
|
+
code?: string | undefined;
|
|
137
|
+
message?: string | undefined;
|
|
138
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
139
|
+
};
|
|
140
|
+
} & {
|
|
141
|
+
signIn: {
|
|
142
|
+
email: <FetchOptions extends import("better-auth").ClientFetchOption<Partial<{
|
|
143
|
+
email: string;
|
|
144
|
+
password: string;
|
|
145
|
+
callbackURL?: string | undefined;
|
|
146
|
+
rememberMe?: boolean | undefined;
|
|
147
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth").Prettify<{
|
|
148
|
+
email: string;
|
|
149
|
+
password: string;
|
|
150
|
+
callbackURL?: string | undefined;
|
|
151
|
+
rememberMe?: boolean | undefined;
|
|
152
|
+
} & {
|
|
153
|
+
fetchOptions?: FetchOptions | undefined;
|
|
154
|
+
}>, data_1?: FetchOptions | undefined) => Promise<import("better-auth/client").BetterFetchResponse<{
|
|
155
|
+
redirect: boolean;
|
|
156
|
+
token: string;
|
|
157
|
+
url?: string | undefined;
|
|
158
|
+
user: {
|
|
159
|
+
id: string;
|
|
160
|
+
createdAt: Date;
|
|
161
|
+
updatedAt: Date;
|
|
162
|
+
email: string;
|
|
163
|
+
emailVerified: boolean;
|
|
164
|
+
name: string;
|
|
165
|
+
image?: string | null | undefined | undefined;
|
|
166
|
+
};
|
|
167
|
+
}, {
|
|
168
|
+
code?: string | undefined;
|
|
169
|
+
message?: string | undefined;
|
|
170
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
171
|
+
};
|
|
172
|
+
} & {
|
|
173
|
+
resetPassword: <FetchOptions extends import("better-auth").ClientFetchOption<Partial<{
|
|
174
|
+
newPassword: string;
|
|
175
|
+
token?: string | undefined;
|
|
176
|
+
}> & Record<string, any>, Partial<{
|
|
177
|
+
token?: string | undefined;
|
|
178
|
+
}> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth").Prettify<{
|
|
179
|
+
newPassword: string;
|
|
180
|
+
token?: string | undefined;
|
|
181
|
+
} & {
|
|
182
|
+
fetchOptions?: FetchOptions | undefined;
|
|
183
|
+
}>, data_1?: FetchOptions | undefined) => Promise<import("better-auth/client").BetterFetchResponse<{
|
|
184
|
+
status: boolean;
|
|
185
|
+
}, {
|
|
186
|
+
code?: string | undefined;
|
|
187
|
+
message?: string | undefined;
|
|
188
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
189
|
+
} & {
|
|
190
|
+
verifyEmail: <FetchOptions extends import("better-auth").ClientFetchOption<never, Partial<{
|
|
191
|
+
token: string;
|
|
192
|
+
callbackURL?: string | undefined;
|
|
193
|
+
}> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth").Prettify<{
|
|
194
|
+
query: {
|
|
195
|
+
token: string;
|
|
196
|
+
callbackURL?: string | undefined;
|
|
197
|
+
};
|
|
198
|
+
fetchOptions?: FetchOptions | undefined;
|
|
199
|
+
}>, data_1?: FetchOptions | undefined) => Promise<import("better-auth/client").BetterFetchResponse<NonNullable<void | {
|
|
200
|
+
status: boolean;
|
|
201
|
+
}>, {
|
|
202
|
+
code?: string | undefined;
|
|
203
|
+
message?: string | undefined;
|
|
204
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
205
|
+
} & {
|
|
206
|
+
sendVerificationEmail: <FetchOptions extends import("better-auth").ClientFetchOption<Partial<{
|
|
207
|
+
email: string;
|
|
208
|
+
callbackURL?: string | undefined;
|
|
209
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth").Prettify<{
|
|
210
|
+
email: string;
|
|
211
|
+
callbackURL?: string | undefined;
|
|
212
|
+
} & {
|
|
213
|
+
fetchOptions?: FetchOptions | undefined;
|
|
214
|
+
}>, data_1?: FetchOptions | undefined) => Promise<import("better-auth/client").BetterFetchResponse<{
|
|
215
|
+
status: boolean;
|
|
216
|
+
}, {
|
|
217
|
+
code?: string | undefined;
|
|
218
|
+
message?: string | undefined;
|
|
219
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
220
|
+
} & {
|
|
221
|
+
changeEmail: <FetchOptions extends import("better-auth").ClientFetchOption<Partial<{
|
|
222
|
+
newEmail: string;
|
|
223
|
+
callbackURL?: string | undefined;
|
|
224
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth").Prettify<{
|
|
225
|
+
newEmail: string;
|
|
226
|
+
callbackURL?: string | undefined;
|
|
227
|
+
} & {
|
|
228
|
+
fetchOptions?: FetchOptions | undefined;
|
|
229
|
+
}>, data_1?: FetchOptions | undefined) => Promise<import("better-auth/client").BetterFetchResponse<{
|
|
230
|
+
status: boolean;
|
|
231
|
+
}, {
|
|
232
|
+
code?: string | undefined;
|
|
233
|
+
message?: string | undefined;
|
|
234
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
235
|
+
} & {
|
|
236
|
+
changePassword: <FetchOptions extends import("better-auth").ClientFetchOption<Partial<{
|
|
237
|
+
newPassword: string;
|
|
238
|
+
currentPassword: string;
|
|
239
|
+
revokeOtherSessions?: boolean | undefined;
|
|
240
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth").Prettify<{
|
|
241
|
+
newPassword: string;
|
|
242
|
+
currentPassword: string;
|
|
243
|
+
revokeOtherSessions?: boolean | undefined;
|
|
244
|
+
} & {
|
|
245
|
+
fetchOptions?: FetchOptions | undefined;
|
|
246
|
+
}>, data_1?: FetchOptions | undefined) => Promise<import("better-auth/client").BetterFetchResponse<{
|
|
247
|
+
token: string | null;
|
|
248
|
+
user: {
|
|
249
|
+
id: string;
|
|
250
|
+
createdAt: Date;
|
|
251
|
+
updatedAt: Date;
|
|
252
|
+
email: string;
|
|
253
|
+
emailVerified: boolean;
|
|
254
|
+
name: string;
|
|
255
|
+
image?: string | null | undefined;
|
|
256
|
+
} & Record<string, any>;
|
|
257
|
+
}, {
|
|
258
|
+
code?: string | undefined;
|
|
259
|
+
message?: string | undefined;
|
|
260
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
261
|
+
} & {
|
|
262
|
+
updateUser: <FetchOptions extends import("better-auth").ClientFetchOption<Partial<Partial<{}> & {
|
|
263
|
+
name?: string | undefined;
|
|
264
|
+
image?: string | undefined | null;
|
|
265
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import("better-auth").Prettify<{
|
|
266
|
+
image?: (string | null) | undefined;
|
|
267
|
+
name?: string | undefined;
|
|
268
|
+
fetchOptions?: FetchOptions | undefined;
|
|
269
|
+
} & Partial<{}>> | undefined, data_1?: FetchOptions | undefined) => Promise<import("better-auth/client").BetterFetchResponse<{
|
|
270
|
+
status: boolean;
|
|
271
|
+
}, {
|
|
272
|
+
code?: string | undefined;
|
|
273
|
+
message?: string | undefined;
|
|
274
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
275
|
+
} & {
|
|
276
|
+
deleteUser: <FetchOptions extends import("better-auth").ClientFetchOption<Partial<{
|
|
277
|
+
callbackURL?: string | undefined;
|
|
278
|
+
password?: string | undefined;
|
|
279
|
+
token?: string | undefined;
|
|
280
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import("better-auth").Prettify<{
|
|
281
|
+
callbackURL?: string | undefined;
|
|
282
|
+
password?: string | undefined;
|
|
283
|
+
token?: string | undefined;
|
|
284
|
+
} & {
|
|
285
|
+
fetchOptions?: FetchOptions | undefined;
|
|
286
|
+
}> | undefined, data_1?: FetchOptions | undefined) => Promise<import("better-auth/client").BetterFetchResponse<{
|
|
287
|
+
success: boolean;
|
|
288
|
+
message: string;
|
|
289
|
+
}, {
|
|
290
|
+
code?: string | undefined;
|
|
291
|
+
message?: string | undefined;
|
|
292
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
293
|
+
} & {
|
|
294
|
+
requestPasswordReset: <FetchOptions extends import("better-auth").ClientFetchOption<Partial<{
|
|
295
|
+
email: string;
|
|
296
|
+
redirectTo?: string | undefined;
|
|
297
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth").Prettify<{
|
|
298
|
+
email: string;
|
|
299
|
+
redirectTo?: string | undefined;
|
|
300
|
+
} & {
|
|
301
|
+
fetchOptions?: FetchOptions | undefined;
|
|
302
|
+
}>, data_1?: FetchOptions | undefined) => Promise<import("better-auth/client").BetterFetchResponse<{
|
|
303
|
+
status: boolean;
|
|
304
|
+
message: string;
|
|
305
|
+
}, {
|
|
306
|
+
code?: string | undefined;
|
|
307
|
+
message?: string | undefined;
|
|
308
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
309
|
+
} & {
|
|
310
|
+
resetPassword: {
|
|
311
|
+
":token": <FetchOptions extends import("better-auth").ClientFetchOption<never, Partial<{
|
|
312
|
+
callbackURL: string;
|
|
313
|
+
}> & Record<string, any>, {
|
|
314
|
+
token: string;
|
|
315
|
+
}>>(data_0: import("better-auth").Prettify<{
|
|
316
|
+
query: {
|
|
317
|
+
callbackURL: string;
|
|
318
|
+
};
|
|
319
|
+
fetchOptions?: FetchOptions | undefined;
|
|
320
|
+
}>, data_1?: FetchOptions | undefined) => Promise<import("better-auth/client").BetterFetchResponse<never, {
|
|
321
|
+
code?: string | undefined;
|
|
322
|
+
message?: string | undefined;
|
|
323
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
324
|
+
};
|
|
325
|
+
} & {
|
|
326
|
+
listSessions: <FetchOptions extends import("better-auth").ClientFetchOption<never, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import("better-auth").Prettify<{
|
|
327
|
+
query?: Record<string, any> | undefined;
|
|
328
|
+
fetchOptions?: FetchOptions | undefined;
|
|
329
|
+
}> | undefined, data_1?: FetchOptions | undefined) => Promise<import("better-auth/client").BetterFetchResponse<import("better-auth").Prettify<{
|
|
330
|
+
id: string;
|
|
331
|
+
createdAt: Date;
|
|
332
|
+
updatedAt: Date;
|
|
333
|
+
userId: string;
|
|
334
|
+
expiresAt: Date;
|
|
335
|
+
token: string;
|
|
336
|
+
ipAddress?: string | null | undefined | undefined;
|
|
337
|
+
userAgent?: string | null | undefined | undefined;
|
|
338
|
+
}>[], {
|
|
339
|
+
code?: string | undefined;
|
|
340
|
+
message?: string | undefined;
|
|
341
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
342
|
+
} & {
|
|
343
|
+
revokeSession: <FetchOptions extends import("better-auth").ClientFetchOption<Partial<{
|
|
344
|
+
token: string;
|
|
345
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth").Prettify<{
|
|
346
|
+
token: string;
|
|
347
|
+
} & {
|
|
348
|
+
fetchOptions?: FetchOptions | undefined;
|
|
349
|
+
}>, data_1?: FetchOptions | undefined) => Promise<import("better-auth/client").BetterFetchResponse<{
|
|
350
|
+
status: boolean;
|
|
351
|
+
}, {
|
|
352
|
+
code?: string | undefined;
|
|
353
|
+
message?: string | undefined;
|
|
354
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
355
|
+
} & {
|
|
356
|
+
revokeSessions: <FetchOptions extends import("better-auth").ClientFetchOption<never, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import("better-auth").Prettify<{
|
|
357
|
+
query?: Record<string, any> | undefined;
|
|
358
|
+
fetchOptions?: FetchOptions | undefined;
|
|
359
|
+
}> | undefined, data_1?: FetchOptions | undefined) => Promise<import("better-auth/client").BetterFetchResponse<{
|
|
360
|
+
status: boolean;
|
|
361
|
+
}, {
|
|
362
|
+
code?: string | undefined;
|
|
363
|
+
message?: string | undefined;
|
|
364
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
365
|
+
} & {
|
|
366
|
+
revokeOtherSessions: <FetchOptions extends import("better-auth").ClientFetchOption<never, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import("better-auth").Prettify<{
|
|
367
|
+
query?: Record<string, any> | undefined;
|
|
368
|
+
fetchOptions?: FetchOptions | undefined;
|
|
369
|
+
}> | undefined, data_1?: FetchOptions | undefined) => Promise<import("better-auth/client").BetterFetchResponse<{
|
|
370
|
+
status: boolean;
|
|
371
|
+
}, {
|
|
372
|
+
code?: string | undefined;
|
|
373
|
+
message?: string | undefined;
|
|
374
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
375
|
+
} & {
|
|
376
|
+
linkSocial: <FetchOptions extends import("better-auth").ClientFetchOption<Partial<{
|
|
377
|
+
provider: unknown;
|
|
378
|
+
callbackURL?: string | undefined;
|
|
379
|
+
idToken?: {
|
|
380
|
+
token: string;
|
|
381
|
+
nonce?: string | undefined;
|
|
382
|
+
accessToken?: string | undefined;
|
|
383
|
+
refreshToken?: string | undefined;
|
|
384
|
+
scopes?: string[] | undefined;
|
|
385
|
+
} | undefined;
|
|
386
|
+
requestSignUp?: boolean | undefined;
|
|
387
|
+
scopes?: string[] | undefined;
|
|
388
|
+
errorCallbackURL?: string | undefined;
|
|
389
|
+
disableRedirect?: boolean | undefined;
|
|
390
|
+
additionalData?: Record<string, any> | undefined;
|
|
391
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth").Prettify<{
|
|
392
|
+
provider: unknown;
|
|
393
|
+
callbackURL?: string | undefined;
|
|
394
|
+
idToken?: {
|
|
395
|
+
token: string;
|
|
396
|
+
nonce?: string | undefined;
|
|
397
|
+
accessToken?: string | undefined;
|
|
398
|
+
refreshToken?: string | undefined;
|
|
399
|
+
scopes?: string[] | undefined;
|
|
400
|
+
} | undefined;
|
|
401
|
+
requestSignUp?: boolean | undefined;
|
|
402
|
+
scopes?: string[] | undefined;
|
|
403
|
+
errorCallbackURL?: string | undefined;
|
|
404
|
+
disableRedirect?: boolean | undefined;
|
|
405
|
+
additionalData?: Record<string, any> | undefined;
|
|
406
|
+
} & {
|
|
407
|
+
fetchOptions?: FetchOptions | undefined;
|
|
408
|
+
}>, data_1?: FetchOptions | undefined) => Promise<import("better-auth/client").BetterFetchResponse<{
|
|
409
|
+
url: string;
|
|
410
|
+
redirect: boolean;
|
|
411
|
+
}, {
|
|
412
|
+
code?: string | undefined;
|
|
413
|
+
message?: string | undefined;
|
|
414
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
415
|
+
} & {
|
|
416
|
+
listAccounts: <FetchOptions extends import("better-auth").ClientFetchOption<never, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import("better-auth").Prettify<{
|
|
417
|
+
query?: Record<string, any> | undefined;
|
|
418
|
+
fetchOptions?: FetchOptions | undefined;
|
|
419
|
+
}> | undefined, data_1?: FetchOptions | undefined) => Promise<import("better-auth/client").BetterFetchResponse<{
|
|
420
|
+
scopes: string[];
|
|
421
|
+
id: string;
|
|
422
|
+
createdAt: Date;
|
|
423
|
+
updatedAt: Date;
|
|
424
|
+
userId: string;
|
|
425
|
+
providerId: string;
|
|
426
|
+
accountId: string;
|
|
427
|
+
}[], {
|
|
428
|
+
code?: string | undefined;
|
|
429
|
+
message?: string | undefined;
|
|
430
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
431
|
+
} & {
|
|
432
|
+
deleteUser: {
|
|
433
|
+
callback: <FetchOptions extends import("better-auth").ClientFetchOption<never, Partial<{
|
|
434
|
+
token: string;
|
|
435
|
+
callbackURL?: string | undefined;
|
|
436
|
+
}> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth").Prettify<{
|
|
437
|
+
query: {
|
|
438
|
+
token: string;
|
|
439
|
+
callbackURL?: string | undefined;
|
|
440
|
+
};
|
|
441
|
+
fetchOptions?: FetchOptions | undefined;
|
|
442
|
+
}>, data_1?: FetchOptions | undefined) => Promise<import("better-auth/client").BetterFetchResponse<{
|
|
443
|
+
success: boolean;
|
|
444
|
+
message: string;
|
|
445
|
+
}, {
|
|
446
|
+
code?: string | undefined;
|
|
447
|
+
message?: string | undefined;
|
|
448
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
449
|
+
};
|
|
450
|
+
} & {
|
|
451
|
+
unlinkAccount: <FetchOptions extends import("better-auth").ClientFetchOption<Partial<{
|
|
452
|
+
providerId: string;
|
|
453
|
+
accountId?: string | undefined;
|
|
454
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth").Prettify<{
|
|
455
|
+
providerId: string;
|
|
456
|
+
accountId?: string | undefined;
|
|
457
|
+
} & {
|
|
458
|
+
fetchOptions?: FetchOptions | undefined;
|
|
459
|
+
}>, data_1?: FetchOptions | undefined) => Promise<import("better-auth/client").BetterFetchResponse<{
|
|
460
|
+
status: boolean;
|
|
461
|
+
}, {
|
|
462
|
+
code?: string | undefined;
|
|
463
|
+
message?: string | undefined;
|
|
464
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
465
|
+
} & {
|
|
466
|
+
refreshToken: <FetchOptions extends import("better-auth").ClientFetchOption<Partial<{
|
|
467
|
+
providerId: string;
|
|
468
|
+
accountId?: string | undefined;
|
|
469
|
+
userId?: string | undefined;
|
|
470
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth").Prettify<{
|
|
471
|
+
providerId: string;
|
|
472
|
+
accountId?: string | undefined;
|
|
473
|
+
userId?: string | undefined;
|
|
474
|
+
} & {
|
|
475
|
+
fetchOptions?: FetchOptions | undefined;
|
|
476
|
+
}>, data_1?: FetchOptions | undefined) => Promise<import("better-auth/client").BetterFetchResponse<{
|
|
477
|
+
accessToken: string | undefined;
|
|
478
|
+
refreshToken: string | undefined;
|
|
479
|
+
accessTokenExpiresAt: Date | undefined;
|
|
480
|
+
refreshTokenExpiresAt: Date | undefined;
|
|
481
|
+
scope: string | null | undefined;
|
|
482
|
+
idToken: string | null | undefined;
|
|
483
|
+
providerId: string;
|
|
484
|
+
accountId: string;
|
|
485
|
+
}, {
|
|
486
|
+
code?: string | undefined;
|
|
487
|
+
message?: string | undefined;
|
|
488
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
489
|
+
} & {
|
|
490
|
+
getAccessToken: <FetchOptions extends import("better-auth").ClientFetchOption<Partial<{
|
|
491
|
+
providerId: string;
|
|
492
|
+
accountId?: string | undefined;
|
|
493
|
+
userId?: string | undefined;
|
|
494
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth").Prettify<{
|
|
495
|
+
providerId: string;
|
|
496
|
+
accountId?: string | undefined;
|
|
497
|
+
userId?: string | undefined;
|
|
498
|
+
} & {
|
|
499
|
+
fetchOptions?: FetchOptions | undefined;
|
|
500
|
+
}>, data_1?: FetchOptions | undefined) => Promise<import("better-auth/client").BetterFetchResponse<{
|
|
501
|
+
accessToken: string;
|
|
502
|
+
accessTokenExpiresAt: Date | undefined;
|
|
503
|
+
scopes: string[];
|
|
504
|
+
idToken: string | undefined;
|
|
505
|
+
}, {
|
|
506
|
+
code?: string | undefined;
|
|
507
|
+
message?: string | undefined;
|
|
508
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
509
|
+
} & {
|
|
510
|
+
accountInfo: <FetchOptions extends import("better-auth").ClientFetchOption<never, Partial<{
|
|
511
|
+
accountId?: string | undefined;
|
|
512
|
+
}> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import("better-auth").Prettify<{
|
|
513
|
+
query?: {
|
|
514
|
+
accountId?: string | undefined;
|
|
515
|
+
} | undefined;
|
|
516
|
+
fetchOptions?: FetchOptions | undefined;
|
|
517
|
+
}> | undefined, data_1?: FetchOptions | undefined) => Promise<import("better-auth/client").BetterFetchResponse<{
|
|
518
|
+
user: import("better-auth").OAuth2UserInfo;
|
|
519
|
+
data: Record<string, any>;
|
|
520
|
+
}, {
|
|
521
|
+
code?: string | undefined;
|
|
522
|
+
message?: string | undefined;
|
|
523
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
524
|
+
} & {
|
|
525
|
+
getSession: <FetchOptions extends import("better-auth").ClientFetchOption<never, Partial<{
|
|
526
|
+
disableCookieCache?: unknown;
|
|
527
|
+
disableRefresh?: unknown;
|
|
528
|
+
}> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import("better-auth").Prettify<{
|
|
529
|
+
query?: {
|
|
530
|
+
disableCookieCache?: unknown;
|
|
531
|
+
disableRefresh?: unknown;
|
|
532
|
+
} | undefined;
|
|
533
|
+
fetchOptions?: FetchOptions | undefined;
|
|
534
|
+
}> | undefined, data_1?: FetchOptions | undefined) => Promise<import("better-auth/client").BetterFetchResponse<{
|
|
535
|
+
user: {
|
|
536
|
+
id: string;
|
|
537
|
+
createdAt: Date;
|
|
538
|
+
updatedAt: Date;
|
|
539
|
+
email: string;
|
|
540
|
+
emailVerified: boolean;
|
|
541
|
+
name: string;
|
|
542
|
+
image?: string | null | undefined;
|
|
543
|
+
};
|
|
544
|
+
session: {
|
|
545
|
+
id: string;
|
|
546
|
+
createdAt: Date;
|
|
547
|
+
updatedAt: Date;
|
|
548
|
+
userId: string;
|
|
549
|
+
expiresAt: Date;
|
|
550
|
+
token: string;
|
|
551
|
+
ipAddress?: string | null | undefined;
|
|
552
|
+
userAgent?: string | null | undefined;
|
|
553
|
+
};
|
|
554
|
+
} | null, {
|
|
555
|
+
code?: string | undefined;
|
|
556
|
+
message?: string | undefined;
|
|
557
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
558
|
+
} & {
|
|
559
|
+
getCookie: () => string;
|
|
560
|
+
} & {
|
|
561
|
+
useSession: () => {
|
|
562
|
+
data: {
|
|
563
|
+
user: {
|
|
564
|
+
id: string;
|
|
565
|
+
createdAt: Date;
|
|
566
|
+
updatedAt: Date;
|
|
567
|
+
email: string;
|
|
568
|
+
emailVerified: boolean;
|
|
569
|
+
name: string;
|
|
570
|
+
image?: string | null | undefined;
|
|
571
|
+
};
|
|
572
|
+
session: {
|
|
573
|
+
id: string;
|
|
574
|
+
createdAt: Date;
|
|
575
|
+
updatedAt: Date;
|
|
576
|
+
userId: string;
|
|
577
|
+
expiresAt: Date;
|
|
578
|
+
token: string;
|
|
579
|
+
ipAddress?: string | null | undefined;
|
|
580
|
+
userAgent?: string | null | undefined;
|
|
581
|
+
};
|
|
582
|
+
} | null;
|
|
583
|
+
isPending: boolean;
|
|
584
|
+
isRefetching: boolean;
|
|
585
|
+
error: import("better-auth/client").BetterFetchError | null;
|
|
586
|
+
refetch: (queryParams?: {
|
|
587
|
+
query?: import("better-auth").SessionQueryParams;
|
|
588
|
+
} | undefined) => Promise<void>;
|
|
589
|
+
};
|
|
590
|
+
$Infer: {
|
|
591
|
+
Session: {
|
|
592
|
+
user: {
|
|
593
|
+
id: string;
|
|
594
|
+
createdAt: Date;
|
|
595
|
+
updatedAt: Date;
|
|
596
|
+
email: string;
|
|
597
|
+
emailVerified: boolean;
|
|
598
|
+
name: string;
|
|
599
|
+
image?: string | null | undefined;
|
|
600
|
+
};
|
|
601
|
+
session: {
|
|
602
|
+
id: string;
|
|
603
|
+
createdAt: Date;
|
|
604
|
+
updatedAt: Date;
|
|
605
|
+
userId: string;
|
|
606
|
+
expiresAt: Date;
|
|
607
|
+
token: string;
|
|
608
|
+
ipAddress?: string | null | undefined;
|
|
609
|
+
userAgent?: string | null | undefined;
|
|
610
|
+
};
|
|
611
|
+
};
|
|
612
|
+
};
|
|
613
|
+
$fetch: import("better-auth/client").BetterFetch<{
|
|
614
|
+
plugins: (import("better-auth/client").BetterFetchPlugin<Record<string, any>> | {
|
|
615
|
+
id: string;
|
|
616
|
+
name: string;
|
|
617
|
+
hooks: {
|
|
618
|
+
onSuccess(context: import("better-auth/client").SuccessContext<any>): void;
|
|
619
|
+
};
|
|
620
|
+
} | {
|
|
621
|
+
id: string;
|
|
622
|
+
name: string;
|
|
623
|
+
hooks: {
|
|
624
|
+
onSuccess: ((context: import("better-auth/client").SuccessContext<any>) => Promise<void> | void) | undefined;
|
|
625
|
+
onError: ((context: import("better-auth/client").ErrorContext) => Promise<void> | void) | undefined;
|
|
626
|
+
onRequest: (<T extends Record<string, any>>(context: import("better-auth/client").RequestContext<T>) => Promise<import("better-auth/client").RequestContext | void> | import("better-auth/client").RequestContext | void) | undefined;
|
|
627
|
+
onResponse: ((context: import("better-auth/client").ResponseContext) => Promise<Response | void | import("better-auth/client").ResponseContext> | Response | import("better-auth/client").ResponseContext | void) | undefined;
|
|
628
|
+
};
|
|
629
|
+
})[];
|
|
630
|
+
cache?: RequestCache | undefined;
|
|
631
|
+
method: string;
|
|
632
|
+
window?: null | undefined;
|
|
633
|
+
headers?: (HeadersInit & (HeadersInit | {
|
|
634
|
+
accept: "application/json" | "text/plain" | "application/octet-stream";
|
|
635
|
+
"content-type": "application/json" | "text/plain" | "application/x-www-form-urlencoded" | "multipart/form-data" | "application/octet-stream";
|
|
636
|
+
authorization: "Bearer" | "Basic";
|
|
637
|
+
})) | undefined;
|
|
638
|
+
redirect?: RequestRedirect | undefined;
|
|
639
|
+
credentials?: RequestCredentials;
|
|
640
|
+
integrity?: string | undefined;
|
|
641
|
+
keepalive?: boolean | undefined;
|
|
642
|
+
mode?: RequestMode | undefined;
|
|
643
|
+
priority?: RequestPriority | undefined;
|
|
644
|
+
referrer?: string | undefined;
|
|
645
|
+
referrerPolicy?: ReferrerPolicy | undefined;
|
|
646
|
+
signal?: (AbortSignal | null) | undefined;
|
|
647
|
+
onRetry?: ((response: import("better-auth/client").ResponseContext) => Promise<void> | void) | undefined;
|
|
648
|
+
hookOptions?: {
|
|
649
|
+
cloneResponse?: boolean;
|
|
650
|
+
} | undefined;
|
|
651
|
+
timeout?: number | undefined;
|
|
652
|
+
customFetchImpl: import("better-auth/client").FetchEsque;
|
|
653
|
+
baseURL: string;
|
|
654
|
+
throw?: boolean | undefined;
|
|
655
|
+
auth?: ({
|
|
656
|
+
type: "Bearer";
|
|
657
|
+
token: string | Promise<string | undefined> | (() => string | Promise<string | undefined> | undefined) | undefined;
|
|
658
|
+
} | {
|
|
659
|
+
type: "Basic";
|
|
660
|
+
username: string | (() => string | undefined) | undefined;
|
|
661
|
+
password: string | (() => string | undefined) | undefined;
|
|
662
|
+
} | {
|
|
663
|
+
type: "Custom";
|
|
664
|
+
prefix: string | (() => string | undefined) | undefined;
|
|
665
|
+
value: string | (() => string | undefined) | undefined;
|
|
666
|
+
}) | undefined;
|
|
667
|
+
body?: any;
|
|
668
|
+
query?: any;
|
|
669
|
+
params?: any;
|
|
670
|
+
duplex?: "full" | "half" | undefined;
|
|
671
|
+
jsonParser: (text: string) => Promise<any> | any;
|
|
672
|
+
retry?: import("better-auth/client").RetryOptions | undefined;
|
|
673
|
+
retryAttempt?: number | undefined;
|
|
674
|
+
output?: (import("better-auth/client").StandardSchemaV1 | typeof Blob | typeof File) | undefined;
|
|
675
|
+
errorSchema?: import("better-auth/client").StandardSchemaV1 | undefined;
|
|
676
|
+
disableValidation?: boolean | undefined;
|
|
677
|
+
disableSignal?: boolean | undefined;
|
|
678
|
+
}, unknown, unknown, {}>;
|
|
679
|
+
$store: {
|
|
680
|
+
notify: (signal?: (Omit<string, "$sessionSignal"> | "$sessionSignal") | undefined) => void;
|
|
681
|
+
listen: (signal: Omit<string, "$sessionSignal"> | "$sessionSignal", listener: (value: boolean, oldValue?: boolean | undefined) => void) => void;
|
|
682
|
+
atoms: Record<string, import("better-auth/client").WritableAtom<any>>;
|
|
683
|
+
};
|
|
684
|
+
$ERROR_CODES: {
|
|
685
|
+
readonly USER_NOT_FOUND: "User not found";
|
|
686
|
+
readonly FAILED_TO_CREATE_USER: "Failed to create user";
|
|
687
|
+
readonly FAILED_TO_CREATE_SESSION: "Failed to create session";
|
|
688
|
+
readonly FAILED_TO_UPDATE_USER: "Failed to update user";
|
|
689
|
+
readonly FAILED_TO_GET_SESSION: "Failed to get session";
|
|
690
|
+
readonly INVALID_PASSWORD: "Invalid password";
|
|
691
|
+
readonly INVALID_EMAIL: "Invalid email";
|
|
692
|
+
readonly INVALID_EMAIL_OR_PASSWORD: "Invalid email or password";
|
|
693
|
+
readonly SOCIAL_ACCOUNT_ALREADY_LINKED: "Social account already linked";
|
|
694
|
+
readonly PROVIDER_NOT_FOUND: "Provider not found";
|
|
695
|
+
readonly INVALID_TOKEN: "Invalid token";
|
|
696
|
+
readonly ID_TOKEN_NOT_SUPPORTED: "id_token not supported";
|
|
697
|
+
readonly FAILED_TO_GET_USER_INFO: "Failed to get user info";
|
|
698
|
+
readonly USER_EMAIL_NOT_FOUND: "User email not found";
|
|
699
|
+
readonly EMAIL_NOT_VERIFIED: "Email not verified";
|
|
700
|
+
readonly PASSWORD_TOO_SHORT: "Password too short";
|
|
701
|
+
readonly PASSWORD_TOO_LONG: "Password too long";
|
|
702
|
+
readonly USER_ALREADY_EXISTS: "User already exists.";
|
|
703
|
+
readonly USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL: "User already exists. Use another email.";
|
|
704
|
+
readonly EMAIL_CAN_NOT_BE_UPDATED: "Email can not be updated";
|
|
705
|
+
readonly CREDENTIAL_ACCOUNT_NOT_FOUND: "Credential account not found";
|
|
706
|
+
readonly SESSION_EXPIRED: "Session expired. Re-authenticate to perform this action.";
|
|
707
|
+
readonly FAILED_TO_UNLINK_LAST_ACCOUNT: "You can't unlink your last account";
|
|
708
|
+
readonly ACCOUNT_NOT_FOUND: "Account not found";
|
|
709
|
+
readonly USER_ALREADY_HAS_PASSWORD: "User already has a password. Provide that to delete the account.";
|
|
710
|
+
readonly CROSS_SITE_NAVIGATION_LOGIN_BLOCKED: "Cross-site navigation login blocked. This request appears to be a CSRF attack.";
|
|
711
|
+
readonly VERIFICATION_EMAIL_NOT_ENABLED: "Verification email isn't enabled";
|
|
712
|
+
readonly EMAIL_ALREADY_VERIFIED: "Email is already verified";
|
|
713
|
+
readonly EMAIL_MISMATCH: "Email mismatch";
|
|
714
|
+
readonly SESSION_NOT_FRESH: "Session is not fresh";
|
|
715
|
+
readonly LINKED_ACCOUNT_ALREADY_EXISTS: "Linked account already exists";
|
|
716
|
+
readonly INVALID_ORIGIN: "Invalid origin";
|
|
717
|
+
readonly INVALID_CALLBACK_URL: "Invalid callbackURL";
|
|
718
|
+
readonly INVALID_REDIRECT_URL: "Invalid redirectURL";
|
|
719
|
+
readonly INVALID_ERROR_CALLBACK_URL: "Invalid errorCallbackURL";
|
|
720
|
+
readonly INVALID_NEW_USER_CALLBACK_URL: "Invalid newUserCallbackURL";
|
|
721
|
+
readonly MISSING_OR_NULL_ORIGIN: "Missing or null Origin";
|
|
722
|
+
readonly CALLBACK_URL_REQUIRED: "callbackURL is required";
|
|
723
|
+
readonly FAILED_TO_CREATE_VERIFICATION: "Unable to create verification";
|
|
724
|
+
readonly FIELD_NOT_ALLOWED: "Field not allowed to be set";
|
|
725
|
+
readonly ASYNC_VALIDATION_NOT_SUPPORTED: "Async validation is not supported";
|
|
726
|
+
readonly VALIDATION_ERROR: "Validation Error";
|
|
727
|
+
readonly MISSING_FIELD: "Field is required";
|
|
728
|
+
};
|
|
729
|
+
};
|
|
730
|
+
/**
|
|
731
|
+
* Type of the Better Auth client returned by createBetterAuthClient.
|
|
732
|
+
*/
|
|
733
|
+
export type BetterAuthClient = ReturnType<typeof createBetterAuthClient>;
|
|
734
|
+
//# sourceMappingURL=betterAuthClient.d.ts.map
|