@cloudbase/js-sdk 1.7.1 → 1.7.3

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/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- type KV<T> = {
1
+ interface KV<T> {
2
2
  [key: string]: T;
3
- };
3
+ }
4
4
 
5
5
  type ExcludeOf<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
6
6
 
@@ -25,7 +25,7 @@ declare namespace cloudbase {
25
25
 
26
26
  interface ICloudbaseExtension {
27
27
  name: string;
28
- invoke(opts: any, app: cloudbase.app.App): Promise<any>;
28
+ invoke: (opts: any, app: cloudbase.app.App) => Promise<any>;
29
29
  }
30
30
 
31
31
  interface Listeners {
@@ -39,9 +39,9 @@ declare namespace cloudbase {
39
39
  }
40
40
 
41
41
  interface ICloudbaseEventEmitter {
42
- on(name: string, listener: Function): this;
43
- off(name: string, listener: Function): this;
44
- fire(event: string | ICloudbaseEvent, data?: any): this;
42
+ on: (name: string, listener: Function) => this;
43
+ off: (name: string, listener: Function) => this;
44
+ fire: (event: string | ICloudbaseEvent, data?: any) => this;
45
45
  }
46
46
 
47
47
  interface ICloudbaseComponent {
@@ -192,9 +192,9 @@ declare namespace cloudbase.app {
192
192
  *
193
193
  * @return {!cloudbase.auth.App} Auth实例
194
194
  */
195
- auth(options: {
195
+ auth: (options: {
196
196
  persistence: cloudbase.auth.Persistence
197
- }): cloudbase.auth.App;
197
+ }) => cloudbase.auth.App;
198
198
  /**
199
199
  * 调用云函数
200
200
  *
@@ -223,7 +223,7 @@ declare namespace cloudbase.app {
223
223
  *
224
224
  * @return Promise-函数执行结果
225
225
  */
226
- callFunction(options: cloudbase.functions.ICallFunctionOptions): Promise<cloudbase.functions.ICallFunctionResponse>;
226
+ callFunction: (options: cloudbase.functions.ICallFunctionOptions) => Promise<cloudbase.functions.ICallFunctionResponse>;
227
227
  /**
228
228
  * 云存储-上传文件
229
229
  *
@@ -248,7 +248,7 @@ declare namespace cloudbase.app {
248
248
  *
249
249
  * @return Promise-上传结果
250
250
  */
251
- uploadFile(params: cloudbase.storage.ICloudbaseUploadFileParams): Promise<cloudbase.storage.ICloudbaseUploadFileResult>;
251
+ uploadFile: (params: cloudbase.storage.ICloudbaseUploadFileParams) => Promise<cloudbase.storage.ICloudbaseUploadFileResult>;
252
252
  /**
253
253
  * 云存储-下载文件
254
254
  *
@@ -269,7 +269,7 @@ declare namespace cloudbase.app {
269
269
  *
270
270
  * @return Promise-下载结果
271
271
  */
272
- downloadFile(params: cloudbase.storage.ICloudbaseDownloadFileParams): Promise<cloudbase.storage.ICloudbaseDownloadFileResult>;
272
+ downloadFile: (params: cloudbase.storage.ICloudbaseDownloadFileParams) => Promise<cloudbase.storage.ICloudbaseDownloadFileResult>;
273
273
  /**
274
274
  * 云存储-获取文件的下载链接
275
275
  *
@@ -298,7 +298,7 @@ declare namespace cloudbase.app {
298
298
  *
299
299
  * @return Promise-文件下载链接
300
300
  */
301
- getTempFileURL(params: cloudbase.storage.ICloudbaseGetTempFileURLParams): Promise<cloudbase.storage.ICloudbaseGetTempFileURLResult>;
301
+ getTempFileURL: (params: cloudbase.storage.ICloudbaseGetTempFileURLParams) => Promise<cloudbase.storage.ICloudbaseGetTempFileURLResult>;
302
302
  /**
303
303
  * 云存储-删除文件
304
304
  *
@@ -322,7 +322,7 @@ declare namespace cloudbase.app {
322
322
  *
323
323
  * @return Promise-删除结果
324
324
  */
325
- deleteFile(params: cloudbase.storage.ICloudbaseDeleteFileParams): Promise<cloudbase.storage.ICloudbaseDeleteFileResult>;
325
+ deleteFile: (params: cloudbase.storage.ICloudbaseDeleteFileParams) => Promise<cloudbase.storage.ICloudbaseDeleteFileResult>;
326
326
  /**
327
327
  * 获取数据库实例
328
328
  *
@@ -338,7 +338,7 @@ declare namespace cloudbase.app {
338
338
  *
339
339
  * @return 数据库实例
340
340
  */
341
- database(): cloudbase.database.App;
341
+ database: () => cloudbase.database.App;
342
342
  /**
343
343
  * 调用扩展能力插件功能,使用方式参考 {@link https://docs.cloudbase.net/extension/abilities/image-examination.html#shi-yong-kuo-zhan}
344
344
  *
@@ -360,7 +360,7 @@ declare namespace cloudbase.app {
360
360
  *
361
361
  * @return Promise-扩展能力插件执行结果
362
362
  */
363
- invokeExtension(name: string, opts: any): Promise<any>;
363
+ invokeExtension: (name: string, opts: any) => Promise<any>;
364
364
 
365
365
  eventBus: any;
366
366
 
@@ -434,7 +434,7 @@ declare namespace cloudbase.auth {
434
434
  * ```
435
435
  *
436
436
  */
437
- signInWithRedirect(): void;
437
+ signInWithRedirect: () => void;
438
438
  /**
439
439
  * 微信登录页面重定向回来后,使用重定向的返回值登录,并获取登录态
440
440
  *
@@ -463,10 +463,10 @@ declare namespace cloudbase.auth {
463
463
  *
464
464
  * @return Promise-登录态信息
465
465
  */
466
- getRedirectResult(options?: {
466
+ getRedirectResult: (options?: {
467
467
  createUser?: boolean;
468
468
  syncUserInfo?: boolean
469
- }): Promise<ILoginState>;
469
+ }) => Promise<ILoginState>;
470
470
  /**
471
471
  * 获取微信重定向绑定结果
472
472
  *
@@ -498,9 +498,9 @@ declare namespace cloudbase.auth {
498
498
  *
499
499
  * @return Promise-登录态信息
500
500
  */
501
- getLinkRedirectResult(options?: {
501
+ getLinkRedirectResult: (options?: {
502
502
  withUnionId?: boolean
503
- }): Promise<void>;
503
+ }) => Promise<void>;
504
504
  }
505
505
 
506
506
  interface ICustomAuthProvider {
@@ -530,7 +530,7 @@ declare namespace cloudbase.auth {
530
530
  *
531
531
  * @return Promise-登录态信息
532
532
  */
533
- signIn(ticket: string): Promise<ILoginState>;
533
+ signIn: (ticket: string) => Promise<ILoginState>;
534
534
  }
535
535
 
536
536
  interface IAnonymousAuthProvider {
@@ -555,7 +555,7 @@ declare namespace cloudbase.auth {
555
555
  *
556
556
  * @return Promise-登录态信息
557
557
  */
558
- signIn(): Promise<ILoginState>;
558
+ signIn: () => Promise<ILoginState>;
559
559
  }
560
560
  /**
561
561
  * User Info
@@ -690,7 +690,7 @@ declare namespace cloudbase.auth {
690
690
  *
691
691
  * @return Promise
692
692
  */
693
- linkWithTicket(ticket: string): Promise<void>;
693
+ linkWithTicket: (ticket: string) => Promise<void>;
694
694
  /**
695
695
  * 将当前账户与第三方鉴权提供方,以重定向的形式,进行绑定,绑定之后便可以通过第三方鉴权提供方登录当前的云开发账户
696
696
  *
@@ -714,7 +714,7 @@ declare namespace cloudbase.auth {
714
714
  * @param provider 第三方鉴权Provider实例
715
715
  *
716
716
  */
717
- linkWithRedirect(provider: any): void;
717
+ linkWithRedirect: (provider: any) => void;
718
718
  /**
719
719
  * 获取已绑定的用户信息
720
720
  *
@@ -734,7 +734,7 @@ declare namespace cloudbase.auth {
734
734
  *
735
735
  * @return Promise-已绑定的用户信息
736
736
  */
737
- getLinkedUidList(): Promise<{ hasPrimaryUid: boolean, users: IUserInfo[] }>;
737
+ getLinkedUidList: () => Promise<{ hasPrimaryUid: boolean, users: IUserInfo[] }>;
738
738
  /**
739
739
  * 设置微信主账号,通常搭配和 User.getLinkedUidList() 使用,用于在同个微信 UnionID 对应的多个云开发账号中,设置其中一个为主账号
740
740
  *
@@ -752,7 +752,7 @@ declare namespace cloudbase.auth {
752
752
  *
753
753
  * @return Promise
754
754
  */
755
- setPrimaryUid(uid: string): Promise<void>;
755
+ setPrimaryUid: (uid: string) => Promise<void>;
756
756
  /**
757
757
  * 解绑某个登录方式
758
758
  *
@@ -774,7 +774,7 @@ declare namespace cloudbase.auth {
774
774
  * @return Promise
775
775
  *
776
776
  */
777
- unlink(loginType: 'CUSTOM' | 'WECHAT-OPEN' | 'WECHAT-PUBLIC' | 'WECHAT-UNION' | 'EMAIL'): Promise<void>;
777
+ unlink: (loginType: 'CUSTOM' | 'WECHAT-OPEN' | 'WECHAT-PUBLIC' | 'WECHAT-UNION' | 'EMAIL') => Promise<void>;
778
778
  /**
779
779
  * 更新用户信息
780
780
  *
@@ -797,7 +797,7 @@ declare namespace cloudbase.auth {
797
797
  * @return Promise
798
798
  *
799
799
  */
800
- update(userinfo: IUserInfo): Promise<void>;
800
+ update: (userinfo: IUserInfo) => Promise<void>;
801
801
  /**
802
802
  * 刷新本地用户信息
803
803
  *
@@ -816,7 +816,7 @@ declare namespace cloudbase.auth {
816
816
  * @return Promise-刷新后的用户信息
817
817
  *
818
818
  */
819
- refresh(): Promise<IUserInfo>;
819
+ refresh: () => Promise<IUserInfo>;
820
820
  /**
821
821
  * 修改密码。如果用户之前没有设置过密码,那么无需填写 oldPassword
822
822
  *
@@ -839,7 +839,7 @@ declare namespace cloudbase.auth {
839
839
  *
840
840
  * @return Promise
841
841
  */
842
- updatePassword(newPassword: string, oldPassword?: string): Promise<void>;
842
+ updatePassword: (newPassword: string, oldPassword?: string) => Promise<void>;
843
843
  /**
844
844
  * 修改登录邮箱
845
845
  *
@@ -861,7 +861,7 @@ declare namespace cloudbase.auth {
861
861
  *
862
862
  * @return Promise
863
863
  */
864
- updateEmail(newEmail: string): Promise<void>;
864
+ updateEmail: (newEmail: string) => Promise<void>;
865
865
  /**
866
866
  * 修改用户名
867
867
  *
@@ -883,7 +883,7 @@ declare namespace cloudbase.auth {
883
883
  *
884
884
  * @return Promise
885
885
  */
886
- updateUsername(username: string): Promise<void>;
886
+ updateUsername: (username: string) => Promise<void>;
887
887
  }
888
888
 
889
889
  interface signInWithPhoneParams {
@@ -925,7 +925,7 @@ declare namespace cloudbase.auth {
925
925
  *
926
926
  * @return Promise-用户信息,如果未登录返回`null`
927
927
  */
928
- getCurrenUser(): Promise<IUser | null>
928
+ getCurrenUser: () => Promise<IUser | null>
929
929
  /**
930
930
  * 获取本地登录态-同步操作
931
931
  *
@@ -941,7 +941,7 @@ declare namespace cloudbase.auth {
941
941
  *
942
942
  * @return 登录态信息,如果未登录返回`null`
943
943
  */
944
- hasLoginState(): ILoginState | null;
944
+ hasLoginState: () => ILoginState | null;
945
945
  /**
946
946
  * 获取本地登录态-异步操作
947
947
  *
@@ -959,7 +959,7 @@ declare namespace cloudbase.auth {
959
959
  *
960
960
  * @return Promise-登录态信息,如果未登录返回`null`
961
961
  */
962
- getLoginState(): Promise<ILoginState | null>;
962
+ getLoginState: () => Promise<ILoginState | null>;
963
963
  /**
964
964
  * 获取 HTTP 鉴权header-同步操作
965
965
  *
@@ -975,7 +975,7 @@ declare namespace cloudbase.auth {
975
975
  *
976
976
  * @return HTTP鉴权header
977
977
  */
978
- getAuthHeader(): { 'x-cloudbase-credentials': string } | null;
978
+ getAuthHeader: () => { 'x-cloudbase-credentials': string } | null;
979
979
  /**
980
980
  * 获取 HTTP 鉴权header-异步操作
981
981
  *
@@ -993,7 +993,7 @@ declare namespace cloudbase.auth {
993
993
  *
994
994
  * @return Promise-HTTP鉴权header
995
995
  */
996
- getAuthHeaderAsync(): Promise<{ 'x-cloudbase-credentials': string } | null>;
996
+ getAuthHeaderAsync: () => Promise<{ 'x-cloudbase-credentials': string } | null>;
997
997
  /**
998
998
  * 监听登录状态改变事件
999
999
  *
@@ -1011,7 +1011,7 @@ declare namespace cloudbase.auth {
1011
1011
  *
1012
1012
  * @param callback 回调函数,当登录状态改变后被执行
1013
1013
  */
1014
- onLoginStateChanged(callback: Function): void;
1014
+ onLoginStateChanged: (callback: Function) => void;
1015
1015
  /**
1016
1016
  * 监听登录态过期事件
1017
1017
  *
@@ -1029,7 +1029,7 @@ declare namespace cloudbase.auth {
1029
1029
  *
1030
1030
  * @param callback 回调函数,当登录态过期后被执行
1031
1031
  */
1032
- onLoginStateExpired(callback: Function): void;
1032
+ onLoginStateExpired: (callback: Function) => void;
1033
1033
  /**
1034
1034
  * 监听令牌刷新事件
1035
1035
  *
@@ -1047,7 +1047,7 @@ declare namespace cloudbase.auth {
1047
1047
  *
1048
1048
  * @param callback 回调函数,当access_token刷新后被执行
1049
1049
  */
1050
- onAccessTokenRefreshed(callback: Function): void;
1050
+ onAccessTokenRefreshed: (callback: Function) => void;
1051
1051
  /**
1052
1052
  * 监听匿名转正事件
1053
1053
  *
@@ -1065,7 +1065,7 @@ declare namespace cloudbase.auth {
1065
1065
  *
1066
1066
  * @param callback 回调函数,当匿名用户被转化为正式用户后被执行
1067
1067
  */
1068
- onAnonymousConverted(callback: Function): void;
1068
+ onAnonymousConverted: (callback: Function) => void;
1069
1069
  /**
1070
1070
  * 监听登录类型改变事件
1071
1071
  *
@@ -1083,7 +1083,7 @@ declare namespace cloudbase.auth {
1083
1083
  *
1084
1084
  * @param callback 回调函数,当登录类型改变后被执行
1085
1085
  */
1086
- onLoginTypeChanged(callback: Function): void;
1086
+ onLoginTypeChanged: (callback: Function) => void;
1087
1087
  /**
1088
1088
  * 接收一个回调函数,并且会在刷新短期访问令牌前调用此回调函数,根据返回值决定是否要刷新短期访问令牌。
1089
1089
  *
@@ -1101,7 +1101,7 @@ declare namespace cloudbase.auth {
1101
1101
  *
1102
1102
  * @param callback 在刷新短期访问令牌前调用此回调函数
1103
1103
  */
1104
- shouldRefreshAccessToken(hook: Function): void;
1104
+ shouldRefreshAccessToken: (hook: Function) => void;
1105
1105
  /**
1106
1106
  * 创建微信登录Provider实例
1107
1107
  *
@@ -1124,10 +1124,10 @@ declare namespace cloudbase.auth {
1124
1124
  *
1125
1125
  * @return 微信登录Provider实例
1126
1126
  */
1127
- weixinAuthProvider(options: {
1127
+ weixinAuthProvider: (options: {
1128
1128
  appid: string;
1129
1129
  scope: 'snsapi_base' | 'snsapi_userinfo' | 'snsapi_login';
1130
- }): IWeixinAuthProvider;
1130
+ }) => IWeixinAuthProvider;
1131
1131
  /**
1132
1132
  * 创建自定义登录Provider实例
1133
1133
  *
@@ -1143,7 +1143,7 @@ declare namespace cloudbase.auth {
1143
1143
  *
1144
1144
  * @return 自定义登录Provider实例
1145
1145
  */
1146
- customAuthProvider(): ICustomAuthProvider;
1146
+ customAuthProvider: () => ICustomAuthProvider;
1147
1147
  /**
1148
1148
  * 创建匿名登录Provider实例
1149
1149
  *
@@ -1159,7 +1159,7 @@ declare namespace cloudbase.auth {
1159
1159
  *
1160
1160
  * @return 匿名登录Provider实例
1161
1161
  */
1162
- anonymousAuthProvider(): IAnonymousAuthProvider;
1162
+ anonymousAuthProvider: () => IAnonymousAuthProvider;
1163
1163
  /**
1164
1164
  * 退出登录,请注意,匿名登录不支持退出
1165
1165
  *
@@ -1175,7 +1175,7 @@ declare namespace cloudbase.auth {
1175
1175
  *
1176
1176
  * @return Promise
1177
1177
  */
1178
- signOut(): Promise<void>;
1178
+ signOut: () => Promise<void>;
1179
1179
  /**
1180
1180
  * 使用邮箱和密码登录云开发
1181
1181
  *
@@ -1199,7 +1199,7 @@ declare namespace cloudbase.auth {
1199
1199
  *
1200
1200
  * @return Promise-登录态信息
1201
1201
  */
1202
- signInWithEmailAndPassword(email: string, password: string): Promise<ILoginState>;
1202
+ signInWithEmailAndPassword: (email: string, password: string) => Promise<ILoginState>;
1203
1203
  /**
1204
1204
  * 使用邮箱和密码注册一个云开发账户,调用后,会自动向注册邮箱发送邮箱验证邮件
1205
1205
  *
@@ -1223,7 +1223,7 @@ declare namespace cloudbase.auth {
1223
1223
  *
1224
1224
  * @return Promise
1225
1225
  */
1226
- signUpWithEmailAndPassword(email: string, password: string): Promise<void>;
1226
+ signUpWithEmailAndPassword: (email: string, password: string) => Promise<void>;
1227
1227
  /**
1228
1228
  * 发送重置密码的邮件
1229
1229
  *
@@ -1245,7 +1245,7 @@ declare namespace cloudbase.auth {
1245
1245
  *
1246
1246
  * @return Promise
1247
1247
  */
1248
- sendPasswordResetEmail(email: string): Promise<void>;
1248
+ sendPasswordResetEmail: (email: string) => Promise<void>;
1249
1249
  /**
1250
1250
  * 使用用户名密码登录云开发
1251
1251
  *
@@ -1269,7 +1269,7 @@ declare namespace cloudbase.auth {
1269
1269
  *
1270
1270
  * @return Promise-登录态信息
1271
1271
  */
1272
- signInWithUsernameAndPassword(username: string, password: string): Promise<ILoginState>;
1272
+ signInWithUsernameAndPassword: (username: string, password: string) => Promise<ILoginState>;
1273
1273
  /**
1274
1274
  * 检查用户名是否被绑定过
1275
1275
  *
@@ -1291,13 +1291,13 @@ declare namespace cloudbase.auth {
1291
1291
  *
1292
1292
  * @return Promise-用户是否被绑定
1293
1293
  */
1294
- isUsernameRegistered(username: string): Promise<boolean>;
1294
+ isUsernameRegistered: (username: string) => Promise<boolean>;
1295
1295
 
1296
- sendPhoneCode(phoneNumber: string): Promise<boolean>;
1296
+ sendPhoneCode: (phoneNumber: string) => Promise<boolean>;
1297
1297
 
1298
- signUpWithPhoneCode(phoneNumber: string, phoneCode: string, password: string): Promise<void>;
1298
+ signUpWithPhoneCode: (phoneNumber: string, phoneCode: string, password: string) => Promise<void>;
1299
1299
 
1300
- signInWithPhoneCodeOrPassword(params: signInWithPhoneParams): Promise<ILoginState>;
1300
+ signInWithPhoneCodeOrPassword: (params: signInWithPhoneParams) => Promise<ILoginState>;
1301
1301
 
1302
1302
  }
1303
1303
  }
@@ -1471,7 +1471,7 @@ declare namespace cloudbase.database {
1471
1471
  *
1472
1472
  * @return 实时推送进程实例
1473
1473
  */
1474
- watch(options: IWatchOptions): DBRealtimeListener;
1474
+ watch: (options: IWatchOptions) => DBRealtimeListener;
1475
1475
  }
1476
1476
  /**
1477
1477
  * collection types
@@ -1484,7 +1484,7 @@ declare namespace cloudbase.database {
1484
1484
  *
1485
1485
  * @param data 文档数据
1486
1486
  */
1487
- add(data: object): Promise<Pick<SetRes, 'code' | 'message'>>;
1487
+ add: (data: object) => Promise<Pick<SetRes, 'code' | 'message'>>;
1488
1488
  /**
1489
1489
  * 获取一条文档的引用
1490
1490
  *
@@ -1492,7 +1492,7 @@ declare namespace cloudbase.database {
1492
1492
  *
1493
1493
  * @param id 文档ID
1494
1494
  */
1495
- doc(id: string): IDocument;
1495
+ doc: (id: string) => IDocument;
1496
1496
  }
1497
1497
  /**
1498
1498
  * command types
@@ -1523,7 +1523,7 @@ declare namespace cloudbase.database {
1523
1523
  * @param val 接受一个字面量 (literal),可以是 `number`, `boolean`, `string`, `object`, `array`
1524
1524
  *
1525
1525
  */
1526
- eq(val: number | string | boolean | object | any[]): any;
1526
+ eq: (val: number | string | boolean | object | any[]) => any;
1527
1527
  /**
1528
1528
  * 表示字段不等于某个值
1529
1529
  *
@@ -1538,7 +1538,7 @@ declare namespace cloudbase.database {
1538
1538
  * @param val 接受一个字面量 (literal),可以是 `number`, `boolean`, `string`, `object`, `array`
1539
1539
  *
1540
1540
  */
1541
- neq(val: number | string | boolean | object | any[]): any;
1541
+ neq: (val: number | string | boolean | object | any[]) => any;
1542
1542
  /**
1543
1543
  * 字段大于指定值
1544
1544
  *
@@ -1553,7 +1553,7 @@ declare namespace cloudbase.database {
1553
1553
  * @param val 数字
1554
1554
  *
1555
1555
  */
1556
- gt(val: number): any;
1556
+ gt: (val: number) => any;
1557
1557
  /**
1558
1558
  * 字段大于或等于指定值
1559
1559
  *
@@ -1568,7 +1568,7 @@ declare namespace cloudbase.database {
1568
1568
  * @param val 数字
1569
1569
  *
1570
1570
  */
1571
- gte(val: number): any;
1571
+ gte: (val: number) => any;
1572
1572
  /**
1573
1573
  * 字段小于指定值
1574
1574
  *
@@ -1583,7 +1583,7 @@ declare namespace cloudbase.database {
1583
1583
  * @param val 数字
1584
1584
  *
1585
1585
  */
1586
- lt(val: number): any;
1586
+ lt: (val: number) => any;
1587
1587
  /**
1588
1588
  * 字段小于或等于指定值
1589
1589
  *
@@ -1598,7 +1598,7 @@ declare namespace cloudbase.database {
1598
1598
  * @param val 数字
1599
1599
  *
1600
1600
  */
1601
- lte(val: number): any;
1601
+ lte: (val: number) => any;
1602
1602
  /**
1603
1603
  * 字段值在给定的数组中
1604
1604
  *
@@ -1613,7 +1613,7 @@ declare namespace cloudbase.database {
1613
1613
  * @param list 数组
1614
1614
  *
1615
1615
  */
1616
- in(list: any[]): any;
1616
+ in: (list: any[]) => any;
1617
1617
  /**
1618
1618
  * 字段值不在给定的数组中
1619
1619
  *
@@ -1628,7 +1628,7 @@ declare namespace cloudbase.database {
1628
1628
  * @param list 数组
1629
1629
  *
1630
1630
  */
1631
- nin(list: any[]): any;
1631
+ nin: (list: any[]) => any;
1632
1632
  /**
1633
1633
  * 表示需同时满足指定的两个或以上的条件
1634
1634
  *
@@ -1643,7 +1643,7 @@ declare namespace cloudbase.database {
1643
1643
  * @param args 多个条件
1644
1644
  *
1645
1645
  */
1646
- and(...args: any[]): any;
1646
+ and: (...args: any[]) => any;
1647
1647
  /**
1648
1648
  * 表示需满足所有指定条件中的至少一个
1649
1649
  *
@@ -1658,7 +1658,7 @@ declare namespace cloudbase.database {
1658
1658
  * @param args 多个条件
1659
1659
  *
1660
1660
  */
1661
- or(...args: any[]): any;
1661
+ or: (...args: any[]) => any;
1662
1662
  /**
1663
1663
  * 用于设定字段等于指定值
1664
1664
  *
@@ -1679,7 +1679,7 @@ declare namespace cloudbase.database {
1679
1679
  * @param val 被设定的属性对象
1680
1680
  *
1681
1681
  */
1682
- set(val: any): any;
1682
+ set: (val: any) => any;
1683
1683
  /**
1684
1684
  * 用于指示字段自增某个值
1685
1685
  *
@@ -1698,7 +1698,7 @@ declare namespace cloudbase.database {
1698
1698
  * @param val 自增的值
1699
1699
  *
1700
1700
  */
1701
- inc(val: number): any;
1701
+ inc: (val: number) => any;
1702
1702
  /**
1703
1703
  * 用于指示字段自乘某个值
1704
1704
  *
@@ -1717,7 +1717,7 @@ declare namespace cloudbase.database {
1717
1717
  * @param val 自乘的值
1718
1718
  *
1719
1719
  */
1720
- mul(val: number): any;
1720
+ mul: (val: number) => any;
1721
1721
  /**
1722
1722
  * 用于表示删除某个字段
1723
1723
  *
@@ -1732,7 +1732,7 @@ declare namespace cloudbase.database {
1732
1732
  * });
1733
1733
  *
1734
1734
  */
1735
- remove(): any;
1735
+ remove: () => any;
1736
1736
  /**
1737
1737
  * 向数组尾部追加元素
1738
1738
  *
@@ -1748,7 +1748,7 @@ declare namespace cloudbase.database {
1748
1748
  *
1749
1749
  * @param val 支持传入单个元素或数组
1750
1750
  */
1751
- push(val: any): any;
1751
+ push: (val: any) => any;
1752
1752
  /**
1753
1753
  * 删除数组尾部元素
1754
1754
  *
@@ -1763,7 +1763,7 @@ declare namespace cloudbase.database {
1763
1763
  * });
1764
1764
  *
1765
1765
  */
1766
- pop(): any;
1766
+ pop: () => any;
1767
1767
  /**
1768
1768
  * 向数组头部添加元素
1769
1769
  *
@@ -1779,7 +1779,7 @@ declare namespace cloudbase.database {
1779
1779
  *
1780
1780
  * @param val 支持传入单个元素或数组
1781
1781
  */
1782
- unshift(val: any): any;
1782
+ unshift: (val: any) => any;
1783
1783
  /**
1784
1784
  * 删除数组头部元素
1785
1785
  *
@@ -1794,7 +1794,7 @@ declare namespace cloudbase.database {
1794
1794
  * });
1795
1795
  *
1796
1796
  */
1797
- shift(): any;
1797
+ shift: () => any;
1798
1798
  /**
1799
1799
  * 按从近到远的顺序,找出字段值在给定点的附近的文档
1800
1800
  *
@@ -1815,7 +1815,7 @@ declare namespace cloudbase.database {
1815
1815
  * @param options.maxDistance 【可选】最大距离,米为单位
1816
1816
  * @param options.minDistance 【可选】最小距离,米为单位
1817
1817
  */
1818
- geoNear(options: IGeoNearOptions): any;
1818
+ geoNear: (options: IGeoNearOptions) => any;
1819
1819
  /**
1820
1820
  * 找出字段值在指定 Polygon / MultiPolygon 内的文档,无排序
1821
1821
  *
@@ -1834,7 +1834,7 @@ declare namespace cloudbase.database {
1834
1834
  * @param options
1835
1835
  * @param options.geometry 地理位置
1836
1836
  */
1837
- geoWithin(options: IGeoWithinOptions): any;
1837
+ geoWithin: (options: IGeoWithinOptions) => any;
1838
1838
  /**
1839
1839
  * 找出字段值和给定的地理位置图形相交的文档
1840
1840
  *
@@ -1851,7 +1851,7 @@ declare namespace cloudbase.database {
1851
1851
  * @param options
1852
1852
  * @param options.geometry 地理位置
1853
1853
  */
1854
- geoIntersects(options: IGeoIntersectsOptions): any;
1854
+ geoIntersects: (options: IGeoIntersectsOptions) => any;
1855
1855
  }
1856
1856
  /**
1857
1857
  * document types
@@ -1872,7 +1872,7 @@ declare namespace cloudbase.database {
1872
1872
  *
1873
1873
  * @return Promise
1874
1874
  */
1875
- set(data: object): Promise<SetRes>;
1875
+ set: (data: object) => Promise<SetRes>;
1876
1876
  /**
1877
1877
  * 获取查询结果
1878
1878
  *
@@ -1886,7 +1886,7 @@ declare namespace cloudbase.database {
1886
1886
  *
1887
1887
  * @return Promise-查询结果
1888
1888
  */
1889
- get(): Promise<GetRes>;
1889
+ get: () => Promise<GetRes>;
1890
1890
  /**
1891
1891
  * 更新文档,如果要更新的文档不存在什么也不会做
1892
1892
  *
@@ -1902,7 +1902,7 @@ declare namespace cloudbase.database {
1902
1902
  *
1903
1903
  * @return Promise
1904
1904
  */
1905
- update(data: object): Promise<SetRes>;
1905
+ update: (data: object) => Promise<SetRes>;
1906
1906
  /**
1907
1907
  * 删除一条文档
1908
1908
  *
@@ -1916,7 +1916,7 @@ declare namespace cloudbase.database {
1916
1916
  *
1917
1917
  * @return Promise
1918
1918
  */
1919
- remove(): Promise<any>;
1919
+ remove: () => Promise<any>;
1920
1920
  }
1921
1921
  /**
1922
1922
  * query types
@@ -1931,9 +1931,6 @@ declare namespace cloudbase.database {
1931
1931
  interface GetRes {
1932
1932
  data: any[];
1933
1933
  requestId: string;
1934
- total: number;
1935
- limit: number;
1936
- offset: number;
1937
1934
  code?: string;
1938
1935
  message?: string;
1939
1936
  }
@@ -1975,7 +1972,7 @@ declare namespace cloudbase.database {
1975
1972
  *
1976
1973
  * @return Promise-查询结果
1977
1974
  */
1978
- get(): Promise<GetRes>;
1975
+ get: () => Promise<GetRes>;
1979
1976
  /**
1980
1977
  * 更新数据库文档
1981
1978
  *
@@ -1993,7 +1990,7 @@ declare namespace cloudbase.database {
1993
1990
  *
1994
1991
  * @return Promise-查询结果
1995
1992
  */
1996
- update(data: any): Promise<UpdateRes>
1993
+ update: (data: any) => Promise<UpdateRes>
1997
1994
  /**
1998
1995
  * 获取数据库查询结果的数目
1999
1996
  *
@@ -2009,7 +2006,7 @@ declare namespace cloudbase.database {
2009
2006
  *
2010
2007
  * @return Promise-查询结果
2011
2008
  */
2012
- count(): Promise<any>;
2009
+ count: () => Promise<any>;
2013
2010
  /**
2014
2011
  * 设置过滤条件
2015
2012
  *
@@ -2024,7 +2021,7 @@ declare namespace cloudbase.database {
2024
2021
  * @param query 可接收对象作为参数,表示筛选出拥有和传入对象相同的 key-value 的文档
2025
2022
  *
2026
2023
  */
2027
- where(query: object): ExcludeOf<IQuery, 'where'>;
2024
+ where: (query: object) => ExcludeOf<IQuery, 'where'>;
2028
2025
  /**
2029
2026
  * 指定查询结果集数量上限
2030
2027
  *
@@ -2039,7 +2036,7 @@ declare namespace cloudbase.database {
2039
2036
  *
2040
2037
  * @param limit 查询结果数量上限
2041
2038
  */
2042
- limit(limit: number): ExcludeOf<IQuery, 'where'>;
2039
+ limit: (limit: number) => ExcludeOf<IQuery, 'where'>;
2043
2040
  /**
2044
2041
  * 指定查询返回结果时从指定序列后的结果开始返回,常用于分页
2045
2042
  *
@@ -2054,7 +2051,7 @@ declare namespace cloudbase.database {
2054
2051
  *
2055
2052
  * @param offset 跳过的条目数量
2056
2053
  */
2057
- skip(offset: number): ExcludeOf<IQuery, 'where'>;
2054
+ skip: (offset: number) => ExcludeOf<IQuery, 'where'>;
2058
2055
  /**
2059
2056
  * 指定查询排序条件
2060
2057
  *
@@ -2070,7 +2067,7 @@ declare namespace cloudbase.database {
2070
2067
  * @param field 排序的字段
2071
2068
  * @param orderType 排序的顺序,升序(asc) 或 降序(desc)
2072
2069
  */
2073
- orderBy(field: string, orderType: string): ExcludeOf<IQuery, 'where'>;
2070
+ orderBy: (field: string, orderType: string) => ExcludeOf<IQuery, 'where'>;
2074
2071
  /**
2075
2072
  * 指定返回结果中文档需返回的字段
2076
2073
  *
@@ -2085,7 +2082,7 @@ declare namespace cloudbase.database {
2085
2082
  *
2086
2083
  * @param projection 要过滤的字段集合,不返回传 false,返回传 true
2087
2084
  */
2088
- field(projection: object): ExcludeOf<IQuery, 'where'>;
2085
+ field: (projection: object) => ExcludeOf<IQuery, 'where'>;
2089
2086
  /**
2090
2087
  * 删除查询到的结果
2091
2088
  *
@@ -2100,7 +2097,7 @@ declare namespace cloudbase.database {
2100
2097
  *
2101
2098
  * @return Promise
2102
2099
  */
2103
- remove(): Promise<any>;
2100
+ remove: () => Promise<any>;
2104
2101
  }
2105
2102
  /**
2106
2103
  * geo types
@@ -2125,9 +2122,7 @@ declare namespace cloudbase.database {
2125
2122
  *
2126
2123
  * @return Point
2127
2124
  */
2128
- Point: {
2129
- new(longitude: number, latitude: number): IPoint;
2130
- };
2125
+ Point: new(longitude: number, latitude: number) => IPoint;
2131
2126
  /**
2132
2127
  * 用于表示地理路径,是由两个或者更多的 Point 组成的线段
2133
2128
  *
@@ -2140,9 +2135,7 @@ declare namespace cloudbase.database {
2140
2135
  *
2141
2136
  * @return LineString
2142
2137
  */
2143
- LineString: {
2144
- new(points: IPoint[]): ILineString;
2145
- }
2138
+ LineString: new(points: IPoint[]) => ILineString
2146
2139
  /**
2147
2140
  * 用于表示地理上的一个多边形
2148
2141
  *
@@ -2155,9 +2148,7 @@ declare namespace cloudbase.database {
2155
2148
  *
2156
2149
  * @return Polygon
2157
2150
  */
2158
- Polygon: {
2159
- new(lines: ILineString[]): IPolygon;
2160
- }
2151
+ Polygon: new(lines: ILineString[]) => IPolygon
2161
2152
  /**
2162
2153
  * 用于表示多个点 Point 的集合
2163
2154
  *
@@ -2170,9 +2161,7 @@ declare namespace cloudbase.database {
2170
2161
  *
2171
2162
  * @return MultiPoint
2172
2163
  */
2173
- MultiPoint: {
2174
- new(points: IPoint[]): IMultiPoint;
2175
- }
2164
+ MultiPoint: new(points: IPoint[]) => IMultiPoint
2176
2165
  /**
2177
2166
  * 用于表示多个地理路径 LineString 的集合
2178
2167
  *
@@ -2185,9 +2174,7 @@ declare namespace cloudbase.database {
2185
2174
  *
2186
2175
  * @return MultiLineString
2187
2176
  */
2188
- MultiLineString: {
2189
- new(lines: ILineString[]): IMultiLineString;
2190
- }
2177
+ MultiLineString: new(lines: ILineString[]) => IMultiLineString
2191
2178
  /**
2192
2179
  * 用于表示多个地理多边形 Polygon 的集合
2193
2180
  *
@@ -2200,9 +2187,7 @@ declare namespace cloudbase.database {
2200
2187
  *
2201
2188
  * @return MultiPolygon
2202
2189
  */
2203
- MultiPolygon: {
2204
- new(polygons: IPolygon[]): IMultiPolygon;
2205
- }
2190
+ MultiPolygon: new(polygons: IPolygon[]) => IMultiPolygon
2206
2191
  }
2207
2192
  /**
2208
2193
  * regexp types
@@ -2211,9 +2196,7 @@ declare namespace cloudbase.database {
2211
2196
  regexp: string;
2212
2197
  options?: string;
2213
2198
  }
2214
- interface IRegExp {
2215
- (options: IRegExpOptions): any;
2216
- }
2199
+ type IRegExp = (options: IRegExpOptions) => any;
2217
2200
  /**
2218
2201
  * instance types
2219
2202
  */
@@ -2260,7 +2243,7 @@ declare namespace cloudbase.database {
2260
2243
  *
2261
2244
  * @return 集合的引用
2262
2245
  */
2263
- collection(name: string): ICollection;
2246
+ collection: (name: string) => ICollection;
2264
2247
  }
2265
2248
  }
2266
2249