@choiceform/shared-auth 0.1.17 → 0.1.19
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/README.md +504 -121
- package/dist/__tests__/auth-utils.test.d.ts +5 -0
- package/dist/__tests__/auth-utils.test.d.ts.map +1 -0
- package/dist/__tests__/auth-utils.test.js +96 -0
- package/dist/__tests__/store.test.d.ts +5 -0
- package/dist/__tests__/store.test.d.ts.map +1 -0
- package/dist/__tests__/store.test.js +210 -0
- package/dist/__tests__/user-mapper.test.d.ts +5 -0
- package/dist/__tests__/user-mapper.test.d.ts.map +1 -0
- package/dist/__tests__/user-mapper.test.js +76 -0
- package/dist/api/auth-api.d.ts +93 -9
- package/dist/api/auth-api.d.ts.map +1 -1
- package/dist/api/auth-api.js +219 -80
- package/dist/api/client.d.ts +10 -0
- package/dist/api/client.d.ts.map +1 -1
- package/dist/api/client.js +10 -0
- package/dist/api/organization-api.d.ts +2 -7
- package/dist/api/organization-api.d.ts.map +1 -1
- package/dist/api/organization-api.js +2 -17
- package/dist/api/team-api.d.ts +1 -5
- package/dist/api/team-api.d.ts.map +1 -1
- package/dist/api/team-api.js +5 -11
- package/dist/config.js +1 -1
- package/dist/core.d.ts +257 -137
- package/dist/core.d.ts.map +1 -1
- package/dist/core.js +112 -28
- package/dist/hooks/index.d.ts +8 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +7 -0
- package/dist/hooks/use-auth-init.d.ts +4 -0
- package/dist/hooks/use-auth-init.d.ts.map +1 -1
- package/dist/hooks/use-auth-init.js +16 -21
- package/dist/hooks/use-auth-sync.d.ts +60 -0
- package/dist/hooks/use-auth-sync.d.ts.map +1 -0
- package/dist/hooks/use-auth-sync.js +116 -0
- package/dist/hooks/use-email-verification.d.ts +85 -0
- package/dist/hooks/use-email-verification.d.ts.map +1 -0
- package/dist/hooks/use-email-verification.js +145 -0
- package/dist/hooks/use-protected-route.d.ts +67 -0
- package/dist/hooks/use-protected-route.d.ts.map +1 -0
- package/dist/hooks/use-protected-route.js +102 -0
- package/dist/index.d.ts +12 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +45 -13
- package/dist/init.d.ts +236 -136
- package/dist/init.d.ts.map +1 -1
- package/dist/lib/auth-client.d.ts +108 -66
- package/dist/lib/auth-client.d.ts.map +1 -1
- package/dist/lib/auth-client.js +75 -2
- package/dist/services/auth-service.d.ts +101 -0
- package/dist/services/auth-service.d.ts.map +1 -0
- package/dist/services/auth-service.js +356 -0
- package/dist/services/callback-service.d.ts +33 -0
- package/dist/services/callback-service.d.ts.map +1 -0
- package/dist/services/callback-service.js +473 -0
- package/dist/services/companion-team.d.ts.map +1 -1
- package/dist/services/companion-team.js +41 -39
- package/dist/services/index.d.ts +3 -0
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/index.js +3 -0
- package/dist/services/referral-service.d.ts +54 -0
- package/dist/services/referral-service.d.ts.map +1 -0
- package/dist/services/referral-service.js +54 -0
- package/dist/store/actions.d.ts +54 -51
- package/dist/store/actions.d.ts.map +1 -1
- package/dist/store/actions.js +111 -243
- package/dist/store/computed.d.ts +72 -1
- package/dist/store/computed.d.ts.map +1 -1
- package/dist/store/computed.js +90 -3
- package/dist/store/index.d.ts +3 -3
- package/dist/store/index.d.ts.map +1 -1
- package/dist/store/index.js +2 -2
- package/dist/store/state.d.ts +10 -0
- package/dist/store/state.d.ts.map +1 -1
- package/dist/store/state.js +11 -1
- package/dist/store/utils.d.ts +3 -34
- package/dist/store/utils.d.ts.map +1 -1
- package/dist/store/utils.js +2 -22
- package/dist/types/auth.d.ts +106 -0
- package/dist/types/auth.d.ts.map +1 -1
- package/dist/types/callback.d.ts +35 -0
- package/dist/types/callback.d.ts.map +1 -0
- package/dist/types/callback.js +1 -0
- package/dist/types/index.d.ts +4 -3
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/organization.d.ts +19 -3
- package/dist/types/organization.d.ts.map +1 -1
- package/dist/types/team.d.ts +6 -2
- package/dist/types/team.d.ts.map +1 -1
- package/dist/types/user.d.ts +11 -3
- package/dist/types/user.d.ts.map +1 -1
- package/dist/utils/auth-utils.d.ts +60 -0
- package/dist/utils/auth-utils.d.ts.map +1 -0
- package/dist/utils/auth-utils.js +146 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -0
- package/dist/utils/user-mapper.d.ts.map +1 -1
- package/dist/utils/user-mapper.js +4 -1
- package/package.json +17 -10
package/dist/core.d.ts
CHANGED
|
@@ -1,18 +1,28 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 认证系统核心
|
|
3
|
+
*
|
|
4
|
+
* 架构设计:
|
|
5
|
+
* - Store Layer: 响应式状态管理(authStore + storeActions)
|
|
6
|
+
* - Service Layer: 业务逻辑(authService)
|
|
7
|
+
* - API Layer: HTTP 请求(apiClient + authApi/organizationApi/teamApi)
|
|
8
|
+
*
|
|
9
|
+
* 使用方式:
|
|
10
|
+
* ```typescript
|
|
11
|
+
* // 初始化
|
|
12
|
+
* const auth = createAuth({ baseURL: 'https://api.example.com' })
|
|
13
|
+
*
|
|
14
|
+
* // 响应式读取状态
|
|
15
|
+
* const user = use$(auth.authStore.user)
|
|
16
|
+
*
|
|
17
|
+
* // 业务操作
|
|
18
|
+
* await auth.authService.signInWithEmail(email, password)
|
|
19
|
+
*
|
|
20
|
+
* // 状态更新
|
|
21
|
+
* auth.storeActions.setUser(user)
|
|
22
|
+
* ```
|
|
3
23
|
*/
|
|
4
|
-
import type { AuthConfig } from "./types";
|
|
24
|
+
import type { AuthConfig, Organization, SetActiveOrganizationRequest, SetActiveTeamRequest } from "./types";
|
|
5
25
|
export declare function createAuth(config: AuthConfig): {
|
|
6
|
-
getCurrentUser: () => import("./types").SessionUser | null;
|
|
7
|
-
getCurrentUserId: () => string | null;
|
|
8
|
-
isAuthenticated: () => boolean;
|
|
9
|
-
isLoading: () => boolean;
|
|
10
|
-
isLoaded: () => boolean;
|
|
11
|
-
waitForAuth: () => Promise<void>;
|
|
12
|
-
getAuthToken: () => Promise<string | null>;
|
|
13
|
-
getAuthTokenSync: () => string | null;
|
|
14
|
-
getAuthHeaders: () => Promise<Record<string, string>>;
|
|
15
|
-
getAuthHeadersSync: () => Record<string, string>;
|
|
16
26
|
apiClient: {
|
|
17
27
|
get<T = unknown>(path: string, options?: RequestInit): Promise<import("./api").ApiResponse<T>>;
|
|
18
28
|
post<T = unknown>(path: string, body?: unknown, options?: RequestInit): Promise<import("./api").ApiResponse<T>>;
|
|
@@ -20,37 +30,132 @@ export declare function createAuth(config: AuthConfig): {
|
|
|
20
30
|
delete<T = unknown>(path: string, options?: RequestInit): Promise<import("./api").ApiResponse<T>>;
|
|
21
31
|
fetch(path: string, options?: RequestInit): Promise<Response>;
|
|
22
32
|
};
|
|
23
|
-
userManager: {
|
|
24
|
-
getUser: () => import("./types").SessionUser | null;
|
|
25
|
-
getUserId: () => string | null;
|
|
26
|
-
};
|
|
27
|
-
authActions: {
|
|
28
|
-
initialize(user: import("./types").SessionUser | null, isLoaded: boolean): Promise<void>;
|
|
29
|
-
fetchSessionWithToken(token: string): Promise<void>;
|
|
30
|
-
handleUnauthorized(): void;
|
|
31
|
-
setLoading(loading: boolean): void;
|
|
32
|
-
setError(error: string | null): void;
|
|
33
|
-
signIn(provider: string, callbackURL: string, newUserCallbackURL?: string, errorCallbackURL?: string): Promise<void>;
|
|
34
|
-
signInWithMagicLink(email: string, callbackURL: string, name?: string, newUserCallbackURL?: string): Promise<boolean>;
|
|
35
|
-
signInWithEmail(email: string, password: string): Promise<boolean>;
|
|
36
|
-
signUpWithEmail(email: string, password: string, name: string): Promise<boolean>;
|
|
37
|
-
signOut(redirectTo?: string): Promise<void>;
|
|
38
|
-
updateUser(user: import("./types").SessionUser | null): void;
|
|
39
|
-
getUser(): import("./types").SessionUser | null;
|
|
40
|
-
};
|
|
41
33
|
authApi: {
|
|
42
|
-
getSession(
|
|
34
|
+
getSession(): Promise<import("./types").SessionUser | null>;
|
|
43
35
|
getSessionWithToken(token: string): Promise<import("./types").SessionUser | null>;
|
|
44
|
-
setActiveOrganization(params: import("./types").SetActiveOrganizationRequest, token?: string): Promise<void>;
|
|
45
|
-
setActiveTeam(params: import("./types").SetActiveTeamRequest, token?: string): Promise<void>;
|
|
46
36
|
onboard(token: string): Promise<void>;
|
|
47
37
|
updateUser(data: import("./types").UpdateUserRequest): Promise<import("./types").SessionUser | null>;
|
|
48
38
|
sendMagicLink(params: import("./types").MagicLinkRequest): Promise<{
|
|
49
39
|
status: boolean;
|
|
50
40
|
}>;
|
|
51
|
-
|
|
41
|
+
resendVerificationEmail(email: string, callbackURL?: string): Promise<{
|
|
42
|
+
status: boolean;
|
|
43
|
+
}>;
|
|
52
44
|
checkEmailExists(email: string): Promise<boolean>;
|
|
45
|
+
linkCredential(newPassword: string, token?: string): Promise<void>;
|
|
46
|
+
changePassword(currentPassword: string, newPassword: string, token?: string): Promise<{
|
|
47
|
+
success: boolean;
|
|
48
|
+
}>;
|
|
49
|
+
changeEmail(newEmail: string, callbackURL?: string, token?: string): Promise<{
|
|
50
|
+
success: boolean;
|
|
51
|
+
}>;
|
|
52
|
+
listAccounts(token?: string): Promise<import("./types").Account[]>;
|
|
53
|
+
getOAuthAccountInfo(accountId: string, token?: string): Promise<import("./types").OAuthAccountInfo | null>;
|
|
54
|
+
unlinkAccount(providerId: string, accountId?: string, token?: string): Promise<{
|
|
55
|
+
success: boolean;
|
|
56
|
+
}>;
|
|
57
|
+
deleteUser(password?: string, callbackURL?: string, token?: string): Promise<{
|
|
58
|
+
message: string;
|
|
59
|
+
success: boolean;
|
|
60
|
+
}>;
|
|
61
|
+
listSessions(token?: string): Promise<import("./types").UserSession[]>;
|
|
62
|
+
revokeSession(params: import("./types").RevokeSessionRequest, token?: string): Promise<{
|
|
63
|
+
success: boolean;
|
|
64
|
+
}>;
|
|
65
|
+
};
|
|
66
|
+
organizationApi: {
|
|
67
|
+
create(request: import("./types").CreateOrganizationRequest): Promise<Organization>;
|
|
68
|
+
update(request: import("./types").UpdateOrganizationRequest): Promise<Organization>;
|
|
69
|
+
delete(request: import("./types").DeleteOrganizationRequest): Promise<string>;
|
|
70
|
+
list(): Promise<Organization[]>;
|
|
71
|
+
getFullOrganization(): Promise<import("./types").FullOrganization | null>;
|
|
72
|
+
checkSlug(request: import("./types").CheckSlugRequest): Promise<boolean>;
|
|
73
|
+
getActiveMember(): Promise<import("./types").Member | null>;
|
|
74
|
+
getActiveMemberRole(): Promise<{
|
|
75
|
+
role: string;
|
|
76
|
+
} | null>;
|
|
77
|
+
removeMember(request: import("./types").RemoveMemberRequest): Promise<import("./types").Member>;
|
|
78
|
+
updateMemberRole(request: import("./types").UpdateMemberRoleRequest): Promise<import("./types").Member>;
|
|
79
|
+
inviteMember(request: import("./types").InviteMemberRequest): Promise<import("./types").Invitation>;
|
|
80
|
+
listInvitations(): Promise<import("./types").Invitation[]>;
|
|
81
|
+
getInvitation(invitationId: string): Promise<import("./types").InvitationDetail | null>;
|
|
82
|
+
cancelInvitation(request: import("./types").CancelInvitationRequest): Promise<void>;
|
|
83
|
+
acceptInvitation(request: import("./types").AcceptInvitationRequest): Promise<import("./types").InvitationResponse>;
|
|
84
|
+
rejectInvitation(request: import("./types").RejectInvitationRequest): Promise<import("./types").InvitationResponse>;
|
|
85
|
+
leave(organizationId: string): Promise<void>;
|
|
86
|
+
};
|
|
87
|
+
teamApi: {
|
|
88
|
+
create(request: import("./types").CreateTeamRequest): Promise<import("./types").Team>;
|
|
89
|
+
list(): Promise<import("./types").Team[]>;
|
|
90
|
+
update(request: import("./types").UpdateTeamRequest): Promise<import("./types").Team>;
|
|
91
|
+
delete(request: import("./types").DeleteTeamRequest): Promise<void>;
|
|
92
|
+
listUserTeams(): Promise<import("./types").Team[]>;
|
|
93
|
+
listMembers(teamId: string): Promise<import("./types").TeamMember[]>;
|
|
94
|
+
addMember(request: import("./types").AddTeamMemberRequest): Promise<import("./types").TeamMember>;
|
|
95
|
+
removeMember(request: import("./types").RemoveTeamMemberRequest): Promise<void>;
|
|
96
|
+
leaveTeam(teamId: string): Promise<void>;
|
|
53
97
|
};
|
|
98
|
+
authStore: import("@legendapp/state").Observable<import("./types").AuthState>;
|
|
99
|
+
authComputed: {
|
|
100
|
+
isInitializing: import("@legendapp/state").ObservableBoolean;
|
|
101
|
+
isReady: import("@legendapp/state").ObservableBoolean;
|
|
102
|
+
isUnauthenticated: import("@legendapp/state").ObservableBoolean;
|
|
103
|
+
hasError: import("@legendapp/state").ObservableBoolean;
|
|
104
|
+
userId: import("@legendapp/state").ObservablePrimitive<string | null>;
|
|
105
|
+
userEmail: import("@legendapp/state").ObservablePrimitive<string | null>;
|
|
106
|
+
userName: import("@legendapp/state").ObservablePrimitive<string | null>;
|
|
107
|
+
userImage: import("@legendapp/state").ObservablePrimitive<string | null>;
|
|
108
|
+
emailVerified: import("@legendapp/state").ObservableBoolean;
|
|
109
|
+
activeOrganizationId: import("@legendapp/state").ObservablePrimitive<string | null>;
|
|
110
|
+
activeTeamId: import("@legendapp/state").ObservablePrimitive<string | null>;
|
|
111
|
+
inherentOrganizationId: import("@legendapp/state").ObservablePrimitive<string | null>;
|
|
112
|
+
inherentTeamId: import("@legendapp/state").ObservablePrimitive<string | null>;
|
|
113
|
+
hasActiveOrganization: import("@legendapp/state").ObservableBoolean;
|
|
114
|
+
hasActiveTeam: import("@legendapp/state").ObservableBoolean;
|
|
115
|
+
isInInherentOrganization: import("@legendapp/state").ObservableBoolean;
|
|
116
|
+
isInInherentTeam: import("@legendapp/state").ObservableBoolean;
|
|
117
|
+
};
|
|
118
|
+
tokenStorage: import("./api").TokenStorage;
|
|
119
|
+
storeActions: {
|
|
120
|
+
getUser(): import("./types").SessionUser | null;
|
|
121
|
+
getUserId(): string | null;
|
|
122
|
+
isAuthenticated(): boolean;
|
|
123
|
+
isLoading(): boolean;
|
|
124
|
+
isLoaded(): boolean;
|
|
125
|
+
setUser(user: import("./types").SessionUser | null): void;
|
|
126
|
+
updateUser(updates: Partial<import("./types").SessionUser>): void;
|
|
127
|
+
setLoading(loading: boolean): void;
|
|
128
|
+
setLoaded(loaded: boolean): void;
|
|
129
|
+
setError(error: string | null): void;
|
|
130
|
+
setAuthenticated(user: import("./types").SessionUser): void;
|
|
131
|
+
clearAuth(): void;
|
|
132
|
+
handleUnauthorized(): void;
|
|
133
|
+
setActiveOrganizationId(organizationId: string | null | undefined): void;
|
|
134
|
+
setActiveTeamId(teamId: string | null | undefined): void;
|
|
135
|
+
initialize(user: import("./types").SessionUser | null, isLoaded: boolean): void;
|
|
136
|
+
};
|
|
137
|
+
authService: {
|
|
138
|
+
fetchAndSetSession: (token: string) => Promise<import("./types").SessionUser | null>;
|
|
139
|
+
signInWithOAuth: (provider: string, callbackURL: string, newUserCallbackURL?: string, errorCallbackURL?: string) => Promise<void>;
|
|
140
|
+
signInWithMagicLink: (email: string, callbackURL: string, name?: string, newUserCallbackURL?: string) => Promise<boolean>;
|
|
141
|
+
signInWithEmail: (email: string, password: string) => Promise<{
|
|
142
|
+
emailVerified?: boolean;
|
|
143
|
+
success: boolean;
|
|
144
|
+
}>;
|
|
145
|
+
signUpWithEmail: (email: string, password: string, name: string, callbackURL?: string) => Promise<{
|
|
146
|
+
emailVerified?: boolean;
|
|
147
|
+
success: boolean;
|
|
148
|
+
}>;
|
|
149
|
+
signOut: (redirectTo?: string) => Promise<void>;
|
|
150
|
+
deleteUser: (callbackURL: string, password?: string) => Promise<{
|
|
151
|
+
needsVerification: boolean;
|
|
152
|
+
success: boolean;
|
|
153
|
+
}>;
|
|
154
|
+
};
|
|
155
|
+
referralService: import("./services").ReferralService;
|
|
156
|
+
setActiveOrganization: (request: SetActiveOrganizationRequest) => Promise<Organization>;
|
|
157
|
+
setActiveTeam: (request: SetActiveTeamRequest) => Promise<void>;
|
|
158
|
+
setActiveOrganizationAndTeam: (organizationId: string, teamId: string) => Promise<Organization>;
|
|
54
159
|
authClient: {
|
|
55
160
|
signIn: {
|
|
56
161
|
social: <FetchOptions extends import("better-auth").ClientFetchOption<Partial<{
|
|
@@ -70,7 +175,7 @@ export declare function createAuth(config: AuthConfig): {
|
|
|
70
175
|
requestSignUp?: boolean | undefined;
|
|
71
176
|
loginHint?: string | undefined;
|
|
72
177
|
additionalData?: Record<string, any> | undefined;
|
|
73
|
-
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth
|
|
178
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth").Prettify<{
|
|
74
179
|
provider: (string & {}) | "github" | "apple" | "atlassian" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "huggingface" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linear" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "vercel";
|
|
75
180
|
callbackURL?: string | undefined;
|
|
76
181
|
newUserCallbackURL?: string | undefined;
|
|
@@ -89,7 +194,7 @@ export declare function createAuth(config: AuthConfig): {
|
|
|
89
194
|
additionalData?: Record<string, any> | undefined;
|
|
90
195
|
} & {
|
|
91
196
|
fetchOptions?: FetchOptions | undefined;
|
|
92
|
-
}>, data_1?: FetchOptions | undefined) => Promise<import("
|
|
197
|
+
}>, data_1?: FetchOptions | undefined) => Promise<import("better-auth/client").BetterFetchResponse<NonNullable<{
|
|
93
198
|
redirect: boolean;
|
|
94
199
|
url: string;
|
|
95
200
|
} | {
|
|
@@ -111,10 +216,10 @@ export declare function createAuth(config: AuthConfig): {
|
|
|
111
216
|
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
112
217
|
};
|
|
113
218
|
} & {
|
|
114
|
-
signOut: <FetchOptions extends import("better-auth").ClientFetchOption<never, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import("better-auth
|
|
219
|
+
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<{
|
|
115
220
|
query?: Record<string, any> | undefined;
|
|
116
221
|
fetchOptions?: FetchOptions | undefined;
|
|
117
|
-
}> | undefined, data_1?: FetchOptions | undefined) => Promise<import("
|
|
222
|
+
}> | undefined, data_1?: FetchOptions | undefined) => Promise<import("better-auth/client").BetterFetchResponse<{
|
|
118
223
|
success: boolean;
|
|
119
224
|
}, {
|
|
120
225
|
code?: string | undefined;
|
|
@@ -129,14 +234,14 @@ export declare function createAuth(config: AuthConfig): {
|
|
|
129
234
|
image?: string | undefined;
|
|
130
235
|
callbackURL?: string | undefined;
|
|
131
236
|
rememberMe?: boolean | undefined;
|
|
132
|
-
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth
|
|
237
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth").Prettify<{
|
|
133
238
|
email: string;
|
|
134
239
|
name: string;
|
|
135
240
|
password: string;
|
|
136
241
|
image?: string | undefined;
|
|
137
242
|
callbackURL?: string | undefined;
|
|
138
243
|
fetchOptions?: FetchOptions | undefined;
|
|
139
|
-
}>, data_1?: FetchOptions | undefined) => Promise<import("
|
|
244
|
+
}>, data_1?: FetchOptions | undefined) => Promise<import("better-auth/client").BetterFetchResponse<NonNullable<{
|
|
140
245
|
token: null;
|
|
141
246
|
user: {
|
|
142
247
|
id: string;
|
|
@@ -170,14 +275,14 @@ export declare function createAuth(config: AuthConfig): {
|
|
|
170
275
|
password: string;
|
|
171
276
|
callbackURL?: string | undefined;
|
|
172
277
|
rememberMe?: boolean | undefined;
|
|
173
|
-
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth
|
|
278
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth").Prettify<{
|
|
174
279
|
email: string;
|
|
175
280
|
password: string;
|
|
176
281
|
callbackURL?: string | undefined;
|
|
177
282
|
rememberMe?: boolean | undefined;
|
|
178
283
|
} & {
|
|
179
284
|
fetchOptions?: FetchOptions | undefined;
|
|
180
|
-
}>, data_1?: FetchOptions | undefined) => Promise<import("
|
|
285
|
+
}>, data_1?: FetchOptions | undefined) => Promise<import("better-auth/client").BetterFetchResponse<{
|
|
181
286
|
redirect: boolean;
|
|
182
287
|
token: string;
|
|
183
288
|
url?: string | undefined;
|
|
@@ -201,12 +306,12 @@ export declare function createAuth(config: AuthConfig): {
|
|
|
201
306
|
token?: string | undefined;
|
|
202
307
|
}> & Record<string, any>, Partial<{
|
|
203
308
|
token?: string | undefined;
|
|
204
|
-
}> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth
|
|
309
|
+
}> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth").Prettify<{
|
|
205
310
|
newPassword: string;
|
|
206
311
|
token?: string | undefined;
|
|
207
312
|
} & {
|
|
208
313
|
fetchOptions?: FetchOptions | undefined;
|
|
209
|
-
}>, data_1?: FetchOptions | undefined) => Promise<import("
|
|
314
|
+
}>, data_1?: FetchOptions | undefined) => Promise<import("better-auth/client").BetterFetchResponse<{
|
|
210
315
|
status: boolean;
|
|
211
316
|
}, {
|
|
212
317
|
code?: string | undefined;
|
|
@@ -216,13 +321,13 @@ export declare function createAuth(config: AuthConfig): {
|
|
|
216
321
|
verifyEmail: <FetchOptions extends import("better-auth").ClientFetchOption<never, Partial<{
|
|
217
322
|
token: string;
|
|
218
323
|
callbackURL?: string | undefined;
|
|
219
|
-
}> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth
|
|
324
|
+
}> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth").Prettify<{
|
|
220
325
|
query: {
|
|
221
326
|
token: string;
|
|
222
327
|
callbackURL?: string | undefined;
|
|
223
328
|
};
|
|
224
329
|
fetchOptions?: FetchOptions | undefined;
|
|
225
|
-
}>, data_1?: FetchOptions | undefined) => Promise<import("
|
|
330
|
+
}>, data_1?: FetchOptions | undefined) => Promise<import("better-auth/client").BetterFetchResponse<NonNullable<void | {
|
|
226
331
|
status: boolean;
|
|
227
332
|
}>, {
|
|
228
333
|
code?: string | undefined;
|
|
@@ -232,12 +337,12 @@ export declare function createAuth(config: AuthConfig): {
|
|
|
232
337
|
sendVerificationEmail: <FetchOptions extends import("better-auth").ClientFetchOption<Partial<{
|
|
233
338
|
email: string;
|
|
234
339
|
callbackURL?: string | undefined;
|
|
235
|
-
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth
|
|
340
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth").Prettify<{
|
|
236
341
|
email: string;
|
|
237
342
|
callbackURL?: string | undefined;
|
|
238
343
|
} & {
|
|
239
344
|
fetchOptions?: FetchOptions | undefined;
|
|
240
|
-
}>, data_1?: FetchOptions | undefined) => Promise<import("
|
|
345
|
+
}>, data_1?: FetchOptions | undefined) => Promise<import("better-auth/client").BetterFetchResponse<{
|
|
241
346
|
status: boolean;
|
|
242
347
|
}, {
|
|
243
348
|
code?: string | undefined;
|
|
@@ -247,12 +352,12 @@ export declare function createAuth(config: AuthConfig): {
|
|
|
247
352
|
changeEmail: <FetchOptions extends import("better-auth").ClientFetchOption<Partial<{
|
|
248
353
|
newEmail: string;
|
|
249
354
|
callbackURL?: string | undefined;
|
|
250
|
-
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth
|
|
355
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth").Prettify<{
|
|
251
356
|
newEmail: string;
|
|
252
357
|
callbackURL?: string | undefined;
|
|
253
358
|
} & {
|
|
254
359
|
fetchOptions?: FetchOptions | undefined;
|
|
255
|
-
}>, data_1?: FetchOptions | undefined) => Promise<import("
|
|
360
|
+
}>, data_1?: FetchOptions | undefined) => Promise<import("better-auth/client").BetterFetchResponse<{
|
|
256
361
|
status: boolean;
|
|
257
362
|
}, {
|
|
258
363
|
code?: string | undefined;
|
|
@@ -263,13 +368,13 @@ export declare function createAuth(config: AuthConfig): {
|
|
|
263
368
|
newPassword: string;
|
|
264
369
|
currentPassword: string;
|
|
265
370
|
revokeOtherSessions?: boolean | undefined;
|
|
266
|
-
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth
|
|
371
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth").Prettify<{
|
|
267
372
|
newPassword: string;
|
|
268
373
|
currentPassword: string;
|
|
269
374
|
revokeOtherSessions?: boolean | undefined;
|
|
270
375
|
} & {
|
|
271
376
|
fetchOptions?: FetchOptions | undefined;
|
|
272
|
-
}>, data_1?: FetchOptions | undefined) => Promise<import("
|
|
377
|
+
}>, data_1?: FetchOptions | undefined) => Promise<import("better-auth/client").BetterFetchResponse<{
|
|
273
378
|
token: string | null;
|
|
274
379
|
user: {
|
|
275
380
|
id: string;
|
|
@@ -287,12 +392,12 @@ export declare function createAuth(config: AuthConfig): {
|
|
|
287
392
|
} & {
|
|
288
393
|
updateUser: <FetchOptions extends import("better-auth").ClientFetchOption<Partial<Partial<{}> & {
|
|
289
394
|
name?: string | undefined;
|
|
290
|
-
image?: string | undefined;
|
|
291
|
-
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import("better-auth
|
|
395
|
+
image?: string | undefined | null;
|
|
396
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import("better-auth").Prettify<{
|
|
292
397
|
image?: (string | null) | undefined;
|
|
293
398
|
name?: string | undefined;
|
|
294
399
|
fetchOptions?: FetchOptions | undefined;
|
|
295
|
-
} & Partial<{}>> | undefined, data_1?: FetchOptions | undefined) => Promise<import("
|
|
400
|
+
} & Partial<{}>> | undefined, data_1?: FetchOptions | undefined) => Promise<import("better-auth/client").BetterFetchResponse<{
|
|
296
401
|
status: boolean;
|
|
297
402
|
}, {
|
|
298
403
|
code?: string | undefined;
|
|
@@ -303,13 +408,13 @@ export declare function createAuth(config: AuthConfig): {
|
|
|
303
408
|
callbackURL?: string | undefined;
|
|
304
409
|
password?: string | undefined;
|
|
305
410
|
token?: string | undefined;
|
|
306
|
-
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import("better-auth
|
|
411
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import("better-auth").Prettify<{
|
|
307
412
|
callbackURL?: string | undefined;
|
|
308
413
|
password?: string | undefined;
|
|
309
414
|
token?: string | undefined;
|
|
310
415
|
} & {
|
|
311
416
|
fetchOptions?: FetchOptions | undefined;
|
|
312
|
-
}> | undefined, data_1?: FetchOptions | undefined) => Promise<import("
|
|
417
|
+
}> | undefined, data_1?: FetchOptions | undefined) => Promise<import("better-auth/client").BetterFetchResponse<{
|
|
313
418
|
success: boolean;
|
|
314
419
|
message: string;
|
|
315
420
|
}, {
|
|
@@ -320,12 +425,12 @@ export declare function createAuth(config: AuthConfig): {
|
|
|
320
425
|
requestPasswordReset: <FetchOptions extends import("better-auth").ClientFetchOption<Partial<{
|
|
321
426
|
email: string;
|
|
322
427
|
redirectTo?: string | undefined;
|
|
323
|
-
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth
|
|
428
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth").Prettify<{
|
|
324
429
|
email: string;
|
|
325
430
|
redirectTo?: string | undefined;
|
|
326
431
|
} & {
|
|
327
432
|
fetchOptions?: FetchOptions | undefined;
|
|
328
|
-
}>, data_1?: FetchOptions | undefined) => Promise<import("
|
|
433
|
+
}>, data_1?: FetchOptions | undefined) => Promise<import("better-auth/client").BetterFetchResponse<{
|
|
329
434
|
status: boolean;
|
|
330
435
|
message: string;
|
|
331
436
|
}, {
|
|
@@ -338,21 +443,21 @@ export declare function createAuth(config: AuthConfig): {
|
|
|
338
443
|
callbackURL: string;
|
|
339
444
|
}> & Record<string, any>, {
|
|
340
445
|
token: string;
|
|
341
|
-
}>>(data_0: import("better-auth
|
|
446
|
+
}>>(data_0: import("better-auth").Prettify<{
|
|
342
447
|
query: {
|
|
343
448
|
callbackURL: string;
|
|
344
449
|
};
|
|
345
450
|
fetchOptions?: FetchOptions | undefined;
|
|
346
|
-
}>, data_1?: FetchOptions | undefined) => Promise<import("
|
|
451
|
+
}>, data_1?: FetchOptions | undefined) => Promise<import("better-auth/client").BetterFetchResponse<never, {
|
|
347
452
|
code?: string | undefined;
|
|
348
453
|
message?: string | undefined;
|
|
349
454
|
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
350
455
|
};
|
|
351
456
|
} & {
|
|
352
|
-
listSessions: <FetchOptions extends import("better-auth").ClientFetchOption<never, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import("better-auth
|
|
457
|
+
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<{
|
|
353
458
|
query?: Record<string, any> | undefined;
|
|
354
459
|
fetchOptions?: FetchOptions | undefined;
|
|
355
|
-
}> | undefined, data_1?: FetchOptions | undefined) => Promise<import("
|
|
460
|
+
}> | undefined, data_1?: FetchOptions | undefined) => Promise<import("better-auth/client").BetterFetchResponse<import("better-auth").Prettify<{
|
|
356
461
|
id: string;
|
|
357
462
|
createdAt: Date;
|
|
358
463
|
updatedAt: Date;
|
|
@@ -368,31 +473,31 @@ export declare function createAuth(config: AuthConfig): {
|
|
|
368
473
|
} & {
|
|
369
474
|
revokeSession: <FetchOptions extends import("better-auth").ClientFetchOption<Partial<{
|
|
370
475
|
token: string;
|
|
371
|
-
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth
|
|
476
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth").Prettify<{
|
|
372
477
|
token: string;
|
|
373
478
|
} & {
|
|
374
479
|
fetchOptions?: FetchOptions | undefined;
|
|
375
|
-
}>, data_1?: FetchOptions | undefined) => Promise<import("
|
|
480
|
+
}>, data_1?: FetchOptions | undefined) => Promise<import("better-auth/client").BetterFetchResponse<{
|
|
376
481
|
status: boolean;
|
|
377
482
|
}, {
|
|
378
483
|
code?: string | undefined;
|
|
379
484
|
message?: string | undefined;
|
|
380
485
|
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
381
486
|
} & {
|
|
382
|
-
revokeSessions: <FetchOptions extends import("better-auth").ClientFetchOption<never, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import("better-auth
|
|
487
|
+
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<{
|
|
383
488
|
query?: Record<string, any> | undefined;
|
|
384
489
|
fetchOptions?: FetchOptions | undefined;
|
|
385
|
-
}> | undefined, data_1?: FetchOptions | undefined) => Promise<import("
|
|
490
|
+
}> | undefined, data_1?: FetchOptions | undefined) => Promise<import("better-auth/client").BetterFetchResponse<{
|
|
386
491
|
status: boolean;
|
|
387
492
|
}, {
|
|
388
493
|
code?: string | undefined;
|
|
389
494
|
message?: string | undefined;
|
|
390
495
|
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
391
496
|
} & {
|
|
392
|
-
revokeOtherSessions: <FetchOptions extends import("better-auth").ClientFetchOption<never, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import("better-auth
|
|
497
|
+
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<{
|
|
393
498
|
query?: Record<string, any> | undefined;
|
|
394
499
|
fetchOptions?: FetchOptions | undefined;
|
|
395
|
-
}> | undefined, data_1?: FetchOptions | undefined) => Promise<import("
|
|
500
|
+
}> | undefined, data_1?: FetchOptions | undefined) => Promise<import("better-auth/client").BetterFetchResponse<{
|
|
396
501
|
status: boolean;
|
|
397
502
|
}, {
|
|
398
503
|
code?: string | undefined;
|
|
@@ -414,7 +519,7 @@ export declare function createAuth(config: AuthConfig): {
|
|
|
414
519
|
errorCallbackURL?: string | undefined;
|
|
415
520
|
disableRedirect?: boolean | undefined;
|
|
416
521
|
additionalData?: Record<string, any> | undefined;
|
|
417
|
-
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth
|
|
522
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth").Prettify<{
|
|
418
523
|
provider: unknown;
|
|
419
524
|
callbackURL?: string | undefined;
|
|
420
525
|
idToken?: {
|
|
@@ -431,7 +536,7 @@ export declare function createAuth(config: AuthConfig): {
|
|
|
431
536
|
additionalData?: Record<string, any> | undefined;
|
|
432
537
|
} & {
|
|
433
538
|
fetchOptions?: FetchOptions | undefined;
|
|
434
|
-
}>, data_1?: FetchOptions | undefined) => Promise<import("
|
|
539
|
+
}>, data_1?: FetchOptions | undefined) => Promise<import("better-auth/client").BetterFetchResponse<{
|
|
435
540
|
url: string;
|
|
436
541
|
redirect: boolean;
|
|
437
542
|
}, {
|
|
@@ -439,10 +544,10 @@ export declare function createAuth(config: AuthConfig): {
|
|
|
439
544
|
message?: string | undefined;
|
|
440
545
|
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
441
546
|
} & {
|
|
442
|
-
listAccounts: <FetchOptions extends import("better-auth").ClientFetchOption<never, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import("better-auth
|
|
547
|
+
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<{
|
|
443
548
|
query?: Record<string, any> | undefined;
|
|
444
549
|
fetchOptions?: FetchOptions | undefined;
|
|
445
|
-
}> | undefined, data_1?: FetchOptions | undefined) => Promise<import("
|
|
550
|
+
}> | undefined, data_1?: FetchOptions | undefined) => Promise<import("better-auth/client").BetterFetchResponse<{
|
|
446
551
|
id: string;
|
|
447
552
|
providerId: string;
|
|
448
553
|
createdAt: Date;
|
|
@@ -459,13 +564,13 @@ export declare function createAuth(config: AuthConfig): {
|
|
|
459
564
|
callback: <FetchOptions extends import("better-auth").ClientFetchOption<never, Partial<{
|
|
460
565
|
token: string;
|
|
461
566
|
callbackURL?: string | undefined;
|
|
462
|
-
}> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth
|
|
567
|
+
}> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth").Prettify<{
|
|
463
568
|
query: {
|
|
464
569
|
token: string;
|
|
465
570
|
callbackURL?: string | undefined;
|
|
466
571
|
};
|
|
467
572
|
fetchOptions?: FetchOptions | undefined;
|
|
468
|
-
}>, data_1?: FetchOptions | undefined) => Promise<import("
|
|
573
|
+
}>, data_1?: FetchOptions | undefined) => Promise<import("better-auth/client").BetterFetchResponse<{
|
|
469
574
|
success: boolean;
|
|
470
575
|
message: string;
|
|
471
576
|
}, {
|
|
@@ -477,12 +582,12 @@ export declare function createAuth(config: AuthConfig): {
|
|
|
477
582
|
unlinkAccount: <FetchOptions extends import("better-auth").ClientFetchOption<Partial<{
|
|
478
583
|
providerId: string;
|
|
479
584
|
accountId?: string | undefined;
|
|
480
|
-
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth
|
|
585
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth").Prettify<{
|
|
481
586
|
providerId: string;
|
|
482
587
|
accountId?: string | undefined;
|
|
483
588
|
} & {
|
|
484
589
|
fetchOptions?: FetchOptions | undefined;
|
|
485
|
-
}>, data_1?: FetchOptions | undefined) => Promise<import("
|
|
590
|
+
}>, data_1?: FetchOptions | undefined) => Promise<import("better-auth/client").BetterFetchResponse<{
|
|
486
591
|
status: boolean;
|
|
487
592
|
}, {
|
|
488
593
|
code?: string | undefined;
|
|
@@ -493,13 +598,13 @@ export declare function createAuth(config: AuthConfig): {
|
|
|
493
598
|
providerId: string;
|
|
494
599
|
accountId?: string | undefined;
|
|
495
600
|
userId?: string | undefined;
|
|
496
|
-
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth
|
|
601
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth").Prettify<{
|
|
497
602
|
providerId: string;
|
|
498
603
|
accountId?: string | undefined;
|
|
499
604
|
userId?: string | undefined;
|
|
500
605
|
} & {
|
|
501
606
|
fetchOptions?: FetchOptions | undefined;
|
|
502
|
-
}>, data_1?: FetchOptions | undefined) => Promise<import("
|
|
607
|
+
}>, data_1?: FetchOptions | undefined) => Promise<import("better-auth/client").BetterFetchResponse<{
|
|
503
608
|
accessToken: string | undefined;
|
|
504
609
|
refreshToken: string | undefined;
|
|
505
610
|
accessTokenExpiresAt: Date | undefined;
|
|
@@ -517,13 +622,13 @@ export declare function createAuth(config: AuthConfig): {
|
|
|
517
622
|
providerId: string;
|
|
518
623
|
accountId?: string | undefined;
|
|
519
624
|
userId?: string | undefined;
|
|
520
|
-
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth
|
|
625
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth").Prettify<{
|
|
521
626
|
providerId: string;
|
|
522
627
|
accountId?: string | undefined;
|
|
523
628
|
userId?: string | undefined;
|
|
524
629
|
} & {
|
|
525
630
|
fetchOptions?: FetchOptions | undefined;
|
|
526
|
-
}>, data_1?: FetchOptions | undefined) => Promise<import("
|
|
631
|
+
}>, data_1?: FetchOptions | undefined) => Promise<import("better-auth/client").BetterFetchResponse<{
|
|
527
632
|
accessToken: string;
|
|
528
633
|
accessTokenExpiresAt: Date | undefined;
|
|
529
634
|
scopes: string[];
|
|
@@ -535,12 +640,12 @@ export declare function createAuth(config: AuthConfig): {
|
|
|
535
640
|
} & {
|
|
536
641
|
accountInfo: <FetchOptions extends import("better-auth").ClientFetchOption<never, Partial<{
|
|
537
642
|
accountId?: string | undefined;
|
|
538
|
-
}> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import("better-auth
|
|
643
|
+
}> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import("better-auth").Prettify<{
|
|
539
644
|
query?: {
|
|
540
645
|
accountId?: string | undefined;
|
|
541
646
|
} | undefined;
|
|
542
647
|
fetchOptions?: FetchOptions | undefined;
|
|
543
|
-
}> | undefined, data_1?: FetchOptions | undefined) => Promise<import("
|
|
648
|
+
}> | undefined, data_1?: FetchOptions | undefined) => Promise<import("better-auth/client").BetterFetchResponse<{
|
|
544
649
|
user: import("better-auth").OAuth2UserInfo;
|
|
545
650
|
data: Record<string, any>;
|
|
546
651
|
}, {
|
|
@@ -551,13 +656,13 @@ export declare function createAuth(config: AuthConfig): {
|
|
|
551
656
|
getSession: <FetchOptions extends import("better-auth").ClientFetchOption<never, Partial<{
|
|
552
657
|
disableCookieCache?: unknown;
|
|
553
658
|
disableRefresh?: unknown;
|
|
554
|
-
}> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import("better-auth
|
|
659
|
+
}> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import("better-auth").Prettify<{
|
|
555
660
|
query?: {
|
|
556
661
|
disableCookieCache?: unknown;
|
|
557
662
|
disableRefresh?: unknown;
|
|
558
663
|
} | undefined;
|
|
559
664
|
fetchOptions?: FetchOptions | undefined;
|
|
560
|
-
}> | undefined, data_1?: FetchOptions | undefined) => Promise<import("
|
|
665
|
+
}> | undefined, data_1?: FetchOptions | undefined) => Promise<import("better-auth/client").BetterFetchResponse<{
|
|
561
666
|
user: {
|
|
562
667
|
id: string;
|
|
563
668
|
createdAt: Date;
|
|
@@ -606,7 +711,7 @@ export declare function createAuth(config: AuthConfig): {
|
|
|
606
711
|
} | null;
|
|
607
712
|
isPending: boolean;
|
|
608
713
|
isRefetching: boolean;
|
|
609
|
-
error: import("
|
|
714
|
+
error: import("better-auth/client").BetterFetchError | null;
|
|
610
715
|
refetch: (queryParams?: {
|
|
611
716
|
query?: import("better-auth").SessionQueryParams;
|
|
612
717
|
} | undefined) => Promise<void>;
|
|
@@ -634,21 +739,21 @@ export declare function createAuth(config: AuthConfig): {
|
|
|
634
739
|
};
|
|
635
740
|
};
|
|
636
741
|
};
|
|
637
|
-
$fetch: import("
|
|
638
|
-
plugins: (import("
|
|
742
|
+
$fetch: import("better-auth/client").BetterFetch<{
|
|
743
|
+
plugins: (import("better-auth/client").BetterFetchPlugin<Record<string, any>> | {
|
|
639
744
|
id: string;
|
|
640
745
|
name: string;
|
|
641
746
|
hooks: {
|
|
642
|
-
onSuccess(context: import("
|
|
747
|
+
onSuccess(context: import("better-auth/client").SuccessContext<any>): void;
|
|
643
748
|
};
|
|
644
749
|
} | {
|
|
645
750
|
id: string;
|
|
646
751
|
name: string;
|
|
647
752
|
hooks: {
|
|
648
|
-
onSuccess: ((context: import("
|
|
649
|
-
onError: ((context: import("
|
|
650
|
-
onRequest: (<T extends Record<string, any>>(context: import("
|
|
651
|
-
onResponse: ((context: import("
|
|
753
|
+
onSuccess: ((context: import("better-auth/client").SuccessContext<any>) => Promise<void> | void) | undefined;
|
|
754
|
+
onError: ((context: import("better-auth/client").ErrorContext) => Promise<void> | void) | undefined;
|
|
755
|
+
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;
|
|
756
|
+
onResponse: ((context: import("better-auth/client").ResponseContext) => Promise<Response | void | import("better-auth/client").ResponseContext> | Response | import("better-auth/client").ResponseContext | void) | undefined;
|
|
652
757
|
};
|
|
653
758
|
})[];
|
|
654
759
|
cache?: RequestCache | undefined;
|
|
@@ -668,12 +773,12 @@ export declare function createAuth(config: AuthConfig): {
|
|
|
668
773
|
referrerPolicy?: ReferrerPolicy | undefined;
|
|
669
774
|
signal?: (AbortSignal | null) | undefined;
|
|
670
775
|
window?: null | undefined;
|
|
671
|
-
onRetry?: ((response: import("
|
|
776
|
+
onRetry?: ((response: import("better-auth/client").ResponseContext) => Promise<void> | void) | undefined;
|
|
672
777
|
hookOptions?: {
|
|
673
778
|
cloneResponse?: boolean;
|
|
674
779
|
} | undefined;
|
|
675
780
|
timeout?: number | undefined;
|
|
676
|
-
customFetchImpl: import("
|
|
781
|
+
customFetchImpl: import("better-auth/client").FetchEsque;
|
|
677
782
|
baseURL: string;
|
|
678
783
|
throw?: boolean | undefined;
|
|
679
784
|
auth?: ({
|
|
@@ -693,61 +798,76 @@ export declare function createAuth(config: AuthConfig): {
|
|
|
693
798
|
params?: any;
|
|
694
799
|
duplex?: "full" | "half" | undefined;
|
|
695
800
|
jsonParser: (text: string) => Promise<any> | any;
|
|
696
|
-
retry?: import("
|
|
801
|
+
retry?: import("better-auth/client").RetryOptions | undefined;
|
|
697
802
|
retryAttempt?: number | undefined;
|
|
698
|
-
output?: (import("
|
|
699
|
-
errorSchema?: import("
|
|
803
|
+
output?: (import("better-auth/client").StandardSchemaV1 | typeof Blob | typeof File) | undefined;
|
|
804
|
+
errorSchema?: import("better-auth/client").StandardSchemaV1 | undefined;
|
|
700
805
|
disableValidation?: boolean | undefined;
|
|
701
806
|
disableSignal?: boolean | undefined;
|
|
702
807
|
}, unknown, unknown, {}>;
|
|
703
808
|
$store: {
|
|
704
809
|
notify: (signal?: (Omit<string, "$sessionSignal"> | "$sessionSignal") | undefined) => void;
|
|
705
810
|
listen: (signal: Omit<string, "$sessionSignal"> | "$sessionSignal", listener: (value: boolean, oldValue?: boolean | undefined) => void) => void;
|
|
706
|
-
atoms: Record<string, import("
|
|
811
|
+
atoms: Record<string, import("better-auth/client").WritableAtom<any>>;
|
|
707
812
|
};
|
|
708
813
|
$ERROR_CODES: {
|
|
709
|
-
|
|
814
|
+
readonly USER_NOT_FOUND: "User not found";
|
|
815
|
+
readonly FAILED_TO_CREATE_USER: "Failed to create user";
|
|
816
|
+
readonly FAILED_TO_CREATE_SESSION: "Failed to create session";
|
|
817
|
+
readonly FAILED_TO_UPDATE_USER: "Failed to update user";
|
|
818
|
+
readonly FAILED_TO_GET_SESSION: "Failed to get session";
|
|
819
|
+
readonly INVALID_PASSWORD: "Invalid password";
|
|
820
|
+
readonly INVALID_EMAIL: "Invalid email";
|
|
821
|
+
readonly INVALID_EMAIL_OR_PASSWORD: "Invalid email or password";
|
|
822
|
+
readonly SOCIAL_ACCOUNT_ALREADY_LINKED: "Social account already linked";
|
|
823
|
+
readonly PROVIDER_NOT_FOUND: "Provider not found";
|
|
824
|
+
readonly INVALID_TOKEN: "Invalid token";
|
|
825
|
+
readonly ID_TOKEN_NOT_SUPPORTED: "id_token not supported";
|
|
826
|
+
readonly FAILED_TO_GET_USER_INFO: "Failed to get user info";
|
|
827
|
+
readonly USER_EMAIL_NOT_FOUND: "User email not found";
|
|
828
|
+
readonly EMAIL_NOT_VERIFIED: "Email not verified";
|
|
829
|
+
readonly PASSWORD_TOO_SHORT: "Password too short";
|
|
830
|
+
readonly PASSWORD_TOO_LONG: "Password too long";
|
|
831
|
+
readonly USER_ALREADY_EXISTS: "User already exists.";
|
|
832
|
+
readonly USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL: "User already exists. Use another email.";
|
|
833
|
+
readonly EMAIL_CAN_NOT_BE_UPDATED: "Email can not be updated";
|
|
834
|
+
readonly CREDENTIAL_ACCOUNT_NOT_FOUND: "Credential account not found";
|
|
835
|
+
readonly SESSION_EXPIRED: "Session expired. Re-authenticate to perform this action.";
|
|
836
|
+
readonly FAILED_TO_UNLINK_LAST_ACCOUNT: "You can't unlink your last account";
|
|
837
|
+
readonly ACCOUNT_NOT_FOUND: "Account not found";
|
|
838
|
+
readonly USER_ALREADY_HAS_PASSWORD: "User already has a password. Provide that to delete the account.";
|
|
839
|
+
readonly CROSS_SITE_NAVIGATION_LOGIN_BLOCKED: "Cross-site navigation login blocked. This request appears to be a CSRF attack.";
|
|
840
|
+
readonly VERIFICATION_EMAIL_NOT_ENABLED: "Verification email isn't enabled";
|
|
841
|
+
readonly EMAIL_ALREADY_VERIFIED: "Email is already verified";
|
|
842
|
+
readonly EMAIL_MISMATCH: "Email mismatch";
|
|
843
|
+
readonly SESSION_NOT_FRESH: "Session is not fresh";
|
|
844
|
+
readonly LINKED_ACCOUNT_ALREADY_EXISTS: "Linked account already exists";
|
|
845
|
+
readonly INVALID_ORIGIN: "Invalid origin";
|
|
846
|
+
readonly INVALID_CALLBACK_URL: "Invalid callbackURL";
|
|
847
|
+
readonly INVALID_REDIRECT_URL: "Invalid redirectURL";
|
|
848
|
+
readonly INVALID_ERROR_CALLBACK_URL: "Invalid errorCallbackURL";
|
|
849
|
+
readonly INVALID_NEW_USER_CALLBACK_URL: "Invalid newUserCallbackURL";
|
|
850
|
+
readonly MISSING_OR_NULL_ORIGIN: "Missing or null Origin";
|
|
851
|
+
readonly CALLBACK_URL_REQUIRED: "callbackURL is required";
|
|
852
|
+
readonly FAILED_TO_CREATE_VERIFICATION: "Unable to create verification";
|
|
853
|
+
readonly FIELD_NOT_ALLOWED: "Field not allowed to be set";
|
|
854
|
+
readonly ASYNC_VALIDATION_NOT_SUPPORTED: "Async validation is not supported";
|
|
855
|
+
readonly VALIDATION_ERROR: "Validation Error";
|
|
856
|
+
readonly MISSING_FIELD: "Field is required";
|
|
710
857
|
};
|
|
711
858
|
};
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
checkSlug(request: import("./types").CheckSlugRequest): Promise<boolean>;
|
|
724
|
-
getActiveMember(): Promise<import("./types").Member | null>;
|
|
725
|
-
getActiveMemberRole(): Promise<{
|
|
726
|
-
role: string;
|
|
727
|
-
} | null>;
|
|
728
|
-
removeMember(request: import("./types").RemoveMemberRequest): Promise<import("./types").Member>;
|
|
729
|
-
updateMemberRole(request: import("./types").UpdateMemberRoleRequest): Promise<import("./types").Member>;
|
|
730
|
-
inviteMember(request: import("./types").InviteMemberRequest, inviteLink?: string): Promise<import("./types").Invitation>;
|
|
731
|
-
listInvitations(): Promise<import("./types").Invitation[]>;
|
|
732
|
-
getInvitation(invitationId: string): Promise<import("./types").InvitationDetail | null>;
|
|
733
|
-
cancelInvitation(request: import("./types").CancelInvitationRequest): Promise<void>;
|
|
734
|
-
acceptInvitation(request: import("./types").AcceptInvitationRequest): Promise<import("./types").InvitationResponse>;
|
|
735
|
-
rejectInvitation(request: import("./types").RejectInvitationRequest): Promise<import("./types").InvitationResponse>;
|
|
736
|
-
leave(organizationId: string): Promise<void>;
|
|
737
|
-
};
|
|
738
|
-
teamApi: {
|
|
739
|
-
create(request: import("./types").CreateTeamRequest): Promise<import("./types").Team>;
|
|
740
|
-
list(): Promise<import("./types").Team[]>;
|
|
741
|
-
update(request: import("./types").UpdateTeamRequest): Promise<import("./types").Team>;
|
|
742
|
-
delete(request: import("./types").DeleteTeamRequest): Promise<void>;
|
|
743
|
-
setActive(request: import("./types").SetActiveTeamRequest): Promise<void>;
|
|
744
|
-
listUserTeams(): Promise<import("./types").Team[]>;
|
|
745
|
-
listMembers(teamId: string): Promise<import("./types").TeamMember[]>;
|
|
746
|
-
addMember(request: import("./types").AddTeamMemberRequest): Promise<import("./types").TeamMember>;
|
|
747
|
-
removeMember(request: import("./types").RemoveTeamMemberRequest): Promise<void>;
|
|
748
|
-
leaveTeam(teamId: string): Promise<void>;
|
|
859
|
+
getCurrentUser: () => import("./types").SessionUser | null;
|
|
860
|
+
getCurrentUserId: () => string | null;
|
|
861
|
+
isAuthenticated: () => boolean;
|
|
862
|
+
isLoading: () => boolean;
|
|
863
|
+
isLoaded: () => boolean;
|
|
864
|
+
getAuthToken: () => string | null;
|
|
865
|
+
getAuthHeaders: () => Record<string, string>;
|
|
866
|
+
waitForAuth: () => Promise<void>;
|
|
867
|
+
userManager: {
|
|
868
|
+
getUser: () => import("./types").SessionUser | null;
|
|
869
|
+
getUserId: () => string | null;
|
|
749
870
|
};
|
|
750
|
-
tokenStorage: import("./api").TokenStorage;
|
|
751
871
|
};
|
|
752
872
|
export type AuthInstance = ReturnType<typeof createAuth>;
|
|
753
873
|
//# sourceMappingURL=core.d.ts.map
|