@cloudbase/types 2.23.3 → 2.24.0

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/auth.d.ts CHANGED
@@ -1,78 +1,93 @@
1
1
  import { ICloudbaseConfig, KV, ICloudbase } from '.'
2
+ import { UserInfo } from '@cloudbase/oauth'
2
3
 
3
- export type ICloudbaseAuthConfig = Pick<ICloudbaseConfig, 'env' | 'clientId' | 'region' | 'persistence' | 'debug' | '_fromApp' | 'oauthInstance' | 'wxCloud' | 'i18n' | 'accessKey' | 'useWxCloud'>;
4
+ export type ICloudbaseAuthConfig = Pick<
5
+ ICloudbaseConfig,
6
+ | 'env'
7
+ | 'clientId'
8
+ | 'region'
9
+ | 'persistence'
10
+ | 'debug'
11
+ | '_fromApp'
12
+ | 'oauthInstance'
13
+ | 'wxCloud'
14
+ | 'i18n'
15
+ | 'accessKey'
16
+ | 'useWxCloud'
17
+ > &
18
+ ICloudbaseConfig['auth']
4
19
 
5
20
  export interface IAccessTokenInfo {
6
- accessToken: string;
7
- env: string;
21
+ accessToken: string
22
+ env: string
8
23
  }
9
24
  export interface ICredential {
10
25
  // refreshToken: string;
11
- accessToken?: string;
12
- accessTokenExpire?: string;
26
+ accessToken?: string
27
+ accessTokenExpire?: string
13
28
  }
14
29
  export interface IAuthProvider {
15
- signInWithRedirect: () => any;
30
+ signInWithRedirect: () => any
16
31
  }
17
32
  export interface IUserInfo {
18
- uid?: string;
19
- loginType?: string;
20
- openid?: string;
21
- wxOpenId?: string;
22
- wxPublicId?: string;
23
- unionId?: string;
24
- qqMiniOpenId?: string;
25
- customUserId?: string;
26
- name?: string;
27
- gender?: string;
28
- email?: string;
29
- username?: string;
30
- hasPassword?: boolean;
33
+ uid?: string
34
+ loginType?: string
35
+ openid?: string
36
+ wxOpenId?: string
37
+ wxPublicId?: string
38
+ unionId?: string
39
+ qqMiniOpenId?: string
40
+ customUserId?: string
41
+ name?: string
42
+ gender?: string
43
+ email?: string
44
+ username?: string
45
+ hasPassword?: boolean
31
46
  location?: {
32
- country?: string;
33
- province?: string;
34
- city?: string;
35
- };
36
- country?: string;
37
- province?: string;
38
- city?: string;
47
+ country?: string
48
+ province?: string
49
+ city?: string
50
+ }
51
+ country?: string
52
+ province?: string
53
+ city?: string
39
54
  }
40
55
  export interface IUser extends IUserInfo {
41
- checkLocalInfo: () => void;
42
- checkLocalInfoAsync: () => Promise<void>;
43
- linkWithTicket?: (ticket: string) => Promise<void>;
44
- linkWithRedirect?: (provider: IAuthProvider) => void;
45
- getLinkedUidList?: () => Promise<{ hasPrimaryUid: boolean, users: IUserInfo[] }>;
46
- setPrimaryUid?: (uid: string) => Promise<void>;
47
- unlink?: (loginType: 'CUSTOM' | 'WECHAT-OPEN' | 'WECHAT-PUBLIC' | 'WECHAT-UNION') => Promise<void>;
48
- update: (userinfo: IUserInfo) => Promise<void>;
49
- refresh: (params?: {version?: string;}) => Promise<IUserInfo>;
56
+ checkLocalInfo: () => void
57
+ checkLocalInfoAsync: () => Promise<void>
58
+ linkWithTicket?: (ticket: string) => Promise<void>
59
+ linkWithRedirect?: (provider: IAuthProvider) => void
60
+ getLinkedUidList?: () => Promise<{ hasPrimaryUid: boolean; users: IUserInfo[] }>
61
+ setPrimaryUid?: (uid: string) => Promise<void>
62
+ unlink?: (loginType: 'CUSTOM' | 'WECHAT-OPEN' | 'WECHAT-PUBLIC' | 'WECHAT-UNION') => Promise<void>
63
+ update: (userinfo: IUserInfo) => Promise<void>
64
+ refresh: (params?: { version?: string }) => Promise<IUserInfo>
50
65
  }
51
66
  export interface ILoginState {
52
- user: IUser;
67
+ user: IUser
53
68
  }
54
69
  export interface ICloudbaseAuth {
55
- config: ICloudbaseConfig;
56
- loginType: string;
57
- weixinAuthProvider: any;
58
- anonymousAuthProvider: any;
59
- customAuthProvider: any;
60
- getAccessToken: () => IAccessTokenInfo;
61
- getLoginState: () => Promise<ILoginState | null>;
62
- hasLoginState: () => Promise<ILoginState | null>;
63
- getUserInfo: () => Promise<any>;
64
- getAuthHeader: () => Promise<KV<string>>;
65
- onLoginStateChanged: (callback: Function) => void;
66
- onLoginStateExpired: (callback: Function) => void;
67
- onAccessTokenRefreshed: (callback: Function) => void;
68
- onAnonymousConverted: (callback: Function) => void;
69
- onLoginTypeChanged: (callback: Function) => void;
70
- shouldRefreshAccessToken: (hook: Function) => void;
70
+ config: ICloudbaseConfig
71
+ loginType: string
72
+ weixinAuthProvider: any
73
+ anonymousAuthProvider: any
74
+ customAuthProvider: any
75
+ getAccessToken: () => IAccessTokenInfo
76
+ getLoginState: () => Promise<ILoginState | null>
77
+ hasLoginState: () => Promise<ILoginState | null>
78
+ getUserInfo: () => Promise<UserInfo & IUser>
79
+ getAuthHeader: () => Promise<KV<string>>
80
+ onLoginStateChanged: (callback: Function) => void
81
+ onLoginStateExpired: (callback: Function) => void
82
+ onAccessTokenRefreshed: (callback: Function) => void
83
+ onAnonymousConverted: (callback: Function) => void
84
+ onLoginTypeChanged: (callback: Function) => void
85
+ shouldRefreshAccessToken: (hook: Function) => void
71
86
  }
72
87
 
73
- type IProvider = new (...args: any[]) => any;
88
+ type IProvider = new (...args: any[]) => any
74
89
 
75
90
  export interface ICloudbaseAuthModule {
76
- registerAuth: (app: ICloudbase) => void,
77
- registerProvider: (name: string, provider: IProvider) => void;
91
+ registerAuth: (app: ICloudbase) => void
92
+ registerProvider: (name: string, provider: IProvider) => void
78
93
  }
package/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { CloudbaseAdapter, SDKAdapterInterface } from '@cloudbase/adapter-interface'
1
+ import { CloudbaseAdapter, SDKAdapterInterface, ResponseObject } from '@cloudbase/adapter-interface'
2
2
  import { ICloudbaseComponent, ICloudbaseHook } from './component'
3
3
  import { ICloudbaseRequest } from './request'
4
4
  import { ICloudbaseCache } from './cache'
@@ -41,6 +41,9 @@ export interface ICloudbaseConfig {
41
41
  accessKey?: string
42
42
  endPointMode?: EndPointKey // auth请求域名模式,默认CLOUD_API
43
43
  useWxCloud?: boolean // 是否使用微信云开发链路
44
+ auth?: {
45
+ detectSessionInUrl?: boolean
46
+ }
44
47
  }
45
48
  // 可更新的配置字段
46
49
  export type ICloudbaseUpgradedConfig = Pick<ICloudbaseConfig, 'persistence' | 'region' | 'debug'>
@@ -78,9 +81,9 @@ export interface ICloudbase {
78
81
  fire?: (...args: any[]) => void
79
82
  updateLang?: (lang: LANGS) => void
80
83
  getEndPointWithKey?: (key: EndPointKey) => {
81
- BASE_URL: string;
82
- PROTOCOL: string;
83
- },
84
+ BASE_URL: string
85
+ PROTOCOL: string
86
+ }
84
87
  auth?: (options?: { persistence: cloudbase.auth.Persistence }) => cloudbase.auth.App
85
88
  }
86
89
  export interface ICloudbasePlatformInfo {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudbase/types",
3
- "version": "2.23.3",
3
+ "version": "2.24.0",
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": "d5f566dbd448be5d75127c4a506bcaf0ff3ae84b"
46
+ "gitHead": "7dac230344ecae3eec15358b2f85d782fde51839"
47
47
  }
package/storage.d.ts CHANGED
@@ -5,7 +5,7 @@ export interface ICloudbaseUploadFileParams {
5
5
  cloudPath: string;
6
6
  filePath: string;
7
7
  method?: 'post' | 'put';
8
- headers?: KVstring[];
8
+ headers?: KVstring;
9
9
  onUploadProgress?: Function;
10
10
  // 文件内容 Buffer 或 文件可读流, node端使用
11
11
  fileContent?: any;
@@ -15,7 +15,7 @@ export interface ICloudbaseUploadFileParams {
15
15
  export interface ICloudbaseUploadFileByPutParams {
16
16
  cloudPath: string;
17
17
  filePath: string;
18
- headers?: KVstring[];
18
+ headers?: KVstring;
19
19
  onUploadProgress?: Function;
20
20
  }
21
21