@cloudbase/auth 3.1.8 → 3.1.10
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/cjs/index.d.ts +65 -64
- package/dist/cjs/index.js +1756 -1675
- package/dist/cjs/v1-compat.d.ts +77 -0
- package/dist/cjs/v1-compat.js +423 -0
- package/dist/esm/index.d.ts +65 -64
- package/dist/esm/index.js +1753 -1675
- package/dist/esm/v1-compat.d.ts +77 -0
- package/dist/esm/v1-compat.js +419 -0
- package/dist/miniprogram/index.js +1 -1
- package/package.json +5 -5
- package/src/index.ts +1727 -1660
- package/src/v1-compat.ts +499 -0
package/dist/cjs/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import type { ICloudbaseRequest } from '@cloudbase/types/request';
|
|
|
4
4
|
import type { ICloudbaseAuthConfig, IUser, ILoginState } from '@cloudbase/types/auth';
|
|
5
5
|
import type { AuthOptions, Credentials } from '@cloudbase/oauth';
|
|
6
6
|
import { CloudbaseOAuth, AuthError, authModels } from '@cloudbase/oauth';
|
|
7
|
+
import { AuthV1Compat, WeixinAuthProvider, CustomAuthProvider, AnonymousAuthProvider } from './v1-compat';
|
|
7
8
|
import { CommonRes, DeleteMeReq, GetClaimsRes, GetUserIdentitiesRes, GetUserRes, LinkIdentityReq, LinkIdentityRes, OnAuthStateChangeCallback, ReauthenticateRes, ResendReq, ResendRes, ResetPasswordForEmailRes, ResetPasswordForOldReq, SetSessionReq, SignInAnonymouslyReq, SignInOAuthRes, SignInRes, SignInWithIdTokenReq, SignInWithOAuthReq, SignInWithOtpReq, SignInWithOtpRes, SignInWithPasswordReq, SignUpRes, UnlinkIdentityReq, UpdateUserReq, UpdateUserWithVerificationRes, VerifyOAuthReq, VerifyOAuthRes, VerifyOtpReq } from './type';
|
|
8
9
|
export type { SignInRes, GetUserRes, CommonRes, SignInWithOtpRes, SignInOAuthRes, GetClaimsRes, ResetPasswordForEmailRes, GetUserIdentitiesRes, LinkIdentityRes, ReauthenticateRes, ResendRes, UpdateUserWithVerificationRes, OnAuthStateChangeCallback, SignInWithPasswordReq, SignInWithIdTokenReq, SignInWithOAuthReq, VerifyOAuthReq, VerifyOtpReq, LinkIdentityReq, UnlinkIdentityReq, UpdateUserReq, SignInWithOtpReq, ResetPasswordForOldReq, ResendReq, SetSessionReq, DeleteMeReq, SignUpRes, } from './type';
|
|
9
10
|
interface UserInfo {
|
|
@@ -79,13 +80,74 @@ interface IAuthConfig extends ICloudbaseAuthConfig {
|
|
|
79
80
|
request?: ICloudbaseRequest;
|
|
80
81
|
runtime?: string;
|
|
81
82
|
}
|
|
82
|
-
declare class Auth {
|
|
83
|
+
declare class Auth extends AuthV1Compat {
|
|
83
84
|
readonly config: IAuthConfig;
|
|
84
85
|
oauthInstance: CloudbaseOAuth;
|
|
85
86
|
readonly cache: ICloudbaseCache;
|
|
86
87
|
private listeners;
|
|
87
88
|
private hasListenerSetUp;
|
|
88
89
|
constructor(config: IAuthConfig);
|
|
90
|
+
signInAnonymously(params: SignInAnonymouslyReq): Promise<SignInRes>;
|
|
91
|
+
signUp(params: authModels.SignUpRequest & {
|
|
92
|
+
phone?: string;
|
|
93
|
+
}): Promise<SignUpRes>;
|
|
94
|
+
signOut(params?: authModels.SignoutRequest): Promise<authModels.SignoutResponse & {
|
|
95
|
+
data: Object;
|
|
96
|
+
error: AuthError;
|
|
97
|
+
}>;
|
|
98
|
+
onAuthStateChange(callback: OnAuthStateChangeCallback): {
|
|
99
|
+
data: {
|
|
100
|
+
subscription: {
|
|
101
|
+
id: string;
|
|
102
|
+
callback: OnAuthStateChangeCallback;
|
|
103
|
+
unsubscribe: () => void;
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
signInWithPassword(params: SignInWithPasswordReq): Promise<SignInRes>;
|
|
108
|
+
signInWithIdToken(params: SignInWithIdTokenReq): Promise<SignInRes>;
|
|
109
|
+
signInWithOtp(params: SignInWithOtpReq): Promise<SignInWithOtpRes>;
|
|
110
|
+
verifyOAuth(params?: VerifyOAuthReq): Promise<VerifyOAuthRes>;
|
|
111
|
+
signInWithOAuth(params: SignInWithOAuthReq): Promise<SignInOAuthRes>;
|
|
112
|
+
getClaims(): Promise<GetClaimsRes>;
|
|
113
|
+
resetPasswordForEmail(emailOrPhone: string, options?: {
|
|
114
|
+
redirectTo?: string;
|
|
115
|
+
}): Promise<ResetPasswordForEmailRes>;
|
|
116
|
+
resetPasswordForOld(params: ResetPasswordForOldReq): Promise<{
|
|
117
|
+
data: {
|
|
118
|
+
user: import("./type").User;
|
|
119
|
+
session: import("./type").Session;
|
|
120
|
+
};
|
|
121
|
+
error: any;
|
|
122
|
+
} | {
|
|
123
|
+
data: {
|
|
124
|
+
user?: undefined;
|
|
125
|
+
session?: undefined;
|
|
126
|
+
};
|
|
127
|
+
error: AuthError;
|
|
128
|
+
}>;
|
|
129
|
+
verifyOtp(params: VerifyOtpReq): Promise<SignInRes>;
|
|
130
|
+
getSession(): Promise<SignInRes>;
|
|
131
|
+
refreshSession(refresh_token?: string): Promise<SignInRes>;
|
|
132
|
+
getUser(): Promise<GetUserRes>;
|
|
133
|
+
refreshUser(): Promise<CommonRes>;
|
|
134
|
+
updateUser(params: UpdateUserReq): Promise<GetUserRes | UpdateUserWithVerificationRes>;
|
|
135
|
+
getUserIdentities(): Promise<GetUserIdentitiesRes>;
|
|
136
|
+
linkIdentity(params: LinkIdentityReq): Promise<LinkIdentityRes>;
|
|
137
|
+
unlinkIdentity(params: UnlinkIdentityReq): Promise<CommonRes>;
|
|
138
|
+
reauthenticate(): Promise<ReauthenticateRes>;
|
|
139
|
+
resend(params: ResendReq): Promise<ResendRes>;
|
|
140
|
+
setSession(params: SetSessionReq): Promise<SignInRes>;
|
|
141
|
+
exchangeCodeForSession(): Promise<void>;
|
|
142
|
+
deleteUser(params: DeleteMeReq): Promise<CommonRes>;
|
|
143
|
+
toDefaultLoginPage(params?: authModels.ToDefaultLoginPage): Promise<CommonRes>;
|
|
144
|
+
signInWithCustomTicket(getTickFn?: authModels.GetCustomSignTicketFn): Promise<SignInRes>;
|
|
145
|
+
signInWithOpenId({ useWxCloud }?: {
|
|
146
|
+
useWxCloud?: boolean;
|
|
147
|
+
}): Promise<SignInRes>;
|
|
148
|
+
signInWithPhoneAuth({ phoneCode }: {
|
|
149
|
+
phoneCode?: string;
|
|
150
|
+
}): Promise<SignInRes>;
|
|
89
151
|
bindPhoneNumber(params: authModels.BindPhoneRequest): Promise<void>;
|
|
90
152
|
unbindProvider(params: authModels.UnbindProviderRequest): Promise<void>;
|
|
91
153
|
bindEmail(params: authModels.BindEmailRequest): Promise<void>;
|
|
@@ -188,68 +250,7 @@ declare class Auth {
|
|
|
188
250
|
userInfo?: any;
|
|
189
251
|
}): Promise<LoginState>;
|
|
190
252
|
setAccessKey(): Promise<void>;
|
|
191
|
-
|
|
192
|
-
signUp(params: authModels.SignUpRequest & {
|
|
193
|
-
phone?: string;
|
|
194
|
-
}): Promise<SignUpRes>;
|
|
195
|
-
signOut(params?: authModels.SignoutRequest): Promise<authModels.SignoutResponse & {
|
|
196
|
-
data: Object;
|
|
197
|
-
error: AuthError;
|
|
198
|
-
}>;
|
|
199
|
-
onAuthStateChange(callback: OnAuthStateChangeCallback): {
|
|
200
|
-
data: {
|
|
201
|
-
subscription: {
|
|
202
|
-
id: string;
|
|
203
|
-
callback: OnAuthStateChangeCallback;
|
|
204
|
-
unsubscribe: () => void;
|
|
205
|
-
};
|
|
206
|
-
};
|
|
207
|
-
};
|
|
208
|
-
signInWithPassword(params: SignInWithPasswordReq): Promise<SignInRes>;
|
|
209
|
-
signInWithIdToken(params: SignInWithIdTokenReq): Promise<SignInRes>;
|
|
210
|
-
signInWithOtp(params: SignInWithOtpReq): Promise<SignInWithOtpRes>;
|
|
211
|
-
verifyOAuth(params?: VerifyOAuthReq): Promise<VerifyOAuthRes>;
|
|
212
|
-
signInWithOAuth(params: SignInWithOAuthReq): Promise<SignInOAuthRes>;
|
|
213
|
-
getClaims(): Promise<GetClaimsRes>;
|
|
214
|
-
resetPasswordForEmail(emailOrPhone: string, options?: {
|
|
215
|
-
redirectTo?: string;
|
|
216
|
-
}): Promise<ResetPasswordForEmailRes>;
|
|
217
|
-
resetPasswordForOld(params: ResetPasswordForOldReq): Promise<{
|
|
218
|
-
data: {
|
|
219
|
-
user: import("./type").User;
|
|
220
|
-
session: import("./type").Session;
|
|
221
|
-
};
|
|
222
|
-
error: any;
|
|
223
|
-
} | {
|
|
224
|
-
data: {
|
|
225
|
-
user?: undefined;
|
|
226
|
-
session?: undefined;
|
|
227
|
-
};
|
|
228
|
-
error: AuthError;
|
|
229
|
-
}>;
|
|
230
|
-
verifyOtp(params: VerifyOtpReq): Promise<SignInRes>;
|
|
231
|
-
getSession(): Promise<SignInRes>;
|
|
232
|
-
refreshSession(refresh_token?: string): Promise<SignInRes>;
|
|
233
|
-
getUser(): Promise<GetUserRes>;
|
|
234
|
-
refreshUser(): Promise<CommonRes>;
|
|
235
|
-
updateUser(params: UpdateUserReq): Promise<GetUserRes | UpdateUserWithVerificationRes>;
|
|
236
|
-
getUserIdentities(): Promise<GetUserIdentitiesRes>;
|
|
237
|
-
linkIdentity(params: LinkIdentityReq): Promise<LinkIdentityRes>;
|
|
238
|
-
unlinkIdentity(params: UnlinkIdentityReq): Promise<CommonRes>;
|
|
239
|
-
reauthenticate(): Promise<ReauthenticateRes>;
|
|
240
|
-
resend(params: ResendReq): Promise<ResendRes>;
|
|
241
|
-
setSession(params: SetSessionReq): Promise<SignInRes>;
|
|
242
|
-
exchangeCodeForSession(): Promise<void>;
|
|
243
|
-
deleteUser(params: DeleteMeReq): Promise<CommonRes>;
|
|
244
|
-
toDefaultLoginPage(params?: authModels.ToDefaultLoginPage): Promise<CommonRes>;
|
|
245
|
-
signInWithCustomTicket(getTickFn?: authModels.GetCustomSignTicketFn): Promise<SignInRes>;
|
|
246
|
-
signInWithOpenId({ useWxCloud }?: {
|
|
247
|
-
useWxCloud?: boolean;
|
|
248
|
-
}): Promise<SignInRes>;
|
|
249
|
-
signInWithPhoneAuth({ phoneCode }: {
|
|
250
|
-
phoneCode?: string;
|
|
251
|
-
}): Promise<SignInRes>;
|
|
252
|
-
private formatPhone;
|
|
253
|
+
protected formatPhone(phone: string): string;
|
|
253
254
|
private notifyListeners;
|
|
254
255
|
private setupListeners;
|
|
255
256
|
private convertToUser;
|
|
@@ -275,5 +276,5 @@ export declare function generateAuthInstance(config: TInitAuthOptions & {
|
|
|
275
276
|
authInstance: Auth;
|
|
276
277
|
oauthInstance: CloudbaseOAuth;
|
|
277
278
|
};
|
|
278
|
-
export { UserInfo, Auth };
|
|
279
|
+
export { UserInfo, Auth, WeixinAuthProvider, CustomAuthProvider, AnonymousAuthProvider };
|
|
279
280
|
export declare function registerAuth(app: Pick<ICloudbase, 'registerComponent'>): void;
|