UNPKG

capacitor-cors-bypass-enhanced

Version:

Enhanced Capacitor plugin for CORS bypass with HTTP/2, HTTP/3, gRPC, GraphQL, file operations, and advanced networking features. Modular TypeScript definitions for better maintainability.

119 lines 4.48 kB
import { WebPlugin } from '@capacitor/core'; import type { CorsBypassPlugin, HttpRequestOptions, HttpResponse, StreamRequestOptions, SSEOptions, SSEConnectionOptions, SSEConnection, WebSocketConnectionOptions, WebSocketConnection, MCPClientOptions, MCPClient, MCPResourceList, MCPResource, MCPToolList, MCPToolResult, MCPPromptList, MCPPrompt, MCPSamplingRequest, MCPSamplingResponse, Interceptor, InterceptorOptions, InterceptorHandle, GlobalProxyConfig, ProxyConfig, ProxyTestResult, ProxyStatus } from './definitions'; export declare class CorsBypassWeb extends WebPlugin implements CorsBypassPlugin { private proxyServerUrl; private globalProxyConfig; private proxyRequestCount; private proxyLastSuccessTime; private proxyLastError; private utilsManager; private httpManager; private streamManager; private sseManager; private wsManager; private interceptorManager; private mcpClients; private mcpTransports; private connectionCounter; constructor(); private detectProxyServer; /** * Set custom proxy server URL */ setProxyServer(url: string): void; request(options: HttpRequestOptions): Promise<HttpResponse>; get(options: HttpRequestOptions): Promise<HttpResponse>; post(options: HttpRequestOptions): Promise<HttpResponse>; put(options: HttpRequestOptions): Promise<HttpResponse>; patch(options: HttpRequestOptions): Promise<HttpResponse>; delete(options: HttpRequestOptions): Promise<HttpResponse>; /** * Streaming HTTP request - supports AI model streaming output */ streamRequest(options: StreamRequestOptions): Promise<{ streamId: string; }>; /** * Cancel streaming request */ cancelStream(options: { streamId: string; }): Promise<void>; startSSE(options: SSEOptions): Promise<{ connectionId: string; }>; stopSSE(options: { connectionId: string; }): Promise<void>; createSSEConnection(options: SSEConnectionOptions): Promise<SSEConnection>; closeSSEConnection(options: { connectionId: string; }): Promise<void>; createWebSocketConnection(options: WebSocketConnectionOptions): Promise<WebSocketConnection>; closeWebSocketConnection(options: { connectionId: string; }): Promise<void>; sendWebSocketMessage(options: { connectionId: string; message: string; }): Promise<void>; createMCPClient(options: MCPClientOptions): Promise<MCPClient>; listMCPResources(options: { connectionId: string; cursor?: string; }): Promise<MCPResourceList>; readMCPResource(options: { connectionId: string; uri: string; }): Promise<MCPResource>; listMCPTools(options: { connectionId: string; cursor?: string; }): Promise<MCPToolList>; callMCPTool(options: { connectionId: string; name: string; arguments?: any; }): Promise<MCPToolResult>; listMCPPrompts(options: { connectionId: string; cursor?: string; }): Promise<MCPPromptList>; getMCPPrompt(options: { connectionId: string; name: string; arguments?: any; }): Promise<MCPPrompt>; sendMCPSampling(options: { connectionId: string; request: MCPSamplingRequest; }): Promise<MCPSamplingResponse>; addInterceptor(interceptor: Interceptor, options?: InterceptorOptions): Promise<InterceptorHandle>; removeInterceptor(handle: InterceptorHandle | string): Promise<void>; removeAllInterceptors(): Promise<void>; getInterceptors(): Promise<InterceptorHandle[]>; /** * Set global proxy configuration * Note: On Web platform, proxy is handled through the CORS proxy server * The proxy config is stored and can be passed to the server for server-side proxying */ setGlobalProxy(config: GlobalProxyConfig): Promise<void>; /** * Get current global proxy configuration */ getGlobalProxy(): Promise<GlobalProxyConfig | null>; /** * Clear global proxy configuration */ clearGlobalProxy(): Promise<void>; /** * Test proxy connection * On Web platform, this tests connectivity through the CORS proxy server */ testProxy(config: ProxyConfig, testUrl?: string): Promise<ProxyTestResult>; /** * Get current proxy status */ getProxyStatus(): Promise<ProxyStatus>; } //# sourceMappingURL=web.d.ts.map