@cloudbase/types 2.22.1 → 2.22.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
@@ -3,6 +3,7 @@ import { ICloudbaseComponent, ICloudbaseHook } from './component'
3
3
  import { ICloudbaseRequest } from './request'
4
4
  import { ICloudbaseCache } from './cache'
5
5
  import { ICloudbaseAuth } from './auth'
6
+ import { cloudbase } from '../cloudbase/index'
6
7
 
7
8
  export enum LANGS {
8
9
  ZH = 'zh-CN',
@@ -49,9 +50,10 @@ export interface ICloudbaseExtension {
49
50
  invoke: (opts: any, app: ICloudbase) => Promise<any>
50
51
  }
51
52
 
53
+ declare type MethodType = 'request' | 'post' | 'get' | 'head' | 'patch' | 'delete' | 'put'
52
54
  export interface ICloudbaseApis {
53
- [apiName: string]: (apiName: string) => {
54
- [method: string]: (callApiOptions: ICallApiOptions, opts: KV<any>) => Promise<ResponseObject['data']>
55
+ [apiName: string]: {
56
+ [method in MethodType]: (callApiOptions: ICallApiOptions, opts?: KV<any>) => Promise<ResponseObject['data']>
55
57
  }
56
58
  }
57
59
 
@@ -65,7 +67,7 @@ export interface ICloudbase {
65
67
  authInstance?: ICloudbaseAuth
66
68
  oauthInstance?: any
67
69
  apis: ICloudbaseApis
68
- init: (config: ICloudbaseConfig & { lang?: LANGS }) => ICloudbase
70
+ init: (config: ICloudbaseConfig & { lang?: LANGS }) => cloudbase.app
69
71
  updateConfig: (config: ICloudbaseUpgradedConfig) => void
70
72
  registerExtension: (ext: ICloudbaseExtension) => void
71
73
  invokeExtension: (name: string, opts: any) => Promise<any>
@@ -78,7 +80,8 @@ export interface ICloudbase {
78
80
  getEndPointWithKey?: (key: EndPointKey) => {
79
81
  BASE_URL: string;
80
82
  PROTOCOL: string;
81
- }
83
+ },
84
+ auth?: (options?: { persistence: cloudbase.auth.Persistence }) => cloudbase.auth.App
82
85
  }
83
86
  export interface ICloudbasePlatformInfo {
84
87
  adapter?: SDKAdapterInterface
@@ -93,7 +96,7 @@ export interface IGenericError<T extends string, P = any> extends Error {
93
96
 
94
97
  export interface ICallApiOptions {
95
98
  /** api标识 */
96
- name: string
99
+ name?: string
97
100
  /** 请求的path */
98
101
  path?: string
99
102
  method?: string
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudbase/types",
3
- "version": "2.22.1",
3
+ "version": "2.22.3",
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": "46ebb16422f02fb8cef279ad16d590ad6115abe1"
46
+ "gitHead": "2e0a972561cc2505e9a2a1cbe92804b40de1ee7f"
47
47
  }
package/storage.d.ts CHANGED
@@ -115,7 +115,9 @@ export interface ICloudbaseFileMetaData {
115
115
  authorization: string;
116
116
  fileId: string;
117
117
  cosFileId: string;
118
- download_url: string
118
+ download_url: string;
119
+ code?: string;
120
+ message?: string;
119
121
  }
120
122
 
121
123
  export interface ICloudbaseFileMetaDataRes {