/// export interface IKeyValue { [key: string]: any; } export interface ICredentialsInfo { private_key_id: string; private_key: string; env_id?: string; } export interface ICloudBaseConfig extends IKeyValue { /** 私有化部署TCB的接入层(TCB-API)地址,内部环境(云函数或者云应用中)可以不配置 */ endpoint?: string; /** 内部(SCF/云调用)接入层地址,使用http和内网域名以减少请求开销 */ innerEndpoint?: string; debug?: boolean; timeout?: number; isHttp?: boolean; secretId?: string; secretKey?: string; envName?: string | Symbol; env?: string; sessionToken?: string; serviceUrl?: string; headers?: any; proxy?: string; version?: string; credentials?: ICredentialsInfo; throwOnCode?: boolean; forever?: boolean; } export interface IRequestInfo { config: ICloudBaseConfig; method: string; headers: any; params: ICustomParam; customApiUrl?: string; unSignedParams?: any; isFormData?: boolean; opts?: any; endpoint?: string; innerEndpoint?: string; /** 原样返回,不进行response.body解码 */ raw?: boolean; } export interface ICommonParam { action: string; envName?: string | Symbol; timestamp?: number; eventId?: string; wxCloudApiToken?: string; tcb_sessionToken?: string; authorization?: string; sessionToken?: string; sdk_version?: string; } export interface ICustomParam extends ICommonParam { [propName: string]: any; } export interface IRetryOptions { retries?: number; factor?: number; minTimeout?: number; maxTimeout?: number; randomize?: boolean; timeouts?: number[]; timeoutOps?: { timeout: number; cb: Function; }; } export interface ICustomReqOpts { timeout?: number; retryOptions?: IRetryOptions; } export interface IErrorInfo { code?: string; message?: string; requestId?: string; } export interface ICustomErrRes { [propName: string]: any; } export interface IUploadFileRes { fileID: string; } export interface IDeleteFileRes { fileList: Array; requestId: string; } export interface IGetFileUrlRes { fileList: Array; requestId: string; } export interface IDownloadFileRes { fileContent: Buffer; message: string; } export interface IReqOpts { proxy?: string; qs?: any; json?: boolean; body?: any; formData?: any; encoding?: any; forever?: boolean; url: string; method?: string; timeout?: number; headers?: any; } export interface IReqHooks { handleData?: (res: any, err: any, response: any, body: any) => any; } export interface IContext { memory_limit_in_mb: number; time_limit_in_ms: number; request_id: string; environ: any; environment?: any; function_version: string; function_name: string; namespace: string; }