import { ConnectionType, ConnectionConfig, PersonalOAuthConfig } from "../types/connection.js"; /** * Options for executeWithRetry method */ export interface ExecuteWithRetryOptions { userId?: string; config?: ConnectionConfig; maxRetries?: number; } /** * Manages Salesforce connections with pooling, refresh logic, and OAuth support */ export declare class ConnectionManager { private connections; private connectionPromises; private tokenCache; private readonly DEFAULT_USER_ID; /** * Get or create a connection for the specified user */ getConnection(userIdOrAccessToken?: string, config?: ConnectionConfig): Promise; /** * Refresh a connection's token */ refreshConnection(userId?: string, config?: ConnectionConfig): Promise; /** * Execute a function with automatic retry on token expiration */ executeWithRetry(operation: (connection: any) => Promise, options?: ExecuteWithRetryOptions): Promise; /** * Create a personal OAuth connection using authorization code */ createPersonalOAuthConnection(oauthConfig: PersonalOAuthConfig, userId: string): Promise; /** * Clear connection for a user */ clearConnection(userId?: string, connectionType?: ConnectionType): void; /** * Clear all connections */ clearAllConnections(): void; /** * Get connection statistics */ getConnectionStats(): { activeConnections: number; }; /** * Create a new connection based on configuration */ private createNewConnection; /** * Create connection using username/password */ private createUsernamePasswordConnection; /** * Create connection using OAuth 2.0 Client Credentials */ private createClientCredentialsConnection; /** * Create connection using existing token data */ private createTokenBasedConnection; /** * Create connection using direct access token (for MCP personal OAuth) */ private createDirectAccessTokenConnection; /** * Check if string looks like an access token */ private isAccessToken; /** * Set up automatic token refresh for a connection */ private setupConnectionRefresh; /** * Check if connection is valid and active */ private isConnectionValid; /** * Make HTTP request for token operations */ private makeTokenRequest; /** * Create personal OAuth connection using environment variables and token caching */ private createPersonalOAuthConnectionFromEnv; /** * Check if token is expired or will expire soon (5 minute buffer) */ private isTokenExpiredSoon; /** * Clear cached tokens for a user */ private clearCachedTokens; } export declare const connectionManager: ConnectionManager;