@cloudbase/auth 2.24.3 → 2.24.5
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 +1 -0
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/sbaseApi.js +11 -5
- package/dist/cjs/type.d.ts +241 -0
- package/dist/cjs/type.js +3 -0
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/sbaseApi.js +11 -5
- package/dist/esm/type.d.ts +241 -0
- package/dist/esm/type.js +2 -0
- package/dist/miniprogram/index.js +1 -1
- package/package.json +5 -5
- package/src/index.ts +29 -0
- package/src/sbaseApi.ts +4 -0
- package/src/{type.d.ts → type.ts} +2 -1
- package/SbaseApi.md +0 -6474
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudbase/auth",
|
|
3
|
-
"version": "2.24.
|
|
3
|
+
"version": "2.24.5",
|
|
4
4
|
"description": "cloudbase javascript sdk auth componets",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -32,14 +32,14 @@
|
|
|
32
32
|
"license": "Apache-2.0",
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@cloudbase/adapter-wx_mp": "^1.2.1",
|
|
35
|
-
"@cloudbase/oauth": "2.24.
|
|
36
|
-
"@cloudbase/utilities": "2.24.
|
|
35
|
+
"@cloudbase/oauth": "2.24.5",
|
|
36
|
+
"@cloudbase/utilities": "2.24.5"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@cloudbase/types": "2.24.
|
|
39
|
+
"@cloudbase/types": "2.24.5",
|
|
40
40
|
"@types/node": "^22.1.0",
|
|
41
41
|
"terser-webpack-plugin": "^3.0.2",
|
|
42
42
|
"webpack-bundle-analyzer": "^4.9.1"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "4eb6054371f9880c4b2c6ae59446a0a9ae118d55"
|
|
45
45
|
}
|
package/src/index.ts
CHANGED
|
@@ -27,6 +27,35 @@ import {
|
|
|
27
27
|
} from './utilities'
|
|
28
28
|
import { SbaseApi } from './sbaseApi'
|
|
29
29
|
|
|
30
|
+
export type {
|
|
31
|
+
SignInRes,
|
|
32
|
+
GetUserRes,
|
|
33
|
+
CommonRes,
|
|
34
|
+
SignInWithOtpRes,
|
|
35
|
+
SignInOAuthRes,
|
|
36
|
+
GetClaimsRes,
|
|
37
|
+
ResetPasswordForEmailRes,
|
|
38
|
+
GetUserIdentitiesRes,
|
|
39
|
+
LinkIdentityRes,
|
|
40
|
+
ReauthenticateRes,
|
|
41
|
+
ResendRes,
|
|
42
|
+
UpdateUserWithVerificationRes,
|
|
43
|
+
OnAuthStateChangeCallback,
|
|
44
|
+
SignInWithPasswordReq,
|
|
45
|
+
SignInWithIdTokenReq,
|
|
46
|
+
SignInWithOAuthReq,
|
|
47
|
+
VerifyOAuthReq,
|
|
48
|
+
VerifyOtpReq,
|
|
49
|
+
LinkIdentityReq,
|
|
50
|
+
UnlinkIdentityReq,
|
|
51
|
+
UpdateUserReq,
|
|
52
|
+
SignInWithOtpReq,
|
|
53
|
+
ResetPasswordForOldReq,
|
|
54
|
+
ResendReq,
|
|
55
|
+
SetSessionReq,
|
|
56
|
+
DeleteMeReq,
|
|
57
|
+
} from './type'
|
|
58
|
+
|
|
30
59
|
declare const cloudbase: ICloudbase
|
|
31
60
|
declare const wx: any
|
|
32
61
|
|
package/src/sbaseApi.ts
CHANGED
|
@@ -193,6 +193,10 @@ export class SbaseApi {
|
|
|
193
193
|
* @returns Promise<SignUpRes>
|
|
194
194
|
*/
|
|
195
195
|
async signUp(params: authModels.SignUpRequest): Promise<SignUpRes> {
|
|
196
|
+
if (params.phone_number || params.verification_code || params.verification_token || params.provider_token) {
|
|
197
|
+
await this.oauthInstance.authApi.signUp(params)
|
|
198
|
+
return this.createLoginState() as any
|
|
199
|
+
}
|
|
196
200
|
try {
|
|
197
201
|
// 参数校验:email或phone必填其一
|
|
198
202
|
this.validateAtLeastOne(params, [['email'], ['phone']], 'You must provide either an email or phone number')
|
|
@@ -227,13 +227,14 @@ export interface SignInWithOtpReq {
|
|
|
227
227
|
email?: string // 邮箱(可选,与手机号二选一)
|
|
228
228
|
phone?: string // 手机号(可选,与邮箱二选一)
|
|
229
229
|
}
|
|
230
|
+
|
|
230
231
|
/**
|
|
231
232
|
*
|
|
232
233
|
* @param code 验证码
|
|
233
234
|
* @param messageId 可选,ResendRes.data.messageId
|
|
234
235
|
* @returns
|
|
235
236
|
*/
|
|
236
|
-
declare type OtpCallback = (params: VerifyOtpReq) => Promise<
|
|
237
|
+
declare type OtpCallback = (params: VerifyOtpReq) => Promise<SignInRes>
|
|
237
238
|
|
|
238
239
|
export interface SignInWithOtpRes {
|
|
239
240
|
data: SignInRes['data'] & {
|