@cloudbase/js-sdk 2.21.3 → 2.21.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/index.d.ts CHANGED
@@ -1,95 +1,95 @@
1
- import { CloudbaseAdapter } from '@cloudbase/adapter-interface';
2
- import { ICloudbaseUpgradedConfig, ICloudbase, Persistence } from '@cloudbase/types';
3
- import { OrmClient, OrmRawQueryClient } from '@cloudbase/model';
4
- import { authModels } from '@cloudbase/oauth';
5
- import { AI } from '@cloudbase/ai';
6
- import { LANGS } from '@cloudbase/types';
1
+ import { CloudbaseAdapter, ResponseObject } from '@cloudbase/adapter-interface'
2
+ import { ICloudbaseUpgradedConfig, ICloudbase, Persistence, ICloudbaseApis } from '@cloudbase/types'
3
+ import { OrmClient, OrmRawQueryClient } from '@cloudbase/model'
4
+ import { authModels } from '@cloudbase/oauth'
5
+ import { AI } from '@cloudbase/ai'
6
+ import { LANGS } from '@cloudbase/types'
7
+ import { ICustomReqOpts } from '@cloudbase/types/functions'
7
8
 
8
9
  type KV<T> = {
9
- [key: string]: T;
10
- };
10
+ [key: string]: T
11
+ }
11
12
 
12
- type ExcludeOf<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
13
+ type ExcludeOf<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>
13
14
 
14
15
  /**
15
16
  * module
16
17
  */
17
18
  declare namespace cloudbase {
18
-
19
19
  interface SimpleStorage {
20
- getItem: (key: string) => Promise<string | null>;
21
- removeItem: (key: string) => Promise<void>;
22
- setItem: (key: string, value: string) => Promise<void>;
23
- getItemSync: (key: string) => string | null;
24
- removeItemSync: (key: string) => void;
25
- setItemSync: (key: string, value: string) => void;
20
+ getItem: (key: string) => Promise<string | null>
21
+ removeItem: (key: string) => Promise<void>
22
+ setItem: (key: string, value: string) => Promise<void>
23
+ getItemSync: (key: string) => string | null
24
+ removeItemSync: (key: string) => void
25
+ setItemSync: (key: string, value: string) => void
26
26
  }
27
27
 
28
28
  interface ICloudbaseConfig {
29
- env: string;
30
- region?: string;
31
- timeout?: number;
32
- persistence?: Persistence;
29
+ env: string
30
+ region?: string
31
+ timeout?: number
32
+ persistence?: Persistence
33
33
  oauthClient?: any
34
- debug?: boolean;
35
- _fromApp?: ICloudbase;
34
+ debug?: boolean
35
+ _fromApp?: ICloudbase
36
36
  clientId?: string
37
- oauthInstance?: any;
37
+ oauthInstance?: any
38
38
  wxCloud?: any
39
39
  i18n?: {
40
- t: (text: string) => string;
41
- LANG_HEADER_KEY: string;
42
- lang: LANGS;
40
+ t: (text: string) => string
41
+ LANG_HEADER_KEY: string
42
+ lang: LANGS
43
43
  }
44
44
  accessKey?: string
45
45
  endPointMode?: EndPointKey
46
46
  }
47
47
 
48
48
  interface ICloudbaseExtension {
49
- name: string;
50
- invoke(opts: any, app: ICloudbase): Promise<any>;
49
+ name: string
50
+ invoke(opts: any, app: ICloudbase): Promise<any>
51
51
  }
52
52
 
53
53
  interface Listeners {
54
- [key: string]: Function[];
54
+ [key: string]: Function[]
55
55
  }
56
56
 
57
57
  interface ICloudbaseEvent {
58
- name: string;
59
- target: any;
60
- data: any;
58
+ name: string
59
+ target: any
60
+ data: any
61
61
  }
62
62
 
63
63
  interface ICloudbaseEventEmitter {
64
- on(name: string, listener: Function): this;
65
- off(name: string, listener: Function): this;
66
- fire(event: string | ICloudbaseEvent, data?: any): this;
64
+ on(name: string, listener: Function): this
65
+ off(name: string, listener: Function): this
66
+ fire(event: string | ICloudbaseEvent, data?: any): this
67
67
  }
68
68
 
69
69
  interface ICloudbaseComponent {
70
- name: string;
71
- entity: any;
72
- namespace?: string;
70
+ name: string
71
+ entity: any
72
+ namespace?: string
73
73
  injectEvents?: {
74
- bus: ICloudbaseEventEmitter,
75
- events: string[];
76
- };
74
+ bus: ICloudbaseEventEmitter
75
+ events: string[]
76
+ }
77
77
  IIFE?: boolean
78
78
  }
79
79
 
80
80
  interface ICloudbaseHook {
81
- entity: any;
82
- target: string;
81
+ entity: any
82
+ target: string
83
83
  }
84
84
 
85
- type EndPointKey = 'CLOUD_API' | 'GATEWAY';
85
+ type EndPointKey = 'CLOUD_API' | 'GATEWAY'
86
86
 
87
87
  interface ISetEndPointWithKey {
88
- key: EndPointKey;
89
- url?: string;
90
- protocol?: 'http' | 'https';
88
+ key: EndPointKey
89
+ url?: string
90
+ protocol?: 'http' | 'https'
91
91
  }
92
-
92
+
93
93
  /**
94
94
  * 初始化Cloudbase
95
95
  *
@@ -107,11 +107,11 @@ declare namespace cloudbase {
107
107
  *
108
108
  * @return {!cloudbase.app.App} 初始化成功的Cloudbase实例
109
109
  */
110
- function init(config: ICloudbaseConfig & { lang?: LANGS }): cloudbase.app.App;
110
+ function init(config: ICloudbaseConfig & { lang?: LANGS }): cloudbase.app.App
111
+
112
+ function updateConfig(config: ICloudbaseUpgradedConfig): void
111
113
 
112
- function updateConfig(config: ICloudbaseUpgradedConfig): void;
113
-
114
- function updateLang(lang: LANGS): void;
114
+ function updateLang(lang: LANGS): void
115
115
  /**
116
116
  * 使用适配器,使用方式参考 {@link https://docs.cloudbase.net/api-reference/webv3/adapter#%E7%AC%AC-1-%E6%AD%A5%E5%AE%89%E8%A3%85%E5%B9%B6%E5%BC%95%E5%85%A5%E9%80%82%E9%85%8D%E5%99%A8}
117
117
  *
@@ -127,7 +127,7 @@ declare namespace cloudbase {
127
127
  * @param adapters 适配器对象,入参可以为单个适配器对象,也可以是多个适配器对象的数组
128
128
  * @param options 适配器参数,可以在genAdapter中获取到该参数
129
129
  */
130
- function useAdapters(adapters: CloudbaseAdapter | CloudbaseAdapter[], options?: any): void;
130
+ function useAdapters(adapters: CloudbaseAdapter | CloudbaseAdapter[], options?: any): void
131
131
  /**
132
132
  * 注册扩展能力插件,使用方式参考 {@link https://docs.cloudbase.net/extension/abilities/image-examination.html#shi-yong-kuo-zhan}
133
133
  *
@@ -138,7 +138,7 @@ declare namespace cloudbase {
138
138
  *
139
139
  * @param ext 扩展能力插件对象
140
140
  */
141
- function registerExtension(ext: ICloudbaseExtension): void;
141
+ function registerExtension(ext: ICloudbaseExtension): void
142
142
  /**
143
143
  * 【谨慎操作】注册SDK的版本
144
144
  *
@@ -149,7 +149,7 @@ declare namespace cloudbase {
149
149
  *
150
150
  * @param version SDK版本
151
151
  */
152
- function registerVersion(version: string): void;
152
+ function registerVersion(version: string): void
153
153
  /**
154
154
  * 【谨慎操作】注册SDK的名称
155
155
  *
@@ -160,7 +160,7 @@ declare namespace cloudbase {
160
160
  *
161
161
  * @param name SDK名称
162
162
  */
163
- function registerSdkName(name: string): void;
163
+ function registerSdkName(name: string): void
164
164
  /**
165
165
  * 【谨慎操作】修改SDK请求的云开发服务地址
166
166
  *
@@ -172,21 +172,21 @@ declare namespace cloudbase {
172
172
  * @param url 服务地址
173
173
  * @param protocol 【可选】强制使用某种协议,默认与主站协议一致
174
174
  */
175
- function registerEndPoint(url: string, protocol?: 'http' | 'https'): void;
175
+ function registerEndPoint(url: string, protocol?: 'http' | 'https'): void
176
176
  /**
177
177
  * 【谨慎操作】修改SDK请求的「云开发/网关」服务地址
178
178
  *
179
179
  * @example
180
180
  * ```javascript
181
- * cloudbase.registerEndPointWithKey({
182
- * key: "GATEWAY",
183
- * url: "",
181
+ * cloudbase.registerEndPointWithKey({
182
+ * key: "GATEWAY",
183
+ * url: "",
184
184
  * protocol: ""
185
185
  * });
186
186
  * ```
187
187
  *
188
188
  */
189
- function registerEndPointWithKey(props: ISetEndPointWithKey): void;
189
+ function registerEndPointWithKey(props: ISetEndPointWithKey): void
190
190
  /**
191
191
  * 【谨慎操作】注册功能模块
192
192
  *
@@ -197,7 +197,7 @@ declare namespace cloudbase {
197
197
  *
198
198
  * @param component 功能模块对象
199
199
  */
200
- function registerComponent(component: ICloudbaseComponent): void;
200
+ function registerComponent(component: ICloudbaseComponent): void
201
201
  /**
202
202
  * 【谨慎操作】注册hook
203
203
  *
@@ -208,9 +208,9 @@ declare namespace cloudbase {
208
208
  *
209
209
  * @param hook hook对象
210
210
  */
211
- function registerHook(hook: ICloudbaseHook): void;
211
+ function registerHook(hook: ICloudbaseHook): void
212
212
 
213
- export interface models extends OrmClient, OrmRawQueryClient { }
213
+ export interface models extends OrmClient, OrmRawQueryClient {}
214
214
  }
215
215
  /**
216
216
  * instance
@@ -237,9 +237,7 @@ declare namespace cloudbase.app {
237
237
  *
238
238
  * @return {!cloudbase.auth.App} Auth实例
239
239
  */
240
- auth(options?: {
241
- persistence: cloudbase.auth.Persistence
242
- }): cloudbase.auth.App;
240
+ auth(options?: { persistence: cloudbase.auth.Persistence }): cloudbase.auth.App
243
241
  /**
244
242
  * 调用云函数
245
243
  *
@@ -268,7 +266,49 @@ declare namespace cloudbase.app {
268
266
  *
269
267
  * @return Promise-函数执行结果
270
268
  */
271
- callFunction(options: cloudbase.functions.ICallFunctionOptions, callback?: Function): Promise<cloudbase.functions.ICallFunctionResponse>;
269
+ callFunction(
270
+ options: cloudbase.functions.ICallFunctionOptions,
271
+ callback?: Function,
272
+ customReqOpts?: ICustomReqOpts,
273
+ ): Promise<cloudbase.functions.ICallFunctionResponse>
274
+ /**
275
+ * 调用云托管
276
+ *
277
+ * {@link https://docs.cloudbase.net/api-reference/webv3/cloudrun}
278
+ *
279
+ * @example
280
+ * ```javascript
281
+ * const app = cloudbase.init({
282
+ * env: 'your-envid'
283
+ * });
284
+ * app
285
+ * .callContainer({
286
+ * name: 'helloworld',
287
+ * method: 'POST',
288
+ * path: '/abc',
289
+ * header:{
290
+ * 'Content-Type': 'application/json; charset=utf-8'
291
+ * },
292
+ * data: {
293
+ * key1: 'test value 1',
294
+ * key2: 'test value 2'
295
+ * },
296
+ * })
297
+ * .then((res) => {
298
+ * console.log(res)
299
+ * });
300
+ * ```
301
+ *
302
+ * @param options 被调用的云托管信息
303
+ * @param options.name 云托管的名称
304
+ * @param options.data 【可选】云托管的参数,默认为空
305
+ *
306
+ * @return Promise-云托管执行结果
307
+ */
308
+ callContainer(
309
+ options: cloudbase.functions.ICallFunctionOptions,
310
+ customReqOpts?: ICustomReqOpts,
311
+ ): Promise<ResponseObject>
272
312
  /**
273
313
  * 云存储-上传文件
274
314
  *
@@ -299,7 +339,10 @@ declare namespace cloudbase.app {
299
339
  *
300
340
  * @return Promise-上传结果
301
341
  */
302
- uploadFile(params: cloudbase.storage.ICloudbaseUploadFileParams, callback?: Function): Promise<cloudbase.storage.ICloudbaseUploadFileResult>;
342
+ uploadFile(
343
+ params: cloudbase.storage.ICloudbaseUploadFileParams,
344
+ callback?: Function,
345
+ ): Promise<cloudbase.storage.ICloudbaseUploadFileResult>
303
346
  /**
304
347
  * 云存储-下载文件
305
348
  *
@@ -320,7 +363,40 @@ declare namespace cloudbase.app {
320
363
  *
321
364
  * @return Promise-下载结果
322
365
  */
323
- downloadFile(params: cloudbase.storage.ICloudbaseDownloadFileParams, callback?: Function): Promise<cloudbase.storage.ICloudbaseDownloadFileResult>;
366
+ downloadFile(
367
+ params: cloudbase.storage.ICloudbaseDownloadFileParams,
368
+ callback?: Function,
369
+ ): Promise<cloudbase.storage.ICloudbaseDownloadFileResult>
370
+ /**
371
+ * 云存储-批量复制文件
372
+ *
373
+ *
374
+ * @example
375
+ * ```javascript
376
+ * const app = cloudbase.init({
377
+ * env: 'your-envid'
378
+ * });
379
+ * app.copyFile({
380
+ * fileList: [
381
+ * {
382
+ * srcPath: '源文件的绝对路径,包含文件名。例如 foo/bar.jpg、foo/bar/baz.jpg 等,不能包含除[0-9 , a-z , A-Z]、/、!、-、_、.、、*和中文以外的字符,使用 / 字符来实现类似传统文件系统的层级结构',
383
+ * dstPath: '目标文件的绝对路径,包含文件名。例如 foo/bar.jpg、foo/bar/baz.jpg 等,不能包含除[0-9 , a-z , A-Z]、/、!、-、_、.、、*和中文以外的字符,使用 / 字符来实现类似传统文件系统的层级结构',
384
+ * overwrite: '当目标文件已经存在时,是否允许覆盖已有文件,默认 true',
385
+ * removeOriginal: '复制文件后是否删除源文件,默认 false'
386
+ * }
387
+ * ]
388
+ * });
389
+ * ```
390
+ *
391
+ * @param params
392
+ * @param params.fileList 要复制的文件信息组成的数组
393
+ *
394
+ * @return Promise-复制结果
395
+ */
396
+ copyFile(
397
+ params: cloudbase.storage.ICloudbaseCopyFileParams,
398
+ callback?: Function,
399
+ ): Promise<cloudbase.storage.ICloudbaseCopyFileResult>
324
400
  /**
325
401
  * 云存储-获取文件的下载链接
326
402
  *
@@ -349,7 +425,10 @@ declare namespace cloudbase.app {
349
425
  *
350
426
  * @return Promise-文件下载链接
351
427
  */
352
- getTempFileURL(params: cloudbase.storage.ICloudbaseGetTempFileURLParams, callback?: Function): Promise<cloudbase.storage.ICloudbaseGetTempFileURLResult>;
428
+ getTempFileURL(
429
+ params: cloudbase.storage.ICloudbaseGetTempFileURLParams,
430
+ callback?: Function,
431
+ ): Promise<cloudbase.storage.ICloudbaseGetTempFileURLResult>
353
432
  /**
354
433
  * 云存储-删除文件
355
434
  *
@@ -373,15 +452,23 @@ declare namespace cloudbase.app {
373
452
  *
374
453
  * @return Promise-删除结果
375
454
  */
376
- deleteFile(params: cloudbase.storage.ICloudbaseDeleteFileParams, callback?: Function): Promise<cloudbase.storage.ICloudbaseDeleteFileResult>;
455
+ deleteFile(
456
+ params: cloudbase.storage.ICloudbaseDeleteFileParams,
457
+ callback?: Function,
458
+ ): Promise<cloudbase.storage.ICloudbaseDeleteFileResult>
459
+
460
+ getFileInfo(
461
+ params: cloudbase.storage.ICloudbaseGetTempFileURLParams,
462
+ callback?: Function,
463
+ ): Promise<cloudbase.storage.ICloudbaseGetTempFileURLResult>
377
464
  /**
378
465
  * 云存储-获取上传元信息
379
- *
380
- *
381
- * @param params
382
- * @param callback
466
+ *
467
+ *
468
+ * @param params
469
+ * @param callback
383
470
  */
384
- getUploadMetadata(params: cloudbase.storage.ICloudbaseGetUploadMetadataParams, callback?: Function): Promise<any>;
471
+ getUploadMetadata(params: cloudbase.storage.ICloudbaseGetUploadMetadataParams, callback?: Function): Promise<any>
385
472
  /**
386
473
  * 获取数据库实例
387
474
  *
@@ -397,7 +484,7 @@ declare namespace cloudbase.app {
397
484
  *
398
485
  * @return 数据库实例
399
486
  */
400
- database(): cloudbase.database.App;
487
+ database(dbConfig?: object): cloudbase.database.App
401
488
  /**
402
489
  * 调用扩展能力插件功能
403
490
  *
@@ -419,9 +506,9 @@ declare namespace cloudbase.app {
419
506
  *
420
507
  * @return Promise-扩展能力插件执行结果
421
508
  */
422
- invokeExtension(name: string, opts: any): Promise<any>;
509
+ invokeExtension(name: string, opts: any): Promise<any>
423
510
 
424
- eventBus: any;
511
+ eventBus: any
425
512
 
426
513
  /**
427
514
  * 调用 数据模型 SDK
@@ -440,63 +527,65 @@ declare namespace cloudbase.app {
440
527
  models.$runSQL() // 执行原生 SQL 语句
441
528
  * ```
442
529
  */
443
- models: OrmClient & OrmRawQueryClient;
530
+ models: OrmClient & OrmRawQueryClient
444
531
 
445
- ai(): AI;
532
+ ai(): AI
533
+
534
+ apis: ICloudbaseApis
446
535
  }
447
536
  }
448
537
  /**
449
538
  * auth
450
539
  */
451
540
  declare namespace cloudbase.auth {
452
- type Persistence = 'local' | 'session' | 'none';
541
+ type Persistence = 'local' | 'session' | 'none'
453
542
 
454
543
  interface IAccessTokenInfo {
455
- accessToken: string;
456
- env: string;
544
+ accessToken: string
545
+ env: string
457
546
  }
458
547
 
459
548
  interface ILoginState {
460
549
  /**
461
550
  * 当前登录用户的信息
462
551
  */
463
- user: IUser;
552
+ user: IUser
464
553
  }
465
554
 
466
555
  interface ICredential {
467
- accessToken?: string;
468
- accessTokenExpire?: string;
556
+ accessToken?: string
557
+ accessTokenExpire?: string
469
558
  }
470
559
 
471
560
  interface IAuthProvider {
472
- signInWithRedirect: () => any;
561
+ signInWithRedirect: () => any
473
562
  }
474
563
 
475
564
  /**
476
565
  * 用户信息
477
566
  */
478
567
  interface IUserInfo {
479
- uid?: string;
480
- loginType?: string;
481
- openid?: string;
482
- wxOpenId?: string;
483
- wxPublicId?: string;
484
- unionId?: string;
485
- qqMiniOpenId?: string;
486
- customUserId?: string;
487
- name?: string;
488
- gender?: string;
489
- email?: string;
490
- username?: string;
491
- hasPassword?: boolean;
568
+ uid?: string
569
+ loginType?: string
570
+ openid?: string
571
+ wxOpenId?: string
572
+ wxPublicId?: string
573
+ unionId?: string
574
+ qqMiniOpenId?: string
575
+ customUserId?: string
576
+ name?: string
577
+ gender?: string
578
+ email?: string
579
+ username?: string
580
+ hasPassword?: boolean
492
581
  location?: {
493
- country?: string;
494
- province?: string;
495
- city?: string;
496
- };
497
- country?: string;
498
- province?: string;
499
- city?: string;
582
+ country?: string
583
+ province?: string
584
+ city?: string
585
+ }
586
+ country?: string
587
+ province?: string
588
+ city?: string
500
589
  }
501
590
 
502
591
  interface IUser extends IUserInfo {
@@ -522,7 +611,7 @@ declare namespace cloudbase.auth {
522
611
  * @return Promise
523
612
  *
524
613
  */
525
- update(userinfo: IUserInfo): Promise<void>;
614
+ update(userinfo: IUserInfo): Promise<void>
526
615
  /**
527
616
  * 刷新本地用户信息
528
617
  *
@@ -541,20 +630,20 @@ declare namespace cloudbase.auth {
541
630
  * @return Promise-刷新后的用户信息
542
631
  *
543
632
  */
544
- refresh(): Promise<IUserInfo>;
633
+ refresh(): Promise<IUserInfo>
545
634
  /**
546
635
  * 同步获取本地用户信息
547
636
  */
548
- checkLocalInfo: () => void;
637
+ checkLocalInfo: () => void
549
638
  /**
550
639
  * 异步获取本地用户信息
551
640
  */
552
- checkLocalInfoAsync: () => Promise<void>;
553
- linkWithTicket?: (ticket: string) => Promise<void>;
554
- linkWithRedirect?: (provider: IAuthProvider) => void;
555
- getLinkedUidList?: () => Promise<{ hasPrimaryUid: boolean, users: IUserInfo[] }>;
556
- setPrimaryUid?: (uid: string) => Promise<void>;
557
- unlink?: (loginType: 'CUSTOM' | 'WECHAT-OPEN' | 'WECHAT-PUBLIC' | 'WECHAT-UNION') => Promise<void>;
641
+ checkLocalInfoAsync: () => Promise<void>
642
+ linkWithTicket?: (ticket: string) => Promise<void>
643
+ linkWithRedirect?: (provider: IAuthProvider) => void
644
+ getLinkedUidList?: () => Promise<{ hasPrimaryUid: boolean; users: IUserInfo[] }>
645
+ setPrimaryUid?: (uid: string) => Promise<void>
646
+ unlink?: (loginType: 'CUSTOM' | 'WECHAT-OPEN' | 'WECHAT-PUBLIC' | 'WECHAT-UNION') => Promise<void>
558
647
  }
559
648
 
560
649
  interface App {
@@ -573,7 +662,7 @@ declare namespace cloudbase.auth {
573
662
  *
574
663
  * @return 用户信息,如果未登录返回`null`
575
664
  */
576
- currentUser: IUser | null;
665
+ currentUser: IUser | null
577
666
  /**
578
667
  * 获取当前登录的用户信息-异步操作,文档 {@link https://docs.cloudbase.net/api-reference/webv3/authentication#authgetcurrentuser}
579
668
  *
@@ -592,90 +681,90 @@ declare namespace cloudbase.auth {
592
681
  getCurrentUser(): Promise<IUser | null>
593
682
  /**
594
683
  * 绑定手机号码
595
- *
684
+ *
596
685
  * 文档 {@link https://docs.cloudbase.net/api-reference/webv3/authentication#authbindphonenumber}
597
- *
598
- * @param params
686
+ *
687
+ * @param params
599
688
  */
600
689
  bindPhoneNumber(params: authModels.BindPhoneRequest): Promise<void>
601
690
  /**
602
691
  * 绑定邮箱
603
- *
692
+ *
604
693
  * 文档 {@link https://docs.cloudbase.net/api-reference/webv3/authentication#authbindemail}
605
- *
606
- * @param params
694
+ *
695
+ * @param params
607
696
  */
608
697
  bindEmail(params: authModels.BindEmailRequest): Promise<void>
609
698
  /**
610
699
  * 解除三方绑定
611
- *
700
+ *
612
701
  * 文档 {@link https://docs.cloudbase.net/api-reference/webv3/authentication#authunbindprovider}
613
- *
614
- * @param params
702
+ *
703
+ * @param params
615
704
  */
616
705
  unbindProvider(params: authModels.UnbindProviderRequest): Promise<void>
617
706
 
618
707
  /**
619
708
  * 验证码验证
620
- *
709
+ *
621
710
  * 文档 {@link https://docs.cloudbase.net/api-reference/webv3/authentication#authverify}
622
- *
623
- * @param params
711
+ *
712
+ * @param params
624
713
  */
625
714
  verify(params: authModels.VerifyRequest): Promise<authModels.VerifyResponse>
626
715
  /**
627
716
  * 获取验证码
628
- *
717
+ *
629
718
  * 文档 {@link https://docs.cloudbase.net/api-reference/webv3/authentication#authgetverification}
630
- *
631
- * @param params
719
+ *
720
+ * @param params
632
721
  */
633
722
  getVerification(params: authModels.GetVerificationRequest): Promise<authModels.GetVerificationResponse>
634
723
  /**
635
724
  * 匿名登录
636
- *
637
- *
725
+ *
726
+ *
638
727
  * 文档 {@link https://docs.cloudbase.net/api-reference/webv3/authentication#authsigninanonymously}
639
- *
728
+ *
640
729
  */
641
730
  signInAnonymously(data?: { provider_token?: string }): Promise<ILoginState>
642
731
  /**
643
732
  * 设置获取自定义登录 ticket 的函数
644
- *
733
+ *
645
734
  * 文档 {@link https://docs.cloudbase.net/api-reference/webv3/authentication#authsetcustomsignfunc}
646
- *
647
- *
648
- * @param getTickFn
735
+ *
736
+ *
737
+ * @param getTickFn
649
738
  */
650
739
  setCustomSignFunc(getTickFn: authModels.GetCustomSignTicketFn): void
651
740
  /**
652
741
  * 使用自定义登录 ticket 登录
653
- *
742
+ *
654
743
  * 文档 {@link https://docs.cloudbase.net/api-reference/webv3/authentication#authsigninwithcustomticket}
655
744
  */
656
745
  signInWithCustomTicket(): Promise<ILoginState>
657
746
  /**
658
747
  * 用户登录,目前支持手机号,邮箱,用户名密码登录
659
- *
748
+ *
660
749
  * 文档 {@link https://docs.cloudbase.net/api-reference/webv3/authentication#authsignin}
661
750
  */
662
751
  signIn(params: authModels.SignInRequest): Promise<ILoginState>
663
752
  /**
664
753
  * 用户注册,目前支持手机号验证码注册,邮箱验证码注册
665
- *
754
+ *
666
755
  * 文档 {@link https://docs.cloudbase.net/api-reference/webv3/authentication#authsignup}
667
756
  */
668
757
  signUp(params: authModels.SignUpRequest): Promise<ILoginState>
669
758
  /**
670
759
  * 设置密码(已登录状态下,更新用户密码)
671
- *
760
+ *
672
761
  * 文档 {@link https://docs.cloudbase.net/api-reference/webv3/authentication#authsetpassword}
673
- *
762
+ *
674
763
  */
675
764
  setPassword(params: authModels.SetPasswordRequest): Promise<void>
676
765
  /**
677
766
  * 获取用户信息
678
- *
767
+ *
679
768
  * 文档 {@link https://docs.cloudbase.net/api-reference/webv3/authentication#authgetuserinfo}
680
769
  */
681
770
  getUserInfo(): Promise<IUserInfo>
@@ -694,7 +783,7 @@ declare namespace cloudbase.auth {
694
783
  *
695
784
  * @return 登录态信息,如果未登录返回`null`
696
785
  */
697
- hasLoginState(): ILoginState | null;
786
+ hasLoginState(): ILoginState | null
698
787
  /**
699
788
  * 获取本地登录态-异步操作
700
789
  *
@@ -712,78 +801,80 @@ declare namespace cloudbase.auth {
712
801
  *
713
802
  * @return Promise-登录态信息,如果未登录返回`null`
714
803
  */
715
- getLoginState(): Promise<ILoginState | null>;
804
+ getLoginState(): Promise<ILoginState | null>
716
805
  /**
717
806
  * @deprecated
718
807
  */
719
808
  getAuthHeader(): {}
720
809
  /**
721
810
  * 为已有账户绑定第三方账户
722
- *
811
+ *
723
812
  * 文档 {@link https://docs.cloudbase.net/api-reference/webv3/authentication#authbindwithprovider}
724
813
  */
725
- bindWithProvider(params: authModels.BindWithProviderRequest,): Promise<void>
814
+ bindWithProvider(params: authModels.BindWithProviderRequest): Promise<void>
726
815
  /**
727
816
  * 查询用户(自定义登录场景和匿名登录场景,不支持使用该接口查询用户信息)
728
- *
817
+ *
729
818
  * 文档 {@link https://docs.cloudbase.net/api-reference/webv3/authentication#authqueryuser}
730
- *
819
+ *
731
820
  */
732
821
  queryUser(queryObj: authModels.QueryUserProfileRequest): Promise<authModels.QueryUserProfileResponse>
733
822
  /**
734
823
  * 获取当前登录用户的访问凭证
735
- *
824
+ *
736
825
  * 文档 {@link https://docs.cloudbase.net/api-reference/webv3/authentication#authgetaccesstoken}
737
826
  */
738
- getAccessToken(): Promise<{ accessToken: string, env: string }>
827
+ getAccessToken(): Promise<{ accessToken: string; env: string }>
739
828
  /**
740
829
  * 提供第三方平台登录 token
741
- *
830
+ *
742
831
  * 文档 {@link https://docs.cloudbase.net/api-reference/webv3/authentication#authgrantprovidertoken}
743
832
  */
744
833
  grantProviderToken(params: authModels.GrantProviderTokenRequest): Promise<authModels.GrantProviderTokenResponse>
745
834
  patchProviderToken(params: authModels.PatchProviderTokenRequest): Promise<authModels.PatchProviderTokenResponse>
746
835
  /**
747
836
  * 第三方平台登录
748
- *
837
+ *
749
838
  * 文档 {@link https://docs.cloudbase.net/api-reference/webv3/authentication#authsigninwithprovider}
750
839
  */
751
840
  signInWithProvider(params: authModels.SignInWithProviderRequest): Promise<ILoginState>
752
841
  grantToken(params: authModels.GrantTokenRequest): Promise<ILoginState>
753
842
  /**
754
843
  * 生成第三方平台授权 Uri (如微信二维码扫码授权网页)
755
- *
844
+ *
756
845
  * 文档 {@link https://docs.cloudbase.net/api-reference/webv3/authentication#authgenproviderredirecturi}
757
846
  */
758
- genProviderRedirectUri(params: authModels.GenProviderRedirectUriRequest): Promise<authModels.GenProviderRedirectUriResponse>
847
+ genProviderRedirectUri(
848
+ params: authModels.GenProviderRedirectUriRequest,
849
+ ): Promise<authModels.GenProviderRedirectUriResponse>
759
850
  /**
760
851
  * 重置密码(用户忘记密码无法登录时,可使用该接口强制设置密码)
761
- *
852
+ *
762
853
  * 文档 {@link https://docs.cloudbase.net/api-reference/webv3/authentication#authresetpassword}
763
854
  */
764
855
  resetPassword(params: authModels.ResetPasswordRequest): Promise<void>
765
856
  deviceAuthorize(params: authModels.DeviceAuthorizeRequest): Promise<authModels.DeviceAuthorizeResponse>
766
857
  /**
767
858
  * 通过 sudo 接口获取高级操作权限,如修改用户密码,修改手机号,邮箱等操作
768
- *
859
+ *
769
860
  * 文档 {@link https://docs.cloudbase.net/api-reference/webv3/authentication#authsudo}
770
861
  */
771
862
  sudo(params: authModels.SudoRequest): Promise<authModels.SudoResponse>
772
863
  /**
773
864
  * 删除用户
774
- *
865
+ *
775
866
  * 文档 {@link https://docs.cloudbase.net/api-reference/webv3/authentication#authdeleteme}
776
867
  */
777
868
  deleteMe(params: authModels.WithSudoRequest): Promise<authModels.UserProfile>
778
869
  /**
779
870
  * 获取第三方绑定列表
780
- *
871
+ *
781
872
  * 文档 {@link https://docs.cloudbase.net/api-reference/webv3/authentication#authgetproviders}
782
873
  */
783
874
  getProviders(): Promise<authModels.UserProfileProvider>
784
875
  /**
785
876
  * 用于查询用户是否为匿名登录状态
786
- *
877
+ *
787
878
  * 文档 {@link https://docs.cloudbase.net/api-reference/webv3/authentication#authloginscope}
788
879
  */
789
880
  loginScope(): Promise<string>
@@ -805,7 +896,7 @@ declare namespace cloudbase.auth {
805
896
  *
806
897
  * @return Promise
807
898
  */
808
- signOut(): Promise<void>;
899
+ signOut(): Promise<void>
809
900
  /**
810
901
  * 检查用户名是否被绑定过
811
902
  *
@@ -827,9 +918,11 @@ declare namespace cloudbase.auth {
827
918
  *
828
919
  * @return Promise-用户是否被绑定
829
920
  */
830
- isUsernameRegistered(username: string): Promise<boolean>;
921
+ isUsernameRegistered(username: string): Promise<boolean>
831
922
  getMiniProgramQrCode(params: authModels.GetMiniProgramCodeRequest): Promise<authModels.GetMiniProgramCodeResponse>
832
- getMiniProgramQrCodeStatus(params: authModels.CheckMiniProgramCodeRequest): Promise<authModels.CheckMiniProgramCodeResponse>
923
+ getMiniProgramQrCodeStatus(
924
+ params: authModels.CheckMiniProgramCodeRequest,
925
+ ): Promise<authModels.CheckMiniProgramCodeResponse>
833
926
  }
834
927
  }
835
928
  /**
@@ -837,16 +930,16 @@ declare namespace cloudbase.auth {
837
930
  */
838
931
  declare namespace cloudbase.functions {
839
932
  interface ICallFunctionOptions {
840
- name: string;
841
- data?: KV<any>;
842
- query?: KV<any>;
843
- search?: string;
844
- parse?: boolean;
933
+ name: string
934
+ data?: KV<any>
935
+ query?: KV<any>
936
+ search?: string
937
+ parse?: boolean
845
938
  }
846
939
 
847
940
  interface ICallFunctionResponse {
848
- requestId: string;
849
- result: any;
941
+ requestId: string
942
+ result: any
850
943
  }
851
944
  }
852
945
  /**
@@ -854,75 +947,101 @@ declare namespace cloudbase.functions {
854
947
  */
855
948
  declare namespace cloudbase.storage {
856
949
  interface ICloudbaseUploadFileParams {
857
- cloudPath: string;
858
- filePath: string;
859
- method?: 'post' | 'put';
860
- headers?: KV<string>;
861
- onUploadProgress?: Function;
950
+ cloudPath: string
951
+ filePath?: string
952
+ method?: 'post' | 'put'
953
+ headers?: KV<string>
954
+ onUploadProgress?: Function
955
+ // 文件内容 Buffer 或 文件可读流, node端使用
956
+ fileContent?: any
957
+ customReqOpts?: ICustomReqOpts
862
958
  }
863
959
  interface ICloudbaseUploadFileResult {
864
- fileID: string;
865
- requestId: string;
960
+ fileID: string
961
+ requestId: string
866
962
  }
867
963
  interface ICloudbaseGetUploadMetadataParams {
868
- cloudPath: string;
964
+ cloudPath: string
965
+ customReqOpts?: ICustomReqOpts
869
966
  }
870
967
  interface ICloudbaseDeleteFileParams {
871
- fileList: string[];
968
+ fileList: string[]
969
+ customReqOpts?: ICustomReqOpts
872
970
  }
873
971
  interface ICloudbaseDeleteFileResult {
874
- code?: string;
875
- message?: string;
972
+ code?: string
973
+ message?: string
876
974
  fileList?: {
877
- code?: string;
878
- fileID: string;
879
- }[];
880
- requestId?: string;
975
+ code?: string
976
+ fileID: string
977
+ }[]
978
+ requestId?: string
881
979
  }
882
980
 
883
981
  interface ICloudbaseFileInfo {
884
- fileID: string;
885
- maxAge: number;
982
+ fileID: string
983
+ maxAge: number
886
984
  }
887
985
 
888
986
  interface ICloudbaseGetTempFileURLParams {
889
- fileList: string[] | ICloudbaseFileInfo[];
987
+ fileList: string[] | ICloudbaseFileInfo[]
988
+ customReqOpts?: ICustomReqOpts
890
989
  }
891
990
 
892
991
  interface ICloudbaseGetTempFileURLResult {
893
- code?: string;
894
- message?: string;
992
+ code?: string
993
+ message?: string
895
994
  fileList?: {
896
- code?: string;
897
- message?: string;
898
- fileID: string;
899
- tempFileURL: string;
900
- download_url?: string;
901
- }[];
902
- requestId?: string;
995
+ code?: string
996
+ message?: string
997
+ fileID: string
998
+ tempFileURL: string
999
+ download_url?: string
1000
+ }[]
1001
+ requestId?: string
903
1002
  }
904
1003
  interface ICloudbaseDownloadFileParams {
905
- fileID: string;
906
- tempFilePath?: string;
1004
+ fileID: string
1005
+ tempFilePath?: string
1006
+ customReqOpts?: ICustomReqOpts
907
1007
  }
908
1008
  interface ICloudbaseDownloadFileResult {
909
- code?: string;
910
- message?: string;
911
- fileContent?: any;
912
- requestId?: string;
1009
+ code?: string
1010
+ message?: string
1011
+ fileContent?: any
1012
+ requestId?: string
913
1013
  }
914
1014
  interface ICloudbaseFileMetaData {
915
- url: string;
916
- token: string;
917
- authorization: string;
918
- fileId: string;
919
- cosFileId: string;
1015
+ url: string
1016
+ token: string
1017
+ authorization: string
1018
+ fileId: string
1019
+ cosFileId: string
920
1020
  download_url: string
921
1021
  }
922
1022
 
923
1023
  interface ICloudbaseFileMetaDataRes {
924
- data: ICloudbaseFileMetaData;
925
- requestId: string;
1024
+ data: ICloudbaseFileMetaData
1025
+ requestId: string
1026
+ }
1027
+
1028
+ interface ICloudbaseCopyFileParams {
1029
+ fileList: Array<{
1030
+ srcPath: string
1031
+ dstPath: string
1032
+ overwrite?: boolean
1033
+ removeOriginal?: boolean
1034
+ }>
1035
+ customReqOpts?: ICustomReqOpts
1036
+ }
1037
+
1038
+ interface ICloudbaseCopyFileResult {
1039
+ fileList: Array<{
1040
+ fileId?: string
1041
+ code?: string
1042
+ message?: string
1043
+ }>
1044
+ requestId?: string
926
1045
  }
927
1046
  }
928
1047
 
@@ -960,8 +1079,8 @@ declare namespace cloudbase.database {
960
1079
  */
961
1080
  close: () => void
962
1081
  }
963
- type DataType = 'init' | 'update' | 'add' | 'remove' | 'replace' | 'limit';
964
- type QueueType = 'init' | 'enqueue' | 'dequeue' | 'update';
1082
+ type DataType = 'init' | 'update' | 'add' | 'remove' | 'replace' | 'limit'
1083
+ type QueueType = 'init' | 'enqueue' | 'dequeue' | 'update'
965
1084
  interface ISnapshot {
966
1085
  id: number
967
1086
  docChanges: ISingleDBEvent[]
@@ -979,7 +1098,7 @@ declare namespace cloudbase.database {
979
1098
  removedFields?: any
980
1099
  }
981
1100
 
982
- type SnapshotType = 'init';
1101
+ type SnapshotType = 'init'
983
1102
 
984
1103
  interface IWatchable {
985
1104
  /**
@@ -1005,7 +1124,7 @@ declare namespace cloudbase.database {
1005
1124
  *
1006
1125
  * @return 实时推送进程实例
1007
1126
  */
1008
- watch(options: IWatchOptions): DBRealtimeListener;
1127
+ watch(options: IWatchOptions): DBRealtimeListener
1009
1128
  }
1010
1129
  /**
1011
1130
  * collection types
@@ -1018,7 +1137,7 @@ declare namespace cloudbase.database {
1018
1137
  *
1019
1138
  * @param data 文档数据
1020
1139
  */
1021
- add(data: Object): Promise<Pick<SetRes, 'code' | 'message'>>;
1140
+ add(data: Object): Promise<Pick<SetRes, 'code' | 'message'>>
1022
1141
  /**
1023
1142
  * 获取一条文档的引用
1024
1143
  *
@@ -1026,7 +1145,7 @@ declare namespace cloudbase.database {
1026
1145
  *
1027
1146
  * @param id 文档ID
1028
1147
  */
1029
- doc(id: string): IDocument;
1148
+ doc(id: string): IDocument
1030
1149
  }
1031
1150
  /**
1032
1151
  * command types
@@ -1040,7 +1159,7 @@ declare namespace cloudbase.database {
1040
1159
  geometry: IPolygon | IMultiPolygon
1041
1160
  }
1042
1161
  interface IGeoIntersectsOptions {
1043
- geometry: IPoint | ILineString | IMultiPoint | IMultiLineString | IPolygon | IMultiPolygon;
1162
+ geometry: IPoint | ILineString | IMultiPoint | IMultiLineString | IPolygon | IMultiPolygon
1044
1163
  }
1045
1164
  interface ICommand {
1046
1165
  /**
@@ -1057,7 +1176,7 @@ declare namespace cloudbase.database {
1057
1176
  * @param val 接受一个字面量 (literal),可以是 `number`, `boolean`, `string`, `object`, `array`
1058
1177
  *
1059
1178
  */
1060
- eq(val: number | string | boolean | Object | any[]): any;
1179
+ eq(val: number | string | boolean | Object | any[]): any
1061
1180
  /**
1062
1181
  * 表示字段不等于某个值
1063
1182
  *
@@ -1072,7 +1191,7 @@ declare namespace cloudbase.database {
1072
1191
  * @param val 接受一个字面量 (literal),可以是 `number`, `boolean`, `string`, `object`, `array`
1073
1192
  *
1074
1193
  */
1075
- neq(val: number | string | boolean | Object | any[]): any;
1194
+ neq(val: number | string | boolean | Object | any[]): any
1076
1195
  /**
1077
1196
  * 字段大于指定值
1078
1197
  *
@@ -1087,7 +1206,7 @@ declare namespace cloudbase.database {
1087
1206
  * @param val 数字
1088
1207
  *
1089
1208
  */
1090
- gt(val: number): any;
1209
+ gt(val: number): any
1091
1210
  /**
1092
1211
  * 字段大于或等于指定值
1093
1212
  *
@@ -1102,7 +1221,7 @@ declare namespace cloudbase.database {
1102
1221
  * @param val 数字
1103
1222
  *
1104
1223
  */
1105
- gte(val: number): any;
1224
+ gte(val: number): any
1106
1225
  /**
1107
1226
  * 字段小于指定值
1108
1227
  *
@@ -1117,7 +1236,7 @@ declare namespace cloudbase.database {
1117
1236
  * @param val 数字
1118
1237
  *
1119
1238
  */
1120
- lt(val: number): any;
1239
+ lt(val: number): any
1121
1240
  /**
1122
1241
  * 字段小于或等于指定值
1123
1242
  *
@@ -1132,7 +1251,7 @@ declare namespace cloudbase.database {
1132
1251
  * @param val 数字
1133
1252
  *
1134
1253
  */
1135
- lte(val: number): any;
1254
+ lte(val: number): any
1136
1255
  /**
1137
1256
  * 字段值在给定的数组中
1138
1257
  *
@@ -1147,7 +1266,7 @@ declare namespace cloudbase.database {
1147
1266
  * @param list 数组
1148
1267
  *
1149
1268
  */
1150
- in(list: any[]): any;
1269
+ in(list: any[]): any
1151
1270
  /**
1152
1271
  * 字段值不在给定的数组中
1153
1272
  *
@@ -1162,7 +1281,7 @@ declare namespace cloudbase.database {
1162
1281
  * @param list 数组
1163
1282
  *
1164
1283
  */
1165
- nin(list: any[]): any;
1284
+ nin(list: any[]): any
1166
1285
  /**
1167
1286
  * 表示需同时满足指定的两个或以上的条件
1168
1287
  *
@@ -1177,7 +1296,7 @@ declare namespace cloudbase.database {
1177
1296
  * @param args 多个条件
1178
1297
  *
1179
1298
  */
1180
- and(...args: any[]): any;
1299
+ and(...args: any[]): any
1181
1300
  /**
1182
1301
  * 表示需满足所有指定条件中的至少一个
1183
1302
  *
@@ -1192,7 +1311,7 @@ declare namespace cloudbase.database {
1192
1311
  * @param args 多个条件
1193
1312
  *
1194
1313
  */
1195
- or(...args: any[]): any;
1314
+ or(...args: any[]): any
1196
1315
  /**
1197
1316
  * 用于设定字段等于指定值
1198
1317
  *
@@ -1213,7 +1332,7 @@ declare namespace cloudbase.database {
1213
1332
  * @param val 被设定的属性对象
1214
1333
  *
1215
1334
  */
1216
- set(val: any): any;
1335
+ set(val: any): any
1217
1336
  /**
1218
1337
  * 用于指示字段自增某个值
1219
1338
  *
@@ -1232,7 +1351,7 @@ declare namespace cloudbase.database {
1232
1351
  * @param val 自增的值
1233
1352
  *
1234
1353
  */
1235
- inc(val: number): any;
1354
+ inc(val: number): any
1236
1355
  /**
1237
1356
  * 用于指示字段自乘某个值
1238
1357
  *
@@ -1251,7 +1370,7 @@ declare namespace cloudbase.database {
1251
1370
  * @param val 自乘的值
1252
1371
  *
1253
1372
  */
1254
- mul(val: number): any;
1373
+ mul(val: number): any
1255
1374
  /**
1256
1375
  * 用于表示删除某个字段
1257
1376
  *
@@ -1266,7 +1385,7 @@ declare namespace cloudbase.database {
1266
1385
  * });
1267
1386
  *
1268
1387
  */
1269
- remove(): any;
1388
+ remove(): any
1270
1389
  /**
1271
1390
  * 向数组尾部追加元素
1272
1391
  *
@@ -1282,7 +1401,7 @@ declare namespace cloudbase.database {
1282
1401
  *
1283
1402
  * @param val 支持传入单个元素或数组
1284
1403
  */
1285
- push(val: any): any;
1404
+ push(val: any): any
1286
1405
  /**
1287
1406
  * 删除数组尾部元素
1288
1407
  *
@@ -1297,7 +1416,7 @@ declare namespace cloudbase.database {
1297
1416
  * });
1298
1417
  *
1299
1418
  */
1300
- pop(): any;
1419
+ pop(): any
1301
1420
  /**
1302
1421
  * 向数组头部添加元素
1303
1422
  *
@@ -1313,7 +1432,7 @@ declare namespace cloudbase.database {
1313
1432
  *
1314
1433
  * @param val 支持传入单个元素或数组
1315
1434
  */
1316
- unshift(val: any): any;
1435
+ unshift(val: any): any
1317
1436
  /**
1318
1437
  * 删除数组头部元素
1319
1438
  *
@@ -1328,7 +1447,7 @@ declare namespace cloudbase.database {
1328
1447
  * });
1329
1448
  *
1330
1449
  */
1331
- shift(): any;
1450
+ shift(): any
1332
1451
  /**
1333
1452
  * 按从近到远的顺序,找出字段值在给定点的附近的文档
1334
1453
  *
@@ -1349,7 +1468,7 @@ declare namespace cloudbase.database {
1349
1468
  * @param options.maxDistance 【可选】最大距离,米为单位
1350
1469
  * @param options.minDistance 【可选】最小距离,米为单位
1351
1470
  */
1352
- geoNear(options: IGeoNearOptions): any;
1471
+ geoNear(options: IGeoNearOptions): any
1353
1472
  /**
1354
1473
  * 找出字段值在指定 Polygon / MultiPolygon 内的文档,无排序
1355
1474
  *
@@ -1368,7 +1487,7 @@ declare namespace cloudbase.database {
1368
1487
  * @param options
1369
1488
  * @param options.geometry 地理位置
1370
1489
  */
1371
- geoWithin(options: IGeoWithinOptions): any;
1490
+ geoWithin(options: IGeoWithinOptions): any
1372
1491
  /**
1373
1492
  * 找出字段值和给定的地理位置图形相交的文档
1374
1493
  *
@@ -1385,7 +1504,7 @@ declare namespace cloudbase.database {
1385
1504
  * @param options
1386
1505
  * @param options.geometry 地理位置
1387
1506
  */
1388
- geoIntersects(options: IGeoIntersectsOptions): any;
1507
+ geoIntersects(options: IGeoIntersectsOptions): any
1389
1508
  }
1390
1509
  /**
1391
1510
  * document types
@@ -1406,7 +1525,7 @@ declare namespace cloudbase.database {
1406
1525
  *
1407
1526
  * @return Promise
1408
1527
  */
1409
- set(data: Object): Promise<SetRes>;
1528
+ set(data: Object): Promise<SetRes>
1410
1529
  /**
1411
1530
  * 获取查询结果
1412
1531
  *
@@ -1420,7 +1539,7 @@ declare namespace cloudbase.database {
1420
1539
  *
1421
1540
  * @return Promise-查询结果
1422
1541
  */
1423
- get(): Promise<GetRes>;
1542
+ get(): Promise<GetRes>
1424
1543
  /**
1425
1544
  * 更新文档,如果要更新的文档不存在什么也不会做
1426
1545
  *
@@ -1436,7 +1555,7 @@ declare namespace cloudbase.database {
1436
1555
  *
1437
1556
  * @return Promise
1438
1557
  */
1439
- update(data: Object): Promise<SetRes>;
1558
+ update(data: Object): Promise<SetRes>
1440
1559
  /**
1441
1560
  * 删除一条文档
1442
1561
  *
@@ -1450,31 +1569,31 @@ declare namespace cloudbase.database {
1450
1569
  *
1451
1570
  * @return Promise
1452
1571
  */
1453
- remove(): Promise<any>;
1572
+ remove(): Promise<any>
1454
1573
  }
1455
1574
  /**
1456
1575
  * query types
1457
1576
  */
1458
1577
  interface SetRes {
1459
- code?: string;
1460
- message?: string;
1461
- updated?: number;
1462
- upsertedId?: number;
1463
- requestId: string;
1578
+ code?: string
1579
+ message?: string
1580
+ updated?: number
1581
+ upsertedId?: number
1582
+ requestId: string
1464
1583
  }
1465
1584
  interface GetRes {
1466
- data: any[];
1467
- requestId: string;
1468
- code?: string;
1469
- message?: string;
1585
+ data: any[]
1586
+ requestId: string
1587
+ code?: string
1588
+ message?: string
1470
1589
  }
1471
1590
 
1472
1591
  interface UpdateRes {
1473
1592
  requestId: string
1474
1593
  updated?: number
1475
1594
  upsertId?: string
1476
- code?: string;
1477
- message?: string;
1595
+ code?: string
1596
+ message?: string
1478
1597
  }
1479
1598
 
1480
1599
  interface QueryOrder {
@@ -1506,7 +1625,7 @@ declare namespace cloudbase.database {
1506
1625
  *
1507
1626
  * @return Promise-查询结果
1508
1627
  */
1509
- get(): Promise<GetRes>;
1628
+ get(): Promise<GetRes>
1510
1629
  /**
1511
1630
  * 更新数据库文档
1512
1631
  *
@@ -1540,7 +1659,7 @@ declare namespace cloudbase.database {
1540
1659
  *
1541
1660
  * @return Promise-查询结果
1542
1661
  */
1543
- count(): Promise<any>;
1662
+ count(): Promise<any>
1544
1663
  /**
1545
1664
  * 设置过滤条件
1546
1665
  *
@@ -1555,7 +1674,7 @@ declare namespace cloudbase.database {
1555
1674
  * @param query 可接收对象作为参数,表示筛选出拥有和传入对象相同的 key-value 的文档
1556
1675
  *
1557
1676
  */
1558
- where(query: Object): ExcludeOf<IQuery, 'where'>;
1677
+ where(query: Object): ExcludeOf<IQuery, 'where'>
1559
1678
  /**
1560
1679
  * 指定查询结果集数量上限
1561
1680
  *
@@ -1570,7 +1689,7 @@ declare namespace cloudbase.database {
1570
1689
  *
1571
1690
  * @param limit 查询结果数量上限
1572
1691
  */
1573
- limit(limit: number): ExcludeOf<IQuery, 'where'>;
1692
+ limit(limit: number): ExcludeOf<IQuery, 'where'>
1574
1693
  /**
1575
1694
  * 指定查询返回结果时从指定序列后的结果开始返回,常用于分页
1576
1695
  *
@@ -1585,7 +1704,7 @@ declare namespace cloudbase.database {
1585
1704
  *
1586
1705
  * @param offset 跳过的条目数量
1587
1706
  */
1588
- skip(offset: number): ExcludeOf<IQuery, 'where'>;
1707
+ skip(offset: number): ExcludeOf<IQuery, 'where'>
1589
1708
  /**
1590
1709
  * 指定查询排序条件
1591
1710
  *
@@ -1601,7 +1720,7 @@ declare namespace cloudbase.database {
1601
1720
  * @param field 排序的字段
1602
1721
  * @param orderType 排序的顺序,升序(asc) 或 降序(desc)
1603
1722
  */
1604
- orderBy(field: string, orderType: 'desc' | 'asc'): ExcludeOf<IQuery, 'where'>;
1723
+ orderBy(field: string, orderType: 'desc' | 'asc'): ExcludeOf<IQuery, 'where'>
1605
1724
  /**
1606
1725
  * 指定返回结果中文档需返回的字段
1607
1726
  *
@@ -1616,7 +1735,7 @@ declare namespace cloudbase.database {
1616
1735
  *
1617
1736
  * @param projection 要过滤的字段集合,不返回传 false,返回传 true
1618
1737
  */
1619
- field(projection: Object): ExcludeOf<IQuery, 'where'>;
1738
+ field(projection: Object): ExcludeOf<IQuery, 'where'>
1620
1739
  /**
1621
1740
  * 删除查询到的结果
1622
1741
  *
@@ -1631,17 +1750,17 @@ declare namespace cloudbase.database {
1631
1750
  *
1632
1751
  * @return Promise
1633
1752
  */
1634
- remove(): Promise<any>;
1753
+ remove(): Promise<any>
1635
1754
  }
1636
1755
  /**
1637
1756
  * geo types
1638
1757
  */
1639
- interface IPoint { }
1640
- interface ILineString { }
1641
- interface IPolygon { }
1642
- interface IMultiPoint { }
1643
- interface IMultiLineString { }
1644
- interface IMultiPolygon { }
1758
+ interface IPoint {}
1759
+ interface ILineString {}
1760
+ interface IPolygon {}
1761
+ interface IMultiPoint {}
1762
+ interface IMultiLineString {}
1763
+ interface IMultiPolygon {}
1645
1764
  interface IGeo {
1646
1765
  /**
1647
1766
  * 用于表示地理位置点
@@ -1657,8 +1776,8 @@ declare namespace cloudbase.database {
1657
1776
  * @return Point
1658
1777
  */
1659
1778
  Point: {
1660
- new(longitude: number, latitude: number): IPoint;
1661
- };
1779
+ new (longitude: number, latitude: number): IPoint
1780
+ }
1662
1781
  /**
1663
1782
  * 用于表示地理路径,是由两个或者更多的 Point 组成的线段
1664
1783
  *
@@ -1672,7 +1791,7 @@ declare namespace cloudbase.database {
1672
1791
  * @return LineString
1673
1792
  */
1674
1793
  LineString: {
1675
- new(points: IPoint[]): ILineString;
1794
+ new (points: IPoint[]): ILineString
1676
1795
  }
1677
1796
  /**
1678
1797
  * 用于表示地理上的一个多边形
@@ -1687,7 +1806,7 @@ declare namespace cloudbase.database {
1687
1806
  * @return Polygon
1688
1807
  */
1689
1808
  Polygon: {
1690
- new(lines: ILineString[]): IPolygon;
1809
+ new (lines: ILineString[]): IPolygon
1691
1810
  }
1692
1811
  /**
1693
1812
  * 用于表示多个点 Point 的集合
@@ -1702,7 +1821,7 @@ declare namespace cloudbase.database {
1702
1821
  * @return MultiPoint
1703
1822
  */
1704
1823
  MultiPoint: {
1705
- new(points: IPoint[]): IMultiPoint;
1824
+ new (points: IPoint[]): IMultiPoint
1706
1825
  }
1707
1826
  /**
1708
1827
  * 用于表示多个地理路径 LineString 的集合
@@ -1717,7 +1836,7 @@ declare namespace cloudbase.database {
1717
1836
  * @return MultiLineString
1718
1837
  */
1719
1838
  MultiLineString: {
1720
- new(lines: ILineString[]): IMultiLineString;
1839
+ new (lines: ILineString[]): IMultiLineString
1721
1840
  }
1722
1841
  /**
1723
1842
  * 用于表示多个地理多边形 Polygon 的集合
@@ -1732,18 +1851,18 @@ declare namespace cloudbase.database {
1732
1851
  * @return MultiPolygon
1733
1852
  */
1734
1853
  MultiPolygon: {
1735
- new(polygons: IPolygon[]): IMultiPolygon;
1854
+ new (polygons: IPolygon[]): IMultiPolygon
1736
1855
  }
1737
1856
  }
1738
1857
  /**
1739
1858
  * regexp types
1740
1859
  */
1741
1860
  interface IRegExpOptions {
1742
- regexp: string;
1743
- options?: string;
1861
+ regexp: string
1862
+ options?: string
1744
1863
  }
1745
1864
  interface IRegExp {
1746
- (options: IRegExpOptions): any;
1865
+ (options: IRegExpOptions): any
1747
1866
  }
1748
1867
  /**
1749
1868
  * instance types
@@ -1754,13 +1873,13 @@ declare namespace cloudbase.database {
1754
1873
  *
1755
1874
  * {@link https://docs.cloudbase.net/api-reference/webv3/database#%E6%9F%A5%E8%AF%A2%E6%8C%87%E4%BB%A4}
1756
1875
  */
1757
- command: ICommand;
1876
+ command: ICommand
1758
1877
  /**
1759
1878
  * 数据库Geo地理位置
1760
1879
  *
1761
1880
  * {@link https://docs.cloudbase.net/api-reference/webv3/database.html#geo-shu-ju-lei-xing}
1762
1881
  */
1763
- Geo: IGeo;
1882
+ Geo: IGeo
1764
1883
  /**
1765
1884
  * 根据正则表达式进行筛选
1766
1885
  *
@@ -1778,7 +1897,7 @@ declare namespace cloudbase.database {
1778
1897
  * @param options.regexp 正则表达式Pattern
1779
1898
  * @param options.options 正则表达式Flags
1780
1899
  */
1781
- RegExp: IRegExp;
1900
+ RegExp: IRegExp
1782
1901
  /**
1783
1902
  * 创建集合的引用
1784
1903
  *
@@ -1791,10 +1910,9 @@ declare namespace cloudbase.database {
1791
1910
  *
1792
1911
  * @return 集合的引用
1793
1912
  */
1794
- collection(name: string): ICollection;
1913
+ collection(name: string): ICollection
1795
1914
  }
1796
1915
  }
1797
1916
 
1798
-
1799
- export default cloudbase;
1800
- export as namespace cloudbase;
1917
+ export default cloudbase
1918
+ export as namespace cloudbase