@cloudbase/types
Advanced tools
Comparing version 1.2.3-alpha.0 to 2.0.0-alpha.0
import { ICloudbaseConfig, KV, ICloudbase } from '.'; | ||
export type ICloudbaseAuthConfig = Pick<ICloudbaseConfig, 'env' | 'region' | 'persistence' | 'debug' | '_fromApp'>; | ||
export type ICloudbaseAuthConfig = Pick<ICloudbaseConfig, 'env' | 'region' | 'persistence' | 'debug' | '_fromApp' | 'oauthInstance'>; | ||
@@ -10,3 +10,3 @@ export interface IAccessTokenInfo { | ||
export interface ICredential { | ||
refreshToken: string; | ||
// refreshToken: string; | ||
accessToken?: string; | ||
@@ -16,3 +16,3 @@ accessTokenExpire?: string; | ||
export interface IAuthProvider { | ||
signInWithRedirect(): any; | ||
signInWithRedirect: () => any; | ||
} | ||
@@ -28,6 +28,8 @@ export interface IUserInfo { | ||
customUserId?: string; | ||
nickName?: string; | ||
// nickName?: string; | ||
name?: string; | ||
gender?: string; | ||
avatarUrl?: string; | ||
email?: string; | ||
username?: string; | ||
hasPassword?: boolean; | ||
@@ -44,20 +46,20 @@ location?: { | ||
export interface IUser extends IUserInfo { | ||
checkLocalInfo(): void; | ||
checkLocalInfoAsync(): Promise<void>; | ||
linkWithTicket(ticket: string): Promise<void>; | ||
linkWithRedirect(provider: IAuthProvider): void; | ||
getLinkedUidList(): Promise<{ hasPrimaryUid: boolean, users: IUserInfo[] }>; | ||
setPrimaryUid(uid: string): Promise<void>; | ||
unlink(loginType: 'CUSTOM' | 'WECHAT-OPEN' | 'WECHAT-PUBLIC' | 'WECHAT-UNION'): Promise<void>; | ||
update(userinfo: IUserInfo): Promise<void>; | ||
refresh(): Promise<IUserInfo>; | ||
checkLocalInfo: () => void; | ||
checkLocalInfoAsync: () => Promise<void>; | ||
linkWithTicket?: (ticket: string) => Promise<void>; | ||
linkWithRedirect?: (provider: IAuthProvider) => void; | ||
getLinkedUidList?: () => Promise<{ hasPrimaryUid: boolean, users: IUserInfo[] }>; | ||
setPrimaryUid?: (uid: string) => Promise<void>; | ||
unlink?: (loginType: 'CUSTOM' | 'WECHAT-OPEN' | 'WECHAT-PUBLIC' | 'WECHAT-UNION') => Promise<void>; | ||
update: (userinfo: IUserInfo) => Promise<void>; | ||
refresh: () => Promise<IUserInfo>; | ||
} | ||
export interface ILoginState { | ||
credential: ICredential; | ||
// credential: ICredential; | ||
user: IUser; | ||
isAnonymousAuth: boolean; | ||
isCustomAuth: boolean; | ||
isWeixinAuth: boolean; | ||
isUsernameAuth: boolean; | ||
loginType: string; | ||
// isAnonymousAuth: boolean; | ||
// isCustomAuth: boolean; | ||
// isWeixinAuth: boolean; | ||
// isUsernameAuth: boolean; | ||
// loginType: string; | ||
} | ||
@@ -70,13 +72,13 @@ export interface ICloudbaseAuth { | ||
customAuthProvider: any; | ||
getAccessToken(): IAccessTokenInfo; | ||
getLoginState(): Promise<ILoginState | null>; | ||
hasLoginState(): Promise<ILoginState | null>; | ||
getUserInfo(): Promise<any>; | ||
getAuthHeader(): Promise<KV<string>>; | ||
onLoginStateChanged(callback: Function): void; | ||
onLoginStateExpired(callback: Function): void; | ||
onAccessTokenRefreshed(callback: Function): void; | ||
onAnonymousConverted(callback: Function): void; | ||
onLoginTypeChanged(callback: Function): void; | ||
shouldRefreshAccessToken(hook: Function): void; | ||
getAccessToken: () => IAccessTokenInfo; | ||
getLoginState: () => Promise<ILoginState | null>; | ||
hasLoginState: () => Promise<ILoginState | null>; | ||
getUserInfo: () => Promise<any>; | ||
getAuthHeader: () => Promise<KV<string>>; | ||
onLoginStateChanged: (callback: Function) => void; | ||
onLoginStateExpired: (callback: Function) => void; | ||
onAccessTokenRefreshed: (callback: Function) => void; | ||
onAnonymousConverted: (callback: Function) => void; | ||
onLoginTypeChanged: (callback: Function) => void; | ||
shouldRefreshAccessToken: (hook: Function) => void; | ||
} | ||
@@ -87,4 +89,4 @@ | ||
export interface ICloudbaseAuthModule { | ||
registerAuth(app: ICloudbase): void, | ||
registerProvider(name: string, provider: IProvider): void; | ||
registerAuth: (app: ICloudbase) => void, | ||
registerProvider: (name: string, provider: IProvider) => void; | ||
} |
@@ -12,16 +12,16 @@ import { ICloudbasePlatformInfo, KV,ICloudbaseConfig } from "."; | ||
mode: 'async' | 'sync'; | ||
setStore: (key: string, value: any, version?: string) => void; | ||
setStoreAsync: (key: string, value: any, version?: string) => Promise<void>; | ||
getStore: (key: string, version?: string) => any; | ||
getStoreAsync: (key: string, version?: string) => Promise<any>; | ||
setStore(key: string, value: any, version?: string):void; | ||
setStoreAsync(key: string, value: any, version?: string):Promise<void>; | ||
removeStore: (key:string) => void; | ||
removeStoreAsync: (key:string) => Promise<void>; | ||
getStore(key: string, version?: string):any; | ||
getStoreAsync(key: string, version?: string):Promise<any>; | ||
removeStore(key:string):void; | ||
removeStoreAsync(key:string):Promise<void>; | ||
updatePersistence?(persistence:string):void; | ||
updatePersistenceAsync?(persistence:string):Promise<void>; | ||
clear?():void; | ||
updatePersistence?: (persistence:string) => void; | ||
updatePersistenceAsync?: (persistence:string) => Promise<void>; | ||
clear?: () => void; | ||
} |
@@ -9,5 +9,5 @@ import { CloudbaseAdapter, SDKAdapterInterface } from '@cloudbase/adapter-interface'; | ||
export type KV<T> = { | ||
export interface KV<T> { | ||
[key: string]: T; | ||
}; | ||
} | ||
@@ -28,3 +28,5 @@ export interface ICloudbaseAppSecret { | ||
debug?: boolean; | ||
_fromApp?: ICloudbase | ||
_fromApp?: ICloudbase; | ||
clientId?: string | ||
oauthInstance?: any; | ||
} | ||
@@ -36,3 +38,3 @@ // 可更新的配置字段 | ||
name: string; | ||
invoke(opts: any, app: ICloudbase): Promise<any>; | ||
invoke: (opts: any, app: ICloudbase) => Promise<any>; | ||
} | ||
@@ -49,11 +51,11 @@ | ||
oauthInstance?: any; | ||
init(config: ICloudbaseConfig): ICloudbase; | ||
updateConfig(config: ICloudbaseUpgradedConfig): void; | ||
registerExtension(ext: ICloudbaseExtension): void; | ||
invokeExtension(name: string, opts: any): Promise<any>; | ||
useAdapters(adapters: CloudbaseAdapter | CloudbaseAdapter[]): void; | ||
registerComponent(component: ICloudbaseComponent): void; | ||
registerHook(hook: ICloudbaseHook): void; | ||
registerVersion(version: string): void; | ||
fire?(...args: any[]): void; | ||
init: (config: ICloudbaseConfig) => ICloudbase; | ||
updateConfig: (config: ICloudbaseUpgradedConfig) => void; | ||
registerExtension: (ext: ICloudbaseExtension) => void; | ||
invokeExtension: (name: string, opts: any) => Promise<any>; | ||
useAdapters: (adapters: CloudbaseAdapter | CloudbaseAdapter[]) => void; | ||
registerComponent: (component: ICloudbaseComponent) => void; | ||
registerHook: (hook: ICloudbaseHook) => void; | ||
registerVersion: (version: string) => void; | ||
fire?: (...args: any[]) => void; | ||
} | ||
@@ -60,0 +62,0 @@ |
{ | ||
"name": "@cloudbase/types", | ||
"version": "1.2.3-alpha.0", | ||
"version": "2.0.0-alpha.0", | ||
"description": "cloudbase javascript sdk types", | ||
@@ -48,3 +48,3 @@ "files": [ | ||
}, | ||
"gitHead": "eb161dd3c79b90a95a877984bf7c07cdb4563077" | ||
"gitHead": "9ab9ea4322a548cd981d5fe747b6dee911272a6d" | ||
} |
@@ -20,10 +20,10 @@ import { | ||
export interface ICloudbaseRequest { | ||
fetch: (urlOrPath: string, init?: RequestInit) => Promise<Response>; | ||
// fetch: (urlOrPath: string, init?: RequestInit) => Promise<Response>; | ||
post: (options: IRequestOptions) => Promise<ResponseObject>; | ||
upload: (options: IUploadRequestOptions) => Promise<ResponseObject>; | ||
download: (options: IRequestOptions) => Promise<ResponseObject>; | ||
refreshAccessToken: () => Promise<IGetAccessTokenResult>; | ||
getAccessToken: () => Promise<IGetAccessTokenResult>; | ||
// refreshAccessToken: () => Promise<IGetAccessTokenResult>; | ||
// getAccessToken: () => Promise<IGetAccessTokenResult>; | ||
request: (action: string, params: KV<any>, options?: KV<any>) => Promise<ResponseObject>; | ||
send: (action: string, data: KV<any>) => Promise<any>; | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
20418
625