@cloudbase/types 2.21.2 → 2.21.4

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/functions.d.ts CHANGED
@@ -20,3 +20,21 @@ export interface ICallFunctionResponse {
20
20
 
21
21
  export type ICallFunction = (options: ICallFunctionOptions, callback?: Function) => Promise<ICallFunctionResponse>
22
22
 
23
+ export interface IRetryOptions {
24
+ retries?: number
25
+ factor?: number
26
+ minTimeout?: number
27
+ maxTimeout?: number
28
+ randomize?: boolean
29
+ timeouts?: number[]
30
+ timeoutOps?: {
31
+ timeout: number
32
+ cb: function
33
+ }
34
+ }
35
+
36
+ export interface ICustomReqOpts {
37
+ timeout?: number
38
+ retryOptions?: IRetryOptions
39
+ from?: 'node-sdk'
40
+ }
package/index.d.ts CHANGED
@@ -33,9 +33,9 @@ export interface ICloudbaseConfig {
33
33
  oauthInstance?: any
34
34
  wxCloud?: any
35
35
  i18n?: {
36
- t: (text: string) => string;
37
- LANG_HEADER_KEY: string;
38
- lang: LANGS;
36
+ t: (text: string) => string
37
+ LANG_HEADER_KEY: string
38
+ lang: LANGS
39
39
  }
40
40
  accessKey?: string
41
41
  endPointMode?: EndPointKey // auth请求域名模式,默认CLOUD_API
@@ -49,6 +49,12 @@ export interface ICloudbaseExtension {
49
49
  invoke: (opts: any, app: ICloudbase) => Promise<any>
50
50
  }
51
51
 
52
+ export interface ICloudbaseApis {
53
+ [apiName: string]: (apiName: string) => {
54
+ [method: string]: (callApiOptions: ICallApiOptions, opts: KV<any>) => Promise<ResponseObject['data']>
55
+ }
56
+ }
57
+
52
58
  export interface ICloudbase {
53
59
  config: ICloudbaseConfig
54
60
  platform: ICloudbasePlatformInfo
@@ -58,7 +64,7 @@ export interface ICloudbase {
58
64
  localCache: ICloudbaseCache
59
65
  authInstance?: ICloudbaseAuth
60
66
  oauthInstance?: any
61
- apis: { [key: string]: any }
67
+ apis: ICloudbaseApis
62
68
  init: (config: ICloudbaseConfig & { lang?: LANGS }) => ICloudbase
63
69
  updateConfig: (config: ICloudbaseUpgradedConfig) => void
64
70
  registerExtension: (ext: ICloudbaseExtension) => void
@@ -90,5 +96,5 @@ export interface ICallApiOptions {
90
96
  headers?: KV<any>
91
97
  /** 请求体,根据content-type可以是不同类型 */
92
98
  body?: KV<any> | string
93
- token?: string;
99
+ token?: string
94
100
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudbase/types",
3
- "version": "2.21.2",
3
+ "version": "2.21.4",
4
4
  "description": "cloudbase javascript sdk types",
5
5
  "files": [
6
6
  "index.js",
@@ -43,5 +43,5 @@
43
43
  "lint": "eslint --fix \"./**/*.ts\"",
44
44
  "precommit": "npm run lint"
45
45
  },
46
- "gitHead": "fdea3b2ed4be4126f24588f3a59f91235f28bc1e"
46
+ "gitHead": "0ff481fb86889f0c67fd9a72cbdd7998ae81bea7"
47
47
  }
package/storage.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { KVstring } from '.'
2
+ import { ICustomReqOpts } from './functions'
2
3
 
3
4
  export interface ICloudbaseUploadFileParams {
4
5
  cloudPath: string;
@@ -6,6 +7,9 @@ export interface ICloudbaseUploadFileParams {
6
7
  method?: 'post' | 'put';
7
8
  headers?: KVstring[];
8
9
  onUploadProgress?: Function;
10
+ // 文件内容 Buffer 或 文件可读流, node端使用
11
+ fileContent?: any;
12
+ customReqOpts?: ICustomReqOpts;
9
13
  }
10
14
 
11
15
  export interface ICloudbaseUploadFileByPutParams {
@@ -24,12 +28,14 @@ export type ICloudbaseUploadFile = (params: ICloudbaseUploadFileParams, callback
24
28
 
25
29
  export interface ICloudbaseGetUploadMetadataParams {
26
30
  cloudPath: string;
31
+ customReqOpts?: ICustomReqOpts;
27
32
  }
28
33
 
29
34
  export type ICloudbaseGetUploadMetadata = (params: ICloudbaseGetUploadMetadataParams, callback?: Function) => Promise<any>;
30
35
 
31
36
  export interface ICloudbaseDeleteFileParams {
32
37
  fileList: string[];
38
+ customReqOpts?: ICustomReqOpts;
33
39
  }
34
40
 
35
41
  export type ICloudbaseDeleteFile = (params: ICloudbaseDeleteFileParams, callback?: Function) => Promise<ICloudbaseDeleteFileResult>;
@@ -51,8 +57,8 @@ export interface ICloudbaseFileInfo {
51
57
 
52
58
  export interface ICloudbaseGetTempFileURLParams {
53
59
  fileList: string[] | ICloudbaseFileInfo[];
60
+ customReqOpts?: ICustomReqOpts;
54
61
  }
55
-
56
62
  export interface ICloudbaseGetTempFileURLResult {
57
63
  code?: string;
58
64
  message?: string;
@@ -66,11 +72,32 @@ export interface ICloudbaseGetTempFileURLResult {
66
72
  requestId?: string;
67
73
  }
68
74
 
75
+ export interface ICloudbaseCopyFileParams {
76
+ fileList: Array<{
77
+ srcPath: string
78
+ dstPath: string
79
+ overwrite?: boolean
80
+ removeOriginal?: boolean
81
+ }>
82
+ customReqOpts?: ICustomReqOpts;
83
+ }
84
+
85
+
86
+ export interface ICloudbaseCopyFileResult {
87
+ fileList: Array<{
88
+ fileId?: string
89
+ code?: string
90
+ message?: string
91
+ }>
92
+ requestId?: string;
93
+ }
94
+
69
95
  export type ICloudbaseGetTempFileURL = (params: ICloudbaseGetTempFileURLParams, callback?: Function) => Promise<ICloudbaseGetTempFileURLResult>;
70
96
 
71
97
  export interface ICloudbaseDownloadFileParams {
72
98
  fileID: string;
73
99
  tempFilePath?: string;
100
+ customReqOpts?: ICustomReqOpts;
74
101
  }
75
102
 
76
103
  export interface ICloudbaseDownloadFileResult {