import { KV } from '.' export interface ICallFunctionOptions { name: string data?: KV query?: KV search?: string parse?: boolean // Used for 云函数2.0 CallContainer type?: string method?: string path?: string header?: KV } export interface ICallFunctionResponse { /** * 请求序列号,用于错误排查。 */ requestId?: string /** * 云函数执行结果。成功时返回(`statusCode < 400`)。 * * 默认 `any` 以保持对既有调用方(直接访问 `res.result.xxx`)的**非破坏**兼容; * 推荐通过泛型参数指定精确类型以获得类型安全:`callFunction<{ n: number }>(...)`。 */ result?: T /** * 状态码。操作成功则不返回。 */ code?: string /** * 错误描述。 */ message?: string } export type ICallFunction = ( options: ICallFunctionOptions, callback?: (err: Error | null, res: ICallFunctionResponse | null) => void, ) => Promise> export interface IRetryOptions { retries?: number factor?: number minTimeout?: number maxTimeout?: number randomize?: boolean timeouts?: number[] timeoutOps?: { timeout: number cb: (...args: any[]) => void } } export interface ICustomReqOpts { timeout?: number retryOptions?: IRetryOptions from?: 'node-sdk' }