export declare enum StorageType { local = "local", none = "none", session = "session" } export interface ResponseObject { data?: T; statusCode?: number; [key: string]: any; } export declare type IRequestMethod = 'get' | 'post' | 'upload' | 'download' | 'put'; export interface IRequestConfig { timeout?: number; timeoutMsg?: string; restrictedMethods?: Array; } export interface IRequestOptions { url?: string; data?: object; headers?: object; method?: string; responseType?: XMLHttpRequestResponseType; [key: string]: any; } export interface IUploadRequestOptions extends IRequestOptions { file: string; name: string; data: { success_action_status?: string; [key: string]: any; }; onUploadProgress?: (...args: any[]) => void; } export interface SDKRequestInterface { get?: (options: IRequestOptions) => any; post: (options: IRequestOptions) => any; upload: (options: IUploadRequestOptions) => any; download: (options: IRequestOptions) => any; fetch?: (options: IFetchOptions) => any; } interface AbortSignal { aborted: boolean; addEventListener: (event: string, listener: CallableFunction) => unknown; } export declare type IFetchOptions = Omit & { url: string; enableAbort?: boolean; stream?: boolean; signal?: AbortSignal; timeout?: number; }; export declare abstract class AbstractSDKRequest implements SDKRequestInterface { abstract post(options: IRequestOptions): any; abstract upload(options: IUploadRequestOptions): any; abstract download(options: IRequestOptions): any; } export interface NodeRequestInterface { send: (action: string, data?: any, ...args: any[]) => Promise; } export declare type SDKRequestConstructor = new (options?: any) => SDKRequestInterface; export declare type NodeRequestConstructor = new (options: any) => NodeRequestInterface; export interface WebSocketInterface { send: (data?: string | ArrayBuffer) => void; close: (code?: number, reason?: string) => void; onopen: any; onclose: any; onerror: any; onmessage: any; readyState: number; CONNECTING: number; OPEN: number; CLOSING: number; CLOSED: number; } export declare type WebSocketContructor = new (url: string, ...args: any[]) => WebSocketInterface; export interface StorageInterface { mode?: 'async' | 'sync'; setItem: (key: string, value: any) => void; getItem: (key: string) => any; removeItem?: (key: string) => void; clear?: () => void; [key: string]: any; } export declare abstract class AbstractStorage implements StorageInterface { abstract setItem(key: string, value: any): void; abstract getItem(key: string): any; } export interface CaptchaToken { captcha_token: string; expires_in: number; expires_at?: Date | null; } export interface FileSystemStats { size: number; } export interface FileSystemReadFileOptions { encoding?: string | null; flag?: string; position?: number; length?: number; } export declare type FileSystemStatCallback = (err: Error | null, stats?: FileSystemStats) => void; export declare type FileSystemReadFileCallback = (err: Error | null, data?: ArrayBuffer) => void; export interface FileSystemInterface { stat(path: string, callback: FileSystemStatCallback): void; readFile(path: string, callback: FileSystemReadFileCallback): void; readFile(path: string, options: FileSystemReadFileOptions | null | undefined, callback: FileSystemReadFileCallback): void; } export declare abstract class AbstractSDKFileSystem implements FileSystemInterface { abstract stat(path: string, callback: FileSystemStatCallback): void; abstract readFile(path: string, callback: FileSystemReadFileCallback): void; abstract readFile(path: string, options: FileSystemReadFileOptions | null | undefined, callback: FileSystemReadFileCallback): void; } export declare type FileSystemConstructor = new () => FileSystemInterface; export interface SDKAdapterInterface { root: any; wsClass: WebSocketContructor; reqClass: SDKRequestConstructor; localStorage?: StorageInterface; sessionStorage?: StorageInterface; fsClass?: FileSystemConstructor; primaryStorage?: StorageType; captchaOptions?: { openURIWithCallback?: (url: string) => Promise; }; getAppSign?(): string; } export interface NodeAdapterInterface { wsClass: WebSocketContructor; reqClass: NodeRequestConstructor; } export interface CloudbaseAdapter { runtime: string; isMatch: () => boolean; genAdapter: (options?: any) => SDKAdapterInterface | NodeAdapterInterface; } export {};