@cloudbase/js-sdk 3.9.0 → 3.9.1
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/app/dist/index.js +1 -1
- package/app/dist/index.js.map +1 -1
- package/app/dist/index.node.js +1 -1
- package/app/dist/index.node.js.map +1 -1
- package/auth/dist/index.d.ts +1 -0
- package/auth/dist/index.esm.js +1 -1
- package/auth/dist/index.esm.js.map +1 -1
- package/auth/dist/index.js +1 -1
- package/auth/dist/index.js.map +1 -1
- package/auth/dist/type.d.ts +2 -2
- package/core.d.ts +13 -3
- package/database/dist/index.d.ts +147 -0
- package/database/dist/index.esm.js +1 -1
- package/database/dist/index.esm.js.map +1 -1
- package/database/dist/index.js +1 -1
- package/database/dist/index.js.map +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.node.cjs.js +1 -1
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.esm.js +1 -1
- package/dist/index.node.esm.js.map +1 -1
- package/miniprogram_dist/auth/index.d.ts +1 -0
- package/miniprogram_dist/auth/index.js +1 -1
- package/miniprogram_dist/database/index.d.ts +147 -0
- package/miniprogram_dist/database/index.js +1 -1
- package/miniprogram_dist/index.js +1 -1
- package/miniprogram_dist/oauth/index.d.ts +1 -1
- package/miniprogram_dist/oauth/index.js +1 -1
- package/oauth/dist/auth/consts.d.ts +3 -1
- package/oauth/dist/index.d.ts +1 -1
- package/oauth/dist/index.esm.js +1 -1
- package/oauth/dist/index.esm.js.map +1 -1
- package/oauth/dist/index.js +1 -1
- package/oauth/dist/index.js.map +1 -1
- package/package.json +2 -2
package/auth/dist/type.d.ts
CHANGED
|
@@ -182,13 +182,13 @@ export interface VerifyMobileOtpParams {
|
|
|
182
182
|
phone: string;
|
|
183
183
|
token: string | number;
|
|
184
184
|
type?: MobileOtpType | EmailOtpType;
|
|
185
|
-
messageId
|
|
185
|
+
messageId: string;
|
|
186
186
|
}
|
|
187
187
|
export interface VerifyEmailOtpParams {
|
|
188
188
|
email: string;
|
|
189
189
|
token: string | number;
|
|
190
190
|
type?: MobileOtpType | EmailOtpType;
|
|
191
|
-
messageId
|
|
191
|
+
messageId: string;
|
|
192
192
|
}
|
|
193
193
|
export type VerifyOtpParams = VerifyMobileOtpParams | VerifyEmailOtpParams;
|
|
194
194
|
export type VerifyOtpReq = VerifyOtpParams;
|
package/core.d.ts
CHANGED
|
@@ -1354,7 +1354,10 @@ declare namespace cloudbase.auth {
|
|
|
1354
1354
|
*/
|
|
1355
1355
|
signIn(params: authModels.SignInRequest): Promise<ILoginState>
|
|
1356
1356
|
/**
|
|
1357
|
-
*
|
|
1357
|
+
* 用户注册,目前支持手机号验证码注册,邮箱验证码注册。
|
|
1358
|
+
*
|
|
1359
|
+
* 成功后使用返回的 `data.verifyOtp({ token })` 校验验证码即可,不必传 `messageId`
|
|
1360
|
+
* (与 `signInWithOtp` 返回的回调相同)。独立调用 `auth.verifyOtp` 时 `messageId` 为必填。
|
|
1358
1361
|
*
|
|
1359
1362
|
* 文档 {@link https://docs.cloudbase.net/api-reference/webv3/authentication#signup}
|
|
1360
1363
|
*/
|
|
@@ -1390,6 +1393,9 @@ declare namespace cloudbase.auth {
|
|
|
1390
1393
|
*
|
|
1391
1394
|
* **注意**:手机号验证码登录需要在初始化时设置 `region: 'ap-shanghai'`。
|
|
1392
1395
|
*
|
|
1396
|
+
* 成功后使用返回的 `data.verifyOtp({ token })` 完成校验即可,**不必传 `messageId`**
|
|
1397
|
+
* (SDK 已在回调闭包中绑定)。独立调用 `auth.verifyOtp` 时 `messageId` 为必填,且只登录不注册。
|
|
1398
|
+
*
|
|
1393
1399
|
* 文档 {@link https://docs.cloudbase.net/api-reference/webv3/authentication#signinwithotp}
|
|
1394
1400
|
*
|
|
1395
1401
|
* @example
|
|
@@ -1465,11 +1471,15 @@ declare namespace cloudbase.auth {
|
|
|
1465
1471
|
*/
|
|
1466
1472
|
resetPasswordForOld(params: ResetPasswordForOldReq): Promise<SignInRes>
|
|
1467
1473
|
/**
|
|
1468
|
-
*
|
|
1474
|
+
* 独立校验一次性密码(OTP)并登录。
|
|
1475
|
+
*
|
|
1476
|
+
* 注意:独立 `verifyOtp` 的 `messageId` 为必填。只登录、不注册。
|
|
1477
|
+
* 推荐使用 `signInWithOtp` / `signUp` 返回的 `data.verifyOtp` 回调(自动携带 messageId),
|
|
1478
|
+
* 避免手动传参遗漏。
|
|
1469
1479
|
*
|
|
1470
1480
|
* 文档 {@link https://docs.cloudbase.net/api-reference/webv3/authentication#verifyotp}
|
|
1471
1481
|
*
|
|
1472
|
-
* @param params
|
|
1482
|
+
* @param params email 或 phone 二选一;`token` 与 `messageId` 必填
|
|
1473
1483
|
*/
|
|
1474
1484
|
verifyOtp(params: VerifyOtpReq): Promise<SignInRes>
|
|
1475
1485
|
/**
|
package/database/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,150 @@
|
|
|
1
1
|
import { ICloudbase } from '@cloudbase/js-sdk/types';
|
|
2
2
|
import cloudbaseNS from '../../index';
|
|
3
|
+
declare type QueryType = 'WHERE' | 'DOC';
|
|
4
|
+
interface IDbConfig {
|
|
5
|
+
instance?: string;
|
|
6
|
+
database?: string;
|
|
7
|
+
}
|
|
8
|
+
interface IBaseReq extends IDbConfig {
|
|
9
|
+
collectionName: string;
|
|
10
|
+
transactionId?: string;
|
|
11
|
+
}
|
|
12
|
+
interface IDocumentsQueryReq extends IBaseReq {
|
|
13
|
+
query?: any;
|
|
14
|
+
queryType?: QueryType;
|
|
15
|
+
order?: Record<string, any> | {
|
|
16
|
+
field: string;
|
|
17
|
+
direction: string;
|
|
18
|
+
}[] | string;
|
|
19
|
+
offset?: number;
|
|
20
|
+
limit?: number;
|
|
21
|
+
projection?: Object;
|
|
22
|
+
}
|
|
23
|
+
interface IDocumentsAddReq extends IBaseReq {
|
|
24
|
+
data: Object | Object[];
|
|
25
|
+
}
|
|
26
|
+
interface IDocumentsUpdateReq extends IBaseReq {
|
|
27
|
+
query: Object;
|
|
28
|
+
data: Object;
|
|
29
|
+
multi?: boolean;
|
|
30
|
+
merge?: boolean;
|
|
31
|
+
upsert?: boolean;
|
|
32
|
+
replaceMode?: boolean;
|
|
33
|
+
queryType?: QueryType;
|
|
34
|
+
}
|
|
35
|
+
interface IDocumentsRemoveReq extends IBaseReq {
|
|
36
|
+
query: Object;
|
|
37
|
+
multi?: boolean;
|
|
38
|
+
queryType?: QueryType;
|
|
39
|
+
}
|
|
40
|
+
interface IDocumentsCountReq extends IBaseReq {
|
|
41
|
+
query: Object;
|
|
42
|
+
queryType?: QueryType;
|
|
43
|
+
}
|
|
44
|
+
interface ICommonRes<T> {
|
|
45
|
+
data?: T & {
|
|
46
|
+
code?: string;
|
|
47
|
+
};
|
|
48
|
+
requestId: string;
|
|
49
|
+
code?: string;
|
|
50
|
+
message?: string;
|
|
51
|
+
}
|
|
52
|
+
interface IAddRes {
|
|
53
|
+
_id?: string;
|
|
54
|
+
ids?: string[];
|
|
55
|
+
insertedIds: string[];
|
|
56
|
+
}
|
|
57
|
+
interface IRunCommandsReq {
|
|
58
|
+
transactionId?: string;
|
|
59
|
+
commands: Object[];
|
|
60
|
+
}
|
|
61
|
+
export declare const gateWayFunc: {
|
|
62
|
+
filterRes<T>(res: ICommonRes<T> & {
|
|
63
|
+
header?: any;
|
|
64
|
+
statusCode?: number;
|
|
65
|
+
}): ICommonRes<T>;
|
|
66
|
+
flattenResData<T_1>(res: ICommonRes<T_1>): any;
|
|
67
|
+
safeParseEJSON(data: any): any;
|
|
68
|
+
parseEJSONParam(value: any): any;
|
|
69
|
+
parseEJSONValue(value: any): any;
|
|
70
|
+
normalizeOrderParam(value: any): any;
|
|
71
|
+
extractDocId(query: any): string | undefined;
|
|
72
|
+
toLegacyRegExp(value: any): any;
|
|
73
|
+
parseWriteParam(value: any): any;
|
|
74
|
+
buildQueryParams(params: Record<string, any>): string;
|
|
75
|
+
getUrlPrefix(data: IDbConfig): string;
|
|
76
|
+
'database.queryDocument'(data: IDocumentsQueryReq, customReqOpts?: any): Promise<ICommonRes<{
|
|
77
|
+
offset?: number;
|
|
78
|
+
limit?: number;
|
|
79
|
+
list: any[];
|
|
80
|
+
}>>;
|
|
81
|
+
'database.addDocument'(data: IDocumentsAddReq, customReqOpts?: any): Promise<ICommonRes<IAddRes>>;
|
|
82
|
+
'database.updateDocument'(data: IDocumentsUpdateReq, customReqOpts?: any): Promise<ICommonRes<{
|
|
83
|
+
matched: number;
|
|
84
|
+
updated: number;
|
|
85
|
+
upsert_id: string;
|
|
86
|
+
}>>;
|
|
87
|
+
'database.deleteDocument'(data: IDocumentsRemoveReq, customReqOpts?: any): Promise<ICommonRes<{
|
|
88
|
+
deleted: number;
|
|
89
|
+
}>>;
|
|
90
|
+
'database.countDocument'(data: IDocumentsCountReq, customReqOpts?: any): Promise<ICommonRes<{
|
|
91
|
+
total: number;
|
|
92
|
+
}>>;
|
|
93
|
+
'database.addCollection'(data: {
|
|
94
|
+
collectionName: string;
|
|
95
|
+
} & IDbConfig, customReqOpts?: any): Promise<ICommonRes<''>>;
|
|
96
|
+
'database.aggregate'(data: {
|
|
97
|
+
collectionName: string;
|
|
98
|
+
stages: {
|
|
99
|
+
stageKey: string;
|
|
100
|
+
stageValue: any;
|
|
101
|
+
}[];
|
|
102
|
+
} & IDbConfig, customReqOpts?: any): Promise<ICommonRes<{
|
|
103
|
+
list: string;
|
|
104
|
+
}>>;
|
|
105
|
+
'database.startTransaction'(data: IDbConfig, customReqOpts?: any): Promise<ICommonRes<unknown>>;
|
|
106
|
+
'database.commitTransaction'(data: {
|
|
107
|
+
transactionId: string;
|
|
108
|
+
} & IDbConfig, customReqOpts?: any): Promise<ICommonRes<unknown>>;
|
|
109
|
+
'database.abortTransaction'(data: {
|
|
110
|
+
transactionId: string;
|
|
111
|
+
} & IDbConfig, customReqOpts?: any): Promise<ICommonRes<unknown>>;
|
|
112
|
+
'database.getInTransaction'(data: IDocumentsQueryReq, customReqOpts?: any): Promise<any>;
|
|
113
|
+
'database.updateDocInTransaction'(data: IDocumentsUpdateReq, customReqOpts?: any): Promise<any>;
|
|
114
|
+
'database.deleteDocInTransaction'(data: IDocumentsRemoveReq, customReqOpts?: any): Promise<any>;
|
|
115
|
+
'database.insertDocInTransaction'(data: IDocumentsAddReq, customReqOpts?: any): Promise<ICommonRes<IAddRes & {
|
|
116
|
+
inserted?: number;
|
|
117
|
+
}>>;
|
|
118
|
+
'database.runCommands'(data: IRunCommandsReq & IDbConfig, customReqOpts?: any): Promise<ICommonRes<{
|
|
119
|
+
list: Object[][];
|
|
120
|
+
}>>;
|
|
121
|
+
'database.getDocument'(data: IDocumentsQueryReq, customReqOpts?: any): Promise<ICommonRes<{
|
|
122
|
+
offset?: number;
|
|
123
|
+
limit?: number;
|
|
124
|
+
list: any[];
|
|
125
|
+
}>>;
|
|
126
|
+
'database.insertDocument'(data: IDocumentsAddReq, customReqOpts?: any): Promise<ICommonRes<IAddRes>>;
|
|
127
|
+
'database.modifyDocument'(data: IDocumentsUpdateReq, customReqOpts?: any): Promise<ICommonRes<{
|
|
128
|
+
matched: number;
|
|
129
|
+
updated: number;
|
|
130
|
+
upsert_id: string;
|
|
131
|
+
}>>;
|
|
132
|
+
'database.modifyAndReturnDoc'(data: IDocumentsUpdateReq, customReqOpts?: any): Promise<any>;
|
|
133
|
+
'database.removeDocument'(data: IDocumentsRemoveReq, customReqOpts?: any): Promise<ICommonRes<{
|
|
134
|
+
deleted: number;
|
|
135
|
+
}>>;
|
|
136
|
+
'database.calculateDocument'(data: IDocumentsCountReq, customReqOpts?: any): Promise<ICommonRes<{
|
|
137
|
+
total: number;
|
|
138
|
+
}>>;
|
|
139
|
+
'database.aggregateDocuments'(data: {
|
|
140
|
+
collectionName: string;
|
|
141
|
+
stages: {
|
|
142
|
+
stageKey: string;
|
|
143
|
+
stageValue: any;
|
|
144
|
+
}[];
|
|
145
|
+
} & IDbConfig, customReqOpts?: any): Promise<ICommonRes<{
|
|
146
|
+
list: any;
|
|
147
|
+
}>>;
|
|
148
|
+
};
|
|
3
149
|
export declare function registerDatabase(app: ICloudbase | typeof cloudbaseNS): void;
|
|
150
|
+
export {};
|