import * as react_jsx_runtime from 'react/jsx-runtime'; import React, { ReactNode } from 'react'; interface RequestOptions { headers?: Record; timeout?: number; signal?: AbortSignal; params?: Record; retries?: number; retryDelay?: number; } interface UploadOptions extends RequestOptions { onProgress?: (progress: ProgressEvent) => void; } interface DownloadOptions extends RequestOptions { onProgress?: (progress: ProgressEvent) => void; responseType?: 'blob' | 'arraybuffer' | 'text'; } interface StreamOptions extends RequestOptions { delimiter?: string; } interface BatchRequest { method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE'; endpoint: string; data?: unknown; options?: RequestOptions; } interface BatchResponse { success: boolean; data?: T; error?: Error; status: number; } interface ApiResponse { data: T; status: number; statusText: string; headers: Record; } interface ApiError extends Error { status?: number; statusText?: string; response?: { data?: unknown; status: number; statusText: string; headers: Record; }; } interface HttpClientConfig { baseURL: string; timeout?: number; defaultHeaders?: Record; retries?: number; retryDelay?: number; } type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS'; interface RequestConfig extends RequestOptions { method: HttpMethod; url: string; data?: unknown; baseURL?: string; } interface Interceptor { request?: (config: RequestConfig) => RequestConfig | Promise; response?: (response: Response) => Response | Promise; error?: (error: Error) => Error | Promise; } interface AuthInterceptorConfig { getAccessToken: () => string | null; getCsrfToken?: () => string | null; refreshToken: () => Promise; onAuthError?: (error: Error) => void; tokenPrefix?: string; csrfHeaderName?: string; } declare class ApiClient { private baseURL; private defaultHeaders; private timeout; private interceptors; constructor(config: HttpClientConfig); /** * GET request */ get(endpoint: string, options?: RequestOptions): Promise; /** * POST request */ post(endpoint: string, data?: unknown, options?: RequestOptions): Promise; /** * PUT request */ put(endpoint: string, data?: unknown, options?: RequestOptions): Promise; /** * PATCH request */ patch(endpoint: string, data?: unknown, options?: RequestOptions): Promise; /** * DELETE request */ delete(endpoint: string, options?: RequestOptions): Promise; /** * File upload with progress tracking */ upload(endpoint: string, file: File | FormData, options?: UploadOptions): Promise; /** * File download with progress tracking */ download(endpoint: string, options?: DownloadOptions): Promise; /** * Batch requests */ batch(requests: BatchRequest[]): Promise; /** * Stream data (placeholder for future implementation) */ stream(endpoint: string, options?: StreamOptions): AsyncGenerator; /** * Set base URL */ setBaseURL(url: string): void; /** * Set default headers */ setDefaultHeaders(headers: Record): void; /** * Add an interceptor */ addInterceptor(interceptor: Interceptor): number; /** * Remove an interceptor by index */ removeInterceptor(index: number): void; /** * Clear all interceptors */ clearInterceptors(): void; /** * Core request method */ private request; private buildURL; private buildHeaders; private buildBody; private executeRequest; private handleResponse; private createApiError; private handleError; } interface AuthEndpoints { login: string; refresh: string; logout: string; user: string; register?: string; passwordReset?: string; passwordResetConfirm?: string; emailVerification?: string; changePassword?: string; } interface AuthFieldMapping { username: string; password: string; email?: string; firstName?: string; lastName?: string; confirmPassword?: string; refreshToken?: string; } interface AuthResponseMapping { user: string; accessToken: string; refreshToken: string; permissions?: string; roles?: string; } type AuthProvider$1 = 'django-rest-framework' | 'django-allauth' | 'custom' | 'firebase' | 'auth0' | 'supabase'; interface TokenStorageConfig { type?: 'cookie' | 'localStorage' | 'sessionStorage'; secure?: boolean; sameSite?: 'strict' | 'lax' | 'none'; domain?: string; path?: string; maxAge?: number; prefix?: string; } interface AutoRefreshConfig { enabled?: boolean; threshold?: number; maxRetries?: number; retryDelay?: number; } interface AuthConfig { provider?: AuthProvider$1; endpoints?: Partial; baseAuthURL?: string; fieldMapping?: Partial; responseMapping?: Partial; fieldMappings?: Partial; useEmailAsUsername?: boolean; tokenPrefix?: string; accessTokenLifetime?: number; refreshTokenLifetime?: number; tokenStorage?: TokenStorageConfig; autoRefresh?: boolean | AutoRefreshConfig; refreshThreshold?: number; maxRefreshRetries?: number; refreshRetryDelay?: number; csrfEnabled?: boolean; secureTokens?: boolean; validateUser?: (user: unknown) => boolean; transformUser?: (user: unknown) => unknown; loginEndpoint?: string; refreshEndpoint?: string; logoutEndpoint?: string; userEndpoint?: string; usernameField?: string; passwordField?: string; auth0?: { domain: string; clientId: string; audience?: string; scope?: string; }; supabase?: { projectUrl: string; anonKey: string; }; } interface LoginCredentials { username?: string; email?: string; password: string; } interface User$1 { id: string | number; username: string; email: string; first_name?: string; last_name?: string; is_active?: boolean; is_staff?: boolean; is_superuser?: boolean; date_joined?: string; last_login?: string; [key: string]: unknown; } interface AuthTokens$1 { access: string; refresh: string; } interface AuthState { user: User$1 | null; tokens: AuthTokens$1 | null; isAuthenticated: boolean; isLoading: boolean; error: string | null; } interface UseAuthOptions$1 { autoRefresh?: boolean; refreshThreshold?: number; onAuthError?: (error: Error) => void; onTokenRefresh?: (newToken: string) => void; } interface UseAuthReturn$1 { user: TUser | null; isAuthenticated: boolean; isLoading: boolean; login: (credentials: LoginCredentials) => Promise; logout: () => Promise; refresh: () => Promise; updateUser: (userData: Partial) => Promise; serverAccessToken: string | null; tokenExpiryTime: number; isRefreshing: boolean; lastError: Error | null; clearError: () => void; checkTokenExpiry: () => boolean; forceRefresh: () => Promise; } interface AuthProviderProps { children: ReactNode; apiClient: ApiClient; config?: Partial; } /** * Authentication Provider Component */ declare function AuthProvider({ children, apiClient, config }: AuthProviderProps): react_jsx_runtime.JSX.Element; interface AuthError { type: 'login' | 'refresh' | 'logout' | 'network' | 'unknown'; message: string; code?: string | number; timestamp: number; retryable: boolean; } interface UseAuthErrorOptions { autoRetry?: boolean; maxRetries?: number; retryDelay?: number; onError?: (error: AuthError) => void; onRetry?: (attempt: number) => void; } /** * Hook for managing authentication errors with retry logic */ declare function useAuthError(options?: UseAuthErrorOptions): { errors: AuthError[]; latestError: AuthError; hasErrors: boolean; isRetrying: boolean; retryCount: number; canRetry: boolean; addError: (error: Error, type?: AuthError["type"]) => AuthError; addLoginError: (error: Error) => AuthError; addRefreshError: (error: Error) => AuthError; addLogoutError: (error: Error) => AuthError; addNetworkError: (error: Error) => AuthError; clearErrors: () => void; clearError: (timestamp: number) => void; retry: (retryFn?: () => Promise) => Promise; }; /** * Hook for displaying user-friendly error messages */ declare function useAuthErrorMessages(): { getErrorMessage: (error: AuthError) => string; getErrorTitle: (error: AuthError) => string; getErrorSeverity: (error: AuthError) => "error" | "warning" | "info"; }; interface UseAuthOptions { autoRefresh?: boolean | AutoRefreshConfig; refreshThreshold?: number; onAuthError?: (error: AuthError) => void; onTokenRefresh?: (newToken: string) => void; } interface UseAuthReturn { user: TUser | null; isAuthenticated: boolean; isLoading: boolean; login: (credentials: LoginCredentials) => Promise; logout: () => Promise; refresh: () => Promise; updateUser: (userData: Partial) => Promise; serverAccessToken: string | null; tokenExpiryTime: number; isRefreshing: boolean; error: AuthError | null; lastError: AuthError | null; clearError: () => void; checkTokenExpiry: () => boolean; forceRefresh: () => Promise; } /** * Enhanced useAuth hook with auto-refresh and better error handling */ declare function useAuth(options?: UseAuthOptions): UseAuthReturn; /** * Simple useAuth hook for basic usage (backward compatibility) */ declare function useSimpleAuth(): { user: TUser | null; isAuthenticated: boolean; isLoading: boolean; login: (credentials: LoginCredentials) => Promise; logout: () => Promise; refresh: () => Promise; updateUser: (userData: Partial) => Promise; serverAccessToken: string | null; error: AuthError | null; clearError: () => void; }; interface AuthStatus { isAuthenticated: boolean; isLoading: boolean; hasValidToken: boolean; tokenExpiresIn: number; needsRefresh: boolean; } interface UseAuthStatusOptions { refreshThreshold?: number; pollInterval?: number; } /** * Hook for monitoring authentication status and token health */ declare function useAuthStatus(options?: UseAuthStatusOptions): AuthStatus; /** * Hook for checking if user has specific permissions */ declare function useAuthPermissions(requiredPermissions?: string[]): { hasPermission: (permission: string) => boolean; hasAllPermissions: () => boolean; hasAnyPermission: () => boolean; isAuthorized: boolean; }; /** * Hook for handling authentication redirects */ declare function useAuthRedirect(redirectTo?: string): { shouldRedirect: boolean; redirect: () => void; }; /** * Permission represents a specific action that can be performed */ interface Permission { id: string; name: string; description?: string; resource?: string; action?: string; conditions?: Record; } /** * Role represents a collection of permissions */ interface Role { id: string; name: string; description?: string; permissions: Permission[]; isDefault?: boolean; priority?: number; } /** * User with RBAC information */ interface RBACUser { id: string | number; username: string; email: string; roles: Role[]; permissions: Permission[]; isActive?: boolean; isSuperuser?: boolean; } /** * Permission check context */ interface PermissionContext { user: RBACUser; resource?: string; resourceId?: string | number; action?: string; data?: Record; } /** * RBAC configuration */ interface RBACConfig { strategy?: 'permissive' | 'restrictive'; superuserBypassesRBAC?: boolean; enableRoleHierarchy?: boolean; inheritPermissions?: boolean; customEvaluators?: Record; enableCaching?: boolean; cacheTTL?: number; } /** * RBAC hook options */ interface UseRBACOptions$1 { rbacManager?: RBACManager; autoConvertUser?: boolean; enableCaching?: boolean; onPermissionDenied?: (permission: string, user: RBACUser) => void; } /** * Custom permission evaluator function */ type PermissionEvaluator = (permission: Permission, context: PermissionContext) => boolean | Promise; /** * Permission query builder */ interface PermissionQuery { resource?: string; action?: string; conditions?: Record; } /** * RBAC events */ type RBACEvent = { type: 'role_assigned'; userId: string | number; roleId: string; } | { type: 'role_revoked'; userId: string | number; roleId: string; } | { type: 'permission_granted'; userId: string | number; permissionId: string; } | { type: 'permission_revoked'; userId: string | number; permissionId: string; } | { type: 'permission_checked'; userId: string | number; permission: string; granted: boolean; }; /** * RBAC event handler */ type RBACEventHandler = (event: RBACEvent) => void | Promise; /** * Permission string format: resource:action or just action * Examples: 'users:read', 'posts:write', 'admin', 'delete' */ type PermissionString = string; /** * Role string format */ type RoleString = string; /** * Utility type for permission checks */ type PermissionCheck = PermissionString | Permission | PermissionQuery | PermissionString[] | Permission[] | PermissionQuery[]; /** * RBAC manager interface */ interface RBACManager { hasPermission(user: RBACUser, permission: PermissionCheck, context?: Partial): Promise; hasAnyPermission(user: RBACUser, permissions: PermissionCheck[], context?: Partial): Promise; hasAllPermissions(user: RBACUser, permissions: PermissionCheck[], context?: Partial): Promise; hasRole(user: RBACUser, role: RoleString | Role): boolean; hasAnyRole(user: RBACUser, roles: (RoleString | Role)[]): boolean; hasAllRoles(user: RBACUser, roles: (RoleString | Role)[]): boolean; grantPermission(userId: string | number, permission: PermissionString | Permission): Promise; revokePermission(userId: string | number, permission: PermissionString | Permission): Promise; assignRole(userId: string | number, role: RoleString | Role): Promise; revokeRole(userId: string | number, role: RoleString | Role): Promise; getUserPermissions(user: RBACUser): Permission[]; getUserRoles(user: RBACUser): Role[]; on(event: RBACEvent['type'], handler: RBACEventHandler): void; off(event: RBACEvent['type'], handler: RBACEventHandler): void; } /** * Supported social login providers */ type SocialProvider = 'google' | 'github' | 'facebook' | 'twitter' | 'linkedin' | 'microsoft' | 'apple' | 'discord' | 'custom'; /** * OAuth2 flow types */ type OAuth2Flow = 'authorization_code' | 'implicit' | 'pkce'; /** * Social login configuration for a provider */ interface SocialProviderConfig { provider: SocialProvider; clientId: string; clientSecret?: string; authorizationUrl: string; tokenUrl: string; userInfoUrl: string; revokeUrl?: string; flow: OAuth2Flow; scopes: string[]; redirectUri: string; usePKCE?: boolean; codeChallenge?: string; codeChallengeMethod?: 'S256' | 'plain'; additionalParams?: Record; responseType?: 'code' | 'token'; responseMode?: 'query' | 'fragment' | 'form_post'; userFieldMapping?: { id?: string; email?: string; name?: string; firstName?: string; lastName?: string; avatar?: string; username?: string; }; } /** * Social login state for OAuth2 flow */ interface SocialLoginState { provider: SocialProvider; state: string; codeVerifier?: string; redirectUri: string; scopes: string[]; timestamp: number; } /** * OAuth2 authorization response */ interface OAuth2AuthResponse { code?: string; state?: string; error?: string; error_description?: string; access_token?: string; token_type?: string; expires_in?: number; scope?: string; } /** * OAuth2 token response */ interface OAuth2TokenResponse { access_token: string; token_type: string; expires_in?: number; refresh_token?: string; scope?: string; id_token?: string; } /** * Social user profile data */ interface SocialUserProfile { id: string; email?: string; name?: string; firstName?: string; lastName?: string; username?: string; avatar?: string; provider: SocialProvider; providerData: Record; } /** * Social login result */ interface SocialLoginResult { success: boolean; user?: SocialUserProfile; tokens?: OAuth2TokenResponse; error?: string; provider: SocialProvider; } /** * Social login manager configuration */ interface SocialLoginConfig { providers: Record; defaultFlow?: OAuth2Flow; defaultScopes?: string[]; enableStateValidation?: boolean; stateStorageKey?: string; popupWidth?: number; popupHeight?: number; popupFeatures?: string; usePopup?: boolean; redirectTimeout?: number; onSuccess?: (result: SocialLoginResult) => void | Promise; onError?: (error: string, provider: SocialProvider) => void; onCancel?: (provider: SocialProvider) => void; } /** * Social login manager interface */ interface SocialLoginManager { configure(config: Partial): void; addProvider(provider: SocialProvider, config: SocialProviderConfig): void; removeProvider(provider: SocialProvider): void; login(provider: SocialProvider, options?: SocialLoginOptions): Promise; logout(provider: SocialProvider): Promise; refreshToken(provider: SocialProvider, refreshToken: string): Promise; revokeToken(provider: SocialProvider, token: string): Promise; getUserProfile(provider: SocialProvider, accessToken: string): Promise; getAuthorizationUrl(provider: SocialProvider, options?: SocialLoginOptions): string; handleCallback(provider: SocialProvider, response: OAuth2AuthResponse): Promise; saveState(state: SocialLoginState): void; getState(stateId: string): SocialLoginState | null; clearState(stateId: string): void; } /** * Social login options */ interface SocialLoginOptions { scopes?: string[]; additionalParams?: Record; usePopup?: boolean; redirectUri?: string; state?: string; } /** * Social login hook options */ interface UseSocialLoginOptions$1 { manager?: SocialLoginManager; config?: Partial; onSuccess?: (result: SocialLoginResult) => void | Promise; onError?: (error: string, provider: SocialProvider) => void; onCancel?: (provider: SocialProvider) => void; } /** * Social login events */ type SocialLoginEvent = { type: 'login_started'; provider: SocialProvider; } | { type: 'login_success'; provider: SocialProvider; user: SocialUserProfile; } | { type: 'login_error'; provider: SocialProvider; error: string; } | { type: 'login_cancelled'; provider: SocialProvider; } | { type: 'token_refreshed'; provider: SocialProvider; tokens: OAuth2TokenResponse; } | { type: 'logout'; provider: SocialProvider; }; /** * Social login event handler */ type SocialLoginEventHandler = (event: SocialLoginEvent) => void | Promise; /** * Endpoint configuration manager */ declare class EndpointManager { private provider; private baseURL; private endpoints; private fieldMapping; private responseMapping; constructor(provider?: AuthProvider$1, baseURL?: string, customEndpoints?: Partial, customFieldMapping?: Partial, customResponseMapping?: Partial); /** * Get full URL for an endpoint */ getEndpointURL(endpoint: keyof AuthEndpoints): string; /** * Get field name for a logical field */ getFieldName(field: keyof AuthFieldMapping): string; /** * Get response field path for a logical field */ getResponseField(field: keyof AuthResponseMapping): string; /** * Extract value from response using configured mapping */ extractFromResponse(response: any, field: keyof AuthResponseMapping): any; /** * Map request data using field mapping */ mapRequestData(data: Record): Record; /** * Get all configured endpoints */ getAllEndpoints(): AuthEndpoints; /** * Update endpoint configuration */ updateEndpoints(updates: Partial): void; /** * Update field mapping */ updateFieldMapping(updates: Partial): void; /** * Update response mapping */ updateResponseMapping(updates: Partial): void; /** * Get provider information */ getProvider(): AuthProvider$1; /** * Helper to get nested value from object using dot notation */ private getNestedValue; } /** * Advanced auth hook options */ interface UseAdvancedAuthOptions { authConfig?: Partial; rbacOptions?: UseRBACOptions$1; socialOptions?: UseSocialLoginOptions$1; enableRBAC?: boolean; enableSocialLogin?: boolean; enableEndpointManagement?: boolean; onLogin?: (user: User$1, tokens: AuthTokens$1) => void; onLogout?: () => void; onSocialLogin?: (result: SocialLoginResult) => void; onPermissionDenied?: (permission: string, user: RBACUser) => void; onError?: (error: AuthError, context: string) => void; } /** * Advanced auth hook return type */ interface UseAdvancedAuthReturn { user: User$1 | null; isAuthenticated: boolean; isLoading: boolean; login: (credentials: LoginCredentials) => Promise; logout: () => Promise; refresh: () => Promise; rbacUser: RBACUser | null; permissions: Permission[]; roles: Role[]; hasPermission: (permission: PermissionCheck, context?: Partial) => Promise; hasRole: (role: RoleString | Role) => boolean; socialLogin: (provider: SocialProvider, options?: SocialLoginOptions) => Promise; socialLogout: (provider: SocialProvider) => Promise; endpointManager: EndpointManager | null; updateEndpoints: (updates: Partial) => void; error: AuthError | null; lastSocialResult: SocialLoginResult | null; clearError: () => void; isFeatureEnabled: (feature: 'rbac' | 'social' | 'endpoints') => boolean; } /** * Advanced authentication hook that combines all auth features */ declare function useAdvancedAuth(options?: UseAdvancedAuthOptions): UseAdvancedAuthReturn; /** * Hook for authentication with automatic feature detection */ declare function useSmartAuth(config?: Partial): UseAdvancedAuthReturn; /** * Advanced auth context type */ interface AdvancedAuthContextType extends UseAdvancedAuthReturn { config: AdvancedAuthConfig; updateConfig: (updates: Partial) => void; } /** * Advanced auth configuration */ interface AdvancedAuthConfig { auth?: Partial; rbac?: Partial; social?: Partial; features?: { rbac?: boolean; socialLogin?: boolean; endpointManagement?: boolean; }; ui?: { theme?: 'light' | 'dark' | 'auto'; showDebugInfo?: boolean; errorDisplayMode?: 'toast' | 'inline' | 'console'; }; } /** * Advanced auth provider props */ interface AdvancedAuthProviderProps { children: ReactNode; apiClient: ApiClient; config?: AdvancedAuthConfig; onConfigChange?: (config: AdvancedAuthConfig) => void; } /** * Advanced authentication provider that combines all auth features */ declare function AdvancedAuthProvider({ children, apiClient, config: initialConfig, onConfigChange, }: AdvancedAuthProviderProps): react_jsx_runtime.JSX.Element; /** * Hook to use the advanced auth context */ declare function useAdvancedAuthContext(): AdvancedAuthContextType; /** * HOC for advanced auth protection */ declare function withAdvancedAuth

(Component: React.ComponentType

, options?: { requireAuth?: boolean; requiredPermissions?: string[]; requiredRoles?: string[]; fallback?: ReactNode; onAccessDenied?: () => void; }): (props: P) => react_jsx_runtime.JSX.Element; /** * Debug component for advanced auth */ declare function AdvancedAuthDebug(): react_jsx_runtime.JSX.Element | null; /** * Utility component for feature-based rendering */ interface FeatureGateProps { feature: 'rbac' | 'social' | 'endpoints'; children: ReactNode; fallback?: ReactNode; } declare function FeatureGate({ feature, children, fallback }: FeatureGateProps): react_jsx_runtime.JSX.Element; /** * Quick setup configurations */ declare const AdvancedAuthConfigs: { /** * Full-featured configuration with all features enabled */ full: () => AdvancedAuthConfig; /** * Basic configuration with only core auth */ basic: () => AdvancedAuthConfig; /** * RBAC-only configuration */ rbacOnly: () => AdvancedAuthConfig; /** * Social login only configuration */ socialOnly: () => AdvancedAuthConfig; }; /** * RBAC hook options */ interface UseRBACOptions { rbacManager?: RBACManager; autoConvertUser?: boolean; enableCaching?: boolean; onPermissionDenied?: (permission: string, user: RBACUser) => void; } /** * RBAC hook return type */ interface UseRBACReturn { rbacUser: RBACUser | null; permissions: Permission[]; roles: Role[]; hasPermission: (permission: PermissionCheck, context?: Partial) => Promise; hasAnyPermission: (permissions: PermissionCheck[], context?: Partial) => Promise; hasAllPermissions: (permissions: PermissionCheck[], context?: Partial) => Promise; hasRole: (role: RoleString | Role) => boolean; hasAnyRole: (roles: (RoleString | Role)[]) => boolean; hasAllRoles: (roles: (RoleString | Role)[]) => boolean; grantPermission: (permission: string | Permission) => Promise; revokePermission: (permission: string | Permission) => Promise; assignRole: (role: string | Role) => Promise; revokeRole: (role: string | Role) => Promise; isLoading: boolean; error: Error | null; refresh: () => Promise; } /** * Main RBAC hook */ declare function useRBAC(options?: UseRBACOptions): UseRBACReturn; /** * Hook for checking a specific permission */ declare function usePermission(permission: PermissionCheck, context?: Partial, options?: UseRBACOptions): { hasPermission: boolean; isChecking: boolean; rbacUser: RBACUser | null; error: Error | null; }; /** * Hook for checking a specific role */ declare function useRole(role: RoleString | Role, options?: UseRBACOptions): { hasRole: boolean; rbacUser: RBACUser | null; roles: Role[]; error: Error | null; }; /** * Hook for admin-level access checking */ declare function useAdminAccess(options?: UseRBACOptions): { isAdmin: boolean; isSuperuser: boolean; rbacUser: RBACUser | null; error: Error | null; }; /** * Default RBAC Manager implementation */ declare class DefaultRBACManager implements RBACManager { private config; private permissionCache; private eventHandlers; constructor(config?: Partial); /** * Check if user has a specific permission */ hasPermission(user: RBACUser, permission: PermissionCheck, context?: Partial): Promise; /** * Check if user has any of the specified permissions */ hasAnyPermission(user: RBACUser, permissions: PermissionCheck[], context?: Partial): Promise; /** * Check if user has all of the specified permissions */ hasAllPermissions(user: RBACUser, permissions: PermissionCheck[], context?: Partial): Promise; /** * Check if user has a specific role */ hasRole(user: RBACUser, role: RoleString | Role): boolean; /** * Check if user has any of the specified roles */ hasAnyRole(user: RBACUser, roles: (RoleString | Role)[]): boolean; /** * Check if user has all of the specified roles */ hasAllRoles(user: RBACUser, roles: (RoleString | Role)[]): boolean; /** * Grant permission to user (placeholder - would typically interact with backend) */ grantPermission(userId: string | number, permission: PermissionString | Permission): Promise; /** * Revoke permission from user (placeholder - would typically interact with backend) */ revokePermission(userId: string | number, permission: PermissionString | Permission): Promise; /** * Assign role to user (placeholder - would typically interact with backend) */ assignRole(userId: string | number, role: RoleString | Role): Promise; /** * Revoke role from user (placeholder - would typically interact with backend) */ revokeRole(userId: string | number, role: RoleString | Role): Promise; /** * Get all permissions for a user (from roles and direct permissions) */ getUserPermissions(user: RBACUser): Permission[]; /** * Get all roles for a user */ getUserRoles(user: RBACUser): Role[]; /** * Add event listener */ on(event: RBACEvent['type'], handler: RBACEventHandler): void; /** * Remove event listener */ off(event: RBACEvent['type'], handler: RBACEventHandler): void; /** * Check a single permission */ private checkSinglePermission; /** * Evaluate a permission against user's permissions and roles */ private evaluatePermission; /** * Check if a user permission matches the required permission */ private matchesPermission; /** * Check if permission conditions match */ private matchesConditions; /** * Normalize permission to query format */ private normalizePermission; /** * Generate cache key for permission check */ private getCacheKey; /** * Convert permission to string representation */ private stringifyPermission; /** * Emit RBAC event */ private emitEvent; } /** * Create a permission object from string or partial permission */ declare function createPermission(input: PermissionString | Partial, defaults?: Partial): Permission; /** * Create a role object from string or partial role */ declare function createRole(input: RoleString | Partial, permissions?: (PermissionString | Permission)[], defaults?: Partial): Role; /** * Create an RBAC user from basic user data */ declare function createRBACUser(userData: { id: string | number; username: string; email: string; isActive?: boolean; isSuperuser?: boolean; }, roles?: (RoleString | Role)[], permissions?: (PermissionString | Permission)[]): RBACUser; /** * Predefined common permissions */ declare const CommonPermissions: { create: (resource: string) => Permission; read: (resource: string) => Permission; update: (resource: string) => Permission; delete: (resource: string) => Permission; admin: (resource?: string) => Permission; manage: (resource: string) => Permission; viewProfile: () => Permission; editProfile: () => Permission; changePassword: () => Permission; viewLogs: () => Permission; manageUsers: () => Permission; manageRoles: () => Permission; systemConfig: () => Permission; }; /** * Predefined common roles */ declare const CommonRoles: { admin: () => Role; moderator: () => Role; user: () => Role; guest: () => Role; owner: (resource: string) => Role; editor: (resource: string) => Role; viewer: (resource: string) => Role; }; /** * Permission string builders */ declare const PermissionBuilder: { /** * Build CRUD permissions for a resource */ crud: (resource: string) => Permission[]; /** * Build management permissions for a resource */ manage: (resource: string) => Permission[]; /** * Build read-only permissions for a resource */ readOnly: (resource: string) => Permission[]; /** * Build custom permission set */ custom: (resource: string, actions: string[]) => Permission[]; }; /** * Role hierarchy utilities */ declare const RoleHierarchy: { /** * Check if role A inherits from role B */ inherits: (roleA: Role, roleB: Role) => boolean; /** * Get effective permissions considering role hierarchy */ getEffectivePermissions: (roles: Role[]) => Permission[]; }; /** * Permission validation utilities */ declare const PermissionValidator: { /** * Validate permission format */ isValidPermission: (permission: any) => permission is Permission; /** * Validate role format */ isValidRole: (role: any) => role is Role; /** * Validate RBAC user format */ isValidRBACUser: (user: any) => user is RBACUser; }; /** * Permission comparison utilities */ declare const PermissionComparator: { /** * Check if two permissions are equal */ equals: (a: Permission, b: Permission) => boolean; /** * Check if permission A includes permission B (A is broader than B) */ includes: (a: Permission, b: Permission) => boolean; /** * Find overlapping permissions between two sets */ findOverlap: (setA: Permission[], setB: Permission[]) => Permission[]; }; /** * Utility to convert legacy user to RBAC user */ declare function convertToRBACUser(user: any, roleMapping?: Record, permissionMapping?: Record): RBACUser; /** * Social login hook options */ interface UseSocialLoginOptions { manager?: SocialLoginManager; config?: Partial; onSuccess?: (result: SocialLoginResult) => void | Promise; onError?: (error: string, provider: SocialProvider) => void; onCancel?: (provider: SocialProvider) => void; } /** * Social login hook return type */ interface UseSocialLoginReturn { login: (provider: SocialProvider, options?: SocialLoginOptions) => Promise; logout: (provider: SocialProvider) => Promise; isLoading: boolean; error: string | null; lastResult: SocialLoginResult | null; addProvider: (provider: SocialProvider, config: any) => void; removeProvider: (provider: SocialProvider) => void; getAuthUrl: (provider: SocialProvider, options?: SocialLoginOptions) => string; handleCallback: (provider: SocialProvider, response: any) => Promise; manager: SocialLoginManager; } /** * Main social login hook */ declare function useSocialLogin(options?: UseSocialLoginOptions): UseSocialLoginReturn; /** * Hook for a specific social provider */ declare function useSocialProvider(provider: SocialProvider, options?: UseSocialLoginOptions): { login: (loginOptions?: SocialLoginOptions) => Promise; logout: () => Promise; getAuthUrl: (loginOptions?: SocialLoginOptions) => string; isLoading: boolean; error: string | null; result: SocialLoginResult | null; manager: SocialLoginManager; }; /** * Hook for Google login */ declare function useGoogleLogin(options?: UseSocialLoginOptions): { login: (loginOptions?: SocialLoginOptions) => Promise; logout: () => Promise; getAuthUrl: (loginOptions?: SocialLoginOptions) => string; isLoading: boolean; error: string | null; result: SocialLoginResult | null; manager: SocialLoginManager; }; /** * Hook for GitHub login */ declare function useGitHubLogin(options?: UseSocialLoginOptions): { login: (loginOptions?: SocialLoginOptions) => Promise; logout: () => Promise; getAuthUrl: (loginOptions?: SocialLoginOptions) => string; isLoading: boolean; error: string | null; result: SocialLoginResult | null; manager: SocialLoginManager; }; /** * Hook for Facebook login */ declare function useFacebookLogin(options?: UseSocialLoginOptions): { login: (loginOptions?: SocialLoginOptions) => Promise; logout: () => Promise; getAuthUrl: (loginOptions?: SocialLoginOptions) => string; isLoading: boolean; error: string | null; result: SocialLoginResult | null; manager: SocialLoginManager; }; /** * Hook for Twitter login */ declare function useTwitterLogin(options?: UseSocialLoginOptions): { login: (loginOptions?: SocialLoginOptions) => Promise; logout: () => Promise; getAuthUrl: (loginOptions?: SocialLoginOptions) => string; isLoading: boolean; error: string | null; result: SocialLoginResult | null; manager: SocialLoginManager; }; /** * Hook for LinkedIn login */ declare function useLinkedInLogin(options?: UseSocialLoginOptions): { login: (loginOptions?: SocialLoginOptions) => Promise; logout: () => Promise; getAuthUrl: (loginOptions?: SocialLoginOptions) => string; isLoading: boolean; error: string | null; result: SocialLoginResult | null; manager: SocialLoginManager; }; /** * Hook for Microsoft login */ declare function useMicrosoftLogin(options?: UseSocialLoginOptions): { login: (loginOptions?: SocialLoginOptions) => Promise; logout: () => Promise; getAuthUrl: (loginOptions?: SocialLoginOptions) => string; isLoading: boolean; error: string | null; result: SocialLoginResult | null; manager: SocialLoginManager; }; /** * Hook for Apple login */ declare function useAppleLogin(options?: UseSocialLoginOptions): { login: (loginOptions?: SocialLoginOptions) => Promise; logout: () => Promise; getAuthUrl: (loginOptions?: SocialLoginOptions) => string; isLoading: boolean; error: string | null; result: SocialLoginResult | null; manager: SocialLoginManager; }; /** * Hook for Discord login */ declare function useDiscordLogin(options?: UseSocialLoginOptions): { login: (loginOptions?: SocialLoginOptions) => Promise; logout: () => Promise; getAuthUrl: (loginOptions?: SocialLoginOptions) => string; isLoading: boolean; error: string | null; result: SocialLoginResult | null; manager: SocialLoginManager; }; /** * Hook for handling OAuth callback */ declare function useSocialCallback(): { processCallback: (manager: SocialLoginManager, provider: SocialProvider, callbackData: any) => Promise; isProcessing: boolean; result: SocialLoginResult | null; error: string | null; }; /** * Default social login manager implementation */ declare class DefaultSocialLoginManager implements SocialLoginManager { private config; private providers; private eventHandlers; constructor(config?: Partial); /** * Configure the social login manager */ configure(config: Partial): void; /** * Add a social provider */ addProvider(provider: SocialProvider, config: SocialProviderConfig): void; /** * Remove a social provider */ removeProvider(provider: SocialProvider): void; /** * Initiate social login */ login(provider: SocialProvider, options?: SocialLoginOptions): Promise; /** * Logout from social provider */ logout(provider: SocialProvider): Promise; /** * Refresh OAuth2 token */ refreshToken(provider: SocialProvider, refreshToken: string): Promise; /** * Revoke OAuth2 token */ revokeToken(provider: SocialProvider, token: string): Promise; /** * Get user profile from social provider */ getUserProfile(provider: SocialProvider, accessToken: string): Promise; /** * Get authorization URL for OAuth2 flow */ getAuthorizationUrl(provider: SocialProvider, options?: SocialLoginOptions): string; /** * Handle OAuth2 callback */ handleCallback(provider: SocialProvider, response: OAuth2AuthResponse): Promise; /** * Save login state */ saveState(state: SocialLoginState): void; /** * Get login state */ getState(stateId: string): SocialLoginState | null; /** * Clear login state */ clearState(stateId: string): void; /** * Add event listener */ on(event: SocialLoginEvent['type'], handler: SocialLoginEventHandler): void; /** * Remove event listener */ off(event: SocialLoginEvent['type'], handler: SocialLoginEventHandler): void; /** * Login with popup window */ private loginWithPopup; /** * Login with redirect */ private loginWithRedirect; /** * Exchange authorization code for tokens */ private exchangeCodeForTokens; /** * Map provider user data to standard format */ private mapUserProfile; /** * Generate random state for CSRF protection */ private generateState; /** * Generate PKCE challenge */ private generatePKCEChallenge; /** * Generate PKCE code verifier */ private generateCodeVerifier; /** * Generate PKCE code challenge */ private generateCodeChallenge; /** * Get stored states from localStorage */ private getStoredStates; /** * Clear provider tokens from storage */ private clearProviderTokens; /** * Emit social login event */ private emitEvent; } /** * Base guard props */ interface BaseGuardProps { children: ReactNode; fallback?: ReactNode; loading?: ReactNode; onAccessDenied?: () => void; rbacOptions?: UseRBACOptions$1; } /** * Permission-based access guard */ interface PermissionGuardProps extends BaseGuardProps { permission: PermissionCheck; context?: Partial; requireAll?: boolean; } declare function PermissionGuard({ children, permission, context, requireAll, fallback, loading, onAccessDenied, rbacOptions, }: PermissionGuardProps): react_jsx_runtime.JSX.Element; /** * Role-based access guard */ interface RoleGuardProps extends BaseGuardProps { role: RoleString | Role | (RoleString | Role)[]; requireAll?: boolean; } declare function RoleGuard({ children, role, requireAll, fallback, loading, onAccessDenied, rbacOptions, }: RoleGuardProps): react_jsx_runtime.JSX.Element; /** * Admin-only access guard */ interface AdminGuardProps extends BaseGuardProps { requireSuperuser?: boolean; } declare function AdminGuard({ children, requireSuperuser, fallback, loading, onAccessDenied, rbacOptions, }: AdminGuardProps): react_jsx_runtime.JSX.Element; /** * Authenticated user guard (requires any valid user) */ interface AuthenticatedGuardProps extends BaseGuardProps { requireActive?: boolean; } declare function AuthenticatedGuard({ children, requireActive, fallback, loading, onAccessDenied, rbacOptions, }: AuthenticatedGuardProps): react_jsx_runtime.JSX.Element; /** * Conditional access guard with custom logic */ interface ConditionalGuardProps extends BaseGuardProps { condition: (rbacUser: any) => boolean | Promise; } declare function ConditionalGuard({ children, condition, fallback, loading, onAccessDenied, rbacOptions, }: ConditionalGuardProps): react_jsx_runtime.JSX.Element; /** * Higher-order component for RBAC protection */ declare function withRBACGuard

(Component: React.ComponentType

, guardProps: Omit | Omit | Omit): (props: P) => react_jsx_runtime.JSX.Element; /** * Utility component to show different content based on permissions */ interface RBACContentProps { rbacOptions?: UseRBACOptions$1; children: { admin?: ReactNode; user?: ReactNode; guest?: ReactNode; denied?: ReactNode; }; } declare function RBACContent({ children, rbacOptions }: RBACContentProps): react_jsx_runtime.JSX.Element; /** * Debug component to show current user's permissions and roles */ interface RBACDebugProps { rbacOptions?: UseRBACOptions$1; showPermissions?: boolean; showRoles?: boolean; showUser?: boolean; } declare function RBACDebug({ rbacOptions, showPermissions, showRoles, showUser, }: RBACDebugProps): react_jsx_runtime.JSX.Element; /** * Base social login button props */ interface BaseSocialLoginButtonProps { children?: ReactNode; className?: string; style?: React.CSSProperties; disabled?: boolean; loading?: ReactNode; loginOptions?: SocialLoginOptions; onSuccess?: (result: SocialLoginResult) => void; onError?: (error: string) => void; onCancel?: () => void; socialOptions?: UseSocialLoginOptions$1; } /** * Generic social login button */ interface SocialLoginButtonProps extends BaseSocialLoginButtonProps { provider: SocialProvider; } declare function SocialLoginButton({ provider, children, className, style, disabled, loading, loginOptions, onSuccess, onError, onCancel, socialOptions, }: SocialLoginButtonProps): react_jsx_runtime.JSX.Element; /** * Google login button */ declare function GoogleLoginButton({ children, className, ...props }: Omit): react_jsx_runtime.JSX.Element; /** * GitHub login button */ declare function GitHubLoginButton({ children, className, ...props }: Omit): react_jsx_runtime.JSX.Element; /** * Facebook login button */ declare function FacebookLoginButton({ children, className, ...props }: Omit): react_jsx_runtime.JSX.Element; /** * Twitter login button */ declare function TwitterLoginButton({ children, className, ...props }: Omit): react_jsx_runtime.JSX.Element; /** * LinkedIn login button */ declare function LinkedInLoginButton({ children, className, ...props }: Omit): react_jsx_runtime.JSX.Element; /** * Microsoft login button */ declare function MicrosoftLoginButton({ children, className, ...props }: Omit): react_jsx_runtime.JSX.Element; /** * Apple login button */ declare function AppleLoginButton({ children, className, ...props }: Omit): react_jsx_runtime.JSX.Element; /** * Discord login button */ declare function DiscordLoginButton({ children, className, ...props }: Omit): react_jsx_runtime.JSX.Element; /** * Create an authentication interceptor that automatically: * - Adds auth tokens to requests * - Handles 401 responses with token refresh * - Adds CSRF tokens when needed */ declare function createAuthInterceptor(config: AuthInterceptorConfig): Interceptor; /** * Create a retry interceptor that retries requests after token refresh */ declare function createRetryInterceptor(maxRetries?: number, shouldRetry?: (error: Error) => boolean): Interceptor; /** * Create a logging interceptor for debugging authentication issues */ declare function createAuthLoggingInterceptor(enabled?: boolean): Interceptor; /** * Basic authentication interceptor - adds auth token to requests * @deprecated Use createAuthInterceptor for more advanced functionality */ declare const authInterceptor: Interceptor; /** * Retry interceptor - retries failed requests */ declare const retryInterceptor: Interceptor; /** * Cache interceptor - caches responses */ declare const cacheInterceptor: Interceptor; /** * Logging interceptor - logs requests and responses */ declare const loggingInterceptor: Interceptor; declare class AuthService { private apiClient; private config; private tokenStorage; private tokenManager; private endpointManager; constructor(apiClient: ApiClient, config?: Partial); /** * Normalize configuration to handle both current and documented formats */ private normalizeConfig; private getDefaultConfig; /** * Login with credentials */ login(credentials: LoginCredentials): Promise<{ user: User$1; tokens: AuthTokens$1; }>; /** * Logout user */ logout(): Promise; /** * Refresh access token */ refreshToken(): Promise; /** * Get current user data */ getCurrentUser(): Promise; /** * Update user data */ updateUser(userData: Partial): Promise; /** * Check if user is authenticated */ isAuthenticated(): boolean; /** * Get stored tokens */ getTokens(): AuthTokens$1 | null; /** * Get access token for server-side usage */ getServerAccessToken(): string | null; /** * Set CSRF token */ setCsrfToken(token: string): void; /** * Get CSRF token */ getCsrfToken(): string | null; /** * Initialize authentication state (check for existing tokens) */ initialize(): Promise<{ user: User$1 | null; tokens: AuthTokens$1 | null; }>; /** * Start automatic token refresh */ private startAutoRefresh; /** * Stop automatic token refresh */ private stopAutoRefresh; /** * Check if current token needs refresh */ checkAndRefreshToken(): Promise; /** * Get time until current token expires */ getTokenExpiryTime(): number; /** * Get endpoint manager for external use */ getEndpointManager(): EndpointManager; /** * Update endpoint configuration */ updateEndpoints(updates: Partial): void; /** * Cleanup resources */ destroy(): void; } interface AuthInterceptorSetupOptions { enableRetry?: boolean; maxRetries?: number; enableLogging?: boolean; tokenPrefix?: string; csrfHeaderName?: string; onAuthError?: (error: Error) => void; } /** * Setup authentication interceptors for an API client using an AuthService */ declare function setupAuthInterceptors(apiClient: ApiClient, authService: AuthService, options?: AuthInterceptorSetupOptions): void; /** * Setup auth interceptors with development-friendly defaults */ declare function setupDevelopmentAuthInterceptors(apiClient: ApiClient, authService: AuthService, options?: Partial): void; /** * Setup auth interceptors with production-optimized defaults */ declare function setupProductionAuthInterceptors(apiClient: ApiClient, authService: AuthService, options?: Partial): void; /** * Create a pre-configured API client with auth interceptors */ declare function createAuthenticatedApiClient(baseURL: string, authService: AuthService, options?: AuthInterceptorSetupOptions): Promise; /** * Creates a configured API client instance */ declare function createApiClient(config: HttpClientConfig): ApiClient; /** * Creates an API client with default Django REST Framework configuration */ declare function createDjangoApiClient(baseURL: string, options?: Partial): ApiClient; /** * Configure authentication with sensible defaults for Django REST Framework */ declare function configureAuth(config?: Partial): AuthConfig; /** * Configure authentication for email-based login */ declare function configureEmailAuth(config?: Partial): AuthConfig; /** * Configure authentication for development environment */ declare function configureDevelopmentAuth(config?: Partial): AuthConfig; /** * Create auth configuration for Django REST Framework */ declare function createDjangoRestFrameworkConfig(baseURL: string, overrides?: Partial): AuthConfig; /** * Create auth configuration for Django Allauth */ declare function createDjangoAllauthConfig(baseURL: string, overrides?: Partial): AuthConfig; /** * Create auth configuration for Firebase */ declare function createFirebaseConfig(projectId: string, overrides?: Partial): AuthConfig; /** * Create auth configuration for Auth0 */ declare function createAuth0Config(domain: string, clientId: string, overrides?: Partial): AuthConfig; /** * Create auth configuration for Supabase */ declare function createSupabaseConfig(projectUrl: string, anonKey: string, overrides?: Partial): AuthConfig; /** * Create custom auth configuration */ declare function createCustomAuthConfig(baseURL: string, config: Partial): AuthConfig; /** * Create endpoint manager from auth config */ declare function createEndpointManager(config: AuthConfig): EndpointManager; /** * Validate auth configuration */ declare function validateAuthConfig(config: AuthConfig): { isValid: boolean; errors: string[]; }; /** * Get provider-specific configuration examples */ declare function getProviderExamples(): Record; /** * Auto-detect auth provider from URL patterns */ declare function detectAuthProvider(baseURL: string): AuthProvider$1; /** * OpenAPI 3.0+ specification types */ interface OpenAPISpec { openapi: string; info: OpenAPIInfo; servers?: OpenAPIServer[]; paths: OpenAPIPaths; components?: OpenAPIComponents; security?: OpenAPISecurityRequirement[]; tags?: OpenAPITag[]; externalDocs?: OpenAPIExternalDocumentation; } interface OpenAPIInfo { title: string; description?: string; termsOfService?: string; contact?: OpenAPIContact; license?: OpenAPILicense; version: string; } interface OpenAPIContact { name?: string; url?: string; email?: string; } interface OpenAPILicense { name: string; url?: string; } interface OpenAPIServer { url: string; description?: string; variables?: Record; } interface OpenAPIServerVariable { enum?: string[]; default: string; description?: string; } interface OpenAPIPaths { [path: string]: OpenAPIPathItem; } interface OpenAPIPathItem { $ref?: string; summary?: string; description?: string; get?: OpenAPIOperation; put?: OpenAPIOperation; post?: OpenAPIOperation; delete?: OpenAPIOperation; options?: OpenAPIOperation; head?: OpenAPIOperation; patch?: OpenAPIOperation; trace?: OpenAPIOperation; servers?: OpenAPIServer[]; parameters?: (OpenAPIParameter | OpenAPIReference)[]; } interface OpenAPIOperation { tags?: string[]; summary?: string; description?: string; externalDocs?: OpenAPIExternalDocumentation; operationId?: string; parameters?: (OpenAPIParameter | OpenAPIReference)[]; requestBody?: OpenAPIRequestBody | OpenAPIReference; responses: OpenAPIResponses; callbacks?: Record; deprecated?: boolean; security?: OpenAPISecurityRequirement[]; servers?: OpenAPIServer[]; } interface OpenAPIParameter { name: string; in: 'query' | 'header' | 'path' | 'cookie'; description?: string; required?: boolean; deprecated?: boolean; allowEmptyValue?: boolean; style?: string; explode?: boolean; allowReserved?: boolean; schema?: OpenAPISchema | OpenAPIReference; example?: any; examples?: Record; content?: Record; } interface OpenAPIRequestBody { description?: string; content: Record; required?: boolean; } interface OpenAPIResponses { [statusCode: string]: OpenAPIResponse | OpenAPIReference; } interface OpenAPIResponse { description: string; headers?: Record; content?: Record; links?: Record; } interface OpenAPIMediaType { schema?: OpenAPISchema | OpenAPIReference; example?: any; examples?: Record; encoding?: Record; } interface OpenAPIEncoding { contentType?: string; headers?: Record; style?: string; explode?: boolean; allowReserved?: boolean; } interface OpenAPISchema { type?: 'null' | 'boolean' | 'object' | 'array' | 'number' | 'string' | 'integer'; format?: string; title?: string; description?: string; default?: any; example?: any; examples?: any[]; multipleOf?: number; maximum?: number; exclusiveMaximum?: boolean; minimum?: number; exclusiveMinimum?: boolean; maxLength?: number; minLength?: number; pattern?: string; maxItems?: number; minItems?: number; uniqueItems?: boolean; maxProperties?: number; minProperties?: number; required?: string[]; enum?: any[]; properties?: Record; additionalProperties?: boolean | OpenAPISchema | OpenAPIReference; items?: OpenAPISchema | OpenAPIReference; allOf?: (OpenAPISchema | OpenAPIReference)[]; oneOf?: (OpenAPISchema | OpenAPIReference)[]; anyOf?: (OpenAPISchema | OpenAPIReference)[]; not?: OpenAPISchema | OpenAPIReference; if?: OpenAPISchema | OpenAPIReference; then?: OpenAPISchema | OpenAPIReference; else?: OpenAPISchema | OpenAPIReference; nullable?: boolean; discriminator?: OpenAPIDiscriminator; readOnly?: boolean; writeOnly?: boolean; xml?: OpenAPIXML; externalDocs?: OpenAPIExternalDocumentation; deprecated?: boolean; } interface OpenAPIDiscriminator { propertyName: string; mapping?: Record; } interface OpenAPIXML { name?: string; namespace?: string; prefix?: string; attribute?: boolean; wrapped?: boolean; } interface OpenAPIComponents { schemas?: Record; responses?: Record; parameters?: Record; examples?: Record; requestBodies?: Record; headers?: Record; securitySchemes?: Record; links?: Record; callbacks?: Record; } interface OpenAPIReference { $ref: string; } interface OpenAPIExample { summary?: string; description?: string; value?: any; externalValue?: string; } interface OpenAPIHeader { description?: string; required?: boolean; deprecated?: boolean; allowEmptyValue?: boolean; style?: string; explode?: boolean; allowReserved?: boolean; schema?: OpenAPISchema | OpenAPIReference; example?: any; examples?: Record; content?: Record; } interface OpenAPISecurityScheme { type: 'apiKey' | 'http' | 'oauth2' | 'openIdConnect'; description?: string; name?: string; in?: 'query' | 'header' | 'cookie'; scheme?: string; bearerFormat?: string; flows?: OpenAPIOAuthFlows; openIdConnectUrl?: string; } interface OpenAPIOAuthFlows { implicit?: OpenAPIOAuthFlow; password?: OpenAPIOAuthFlow; clientCredentials?: OpenAPIOAuthFlow; authorizationCode?: OpenAPIOAuthFlow; } interface OpenAPIOAuthFlow { authorizationUrl?: string; tokenUrl?: string; refreshUrl?: string; scopes: Record; } interface OpenAPISecurityRequirement { [name: string]: string[]; } interface OpenAPITag { name: string; description?: string; externalDocs?: OpenAPIExternalDocumentation; } interface OpenAPIExternalDocumentation { description?: string; url: string; } interface OpenAPILink { operationRef?: string; operationId?: string; parameters?: Record; requestBody?: any; description?: string; server?: OpenAPIServer; } interface OpenAPICallback { [expression: string]: OpenAPIPathItem; } /** * Code generation specific types */ interface ParsedOpenAPISpec { spec: OpenAPISpec; operations: ParsedOperation[]; schemas: ParsedSchema[]; components: ParsedComponents; } interface ParsedOperation { id: string; method: string; path: string; summary?: string; description?: string; tags: string[]; parameters: ParsedParameter[]; requestBody?: ParsedRequestBody; responses: ParsedResponse[]; security: ParsedSecurity[]; deprecated: boolean; } interface ParsedParameter { name: string; in: 'query' | 'header' | 'path' | 'cookie'; required: boolean; schema: ParsedSchema; description?: string; } interface ParsedRequestBody { required: boolean; content: Record; description?: string; } interface ParsedResponse { statusCode: string; description: string; content?: Record; headers?: Record; } interface ParsedMediaType { schema: ParsedSchema; examples?: Record; } interface ParsedHeader { required: boolean; schema: ParsedSchema; description?: string; } interface ParsedSchema { type: string; name?: string; description?: string; required: boolean; nullable: boolean; properties?: Record; items?: ParsedSchema; enum?: any[]; format?: string; pattern?: string; minimum?: number; maximum?: number; minLength?: number; maxLength?: number; minItems?: number; maxItems?: number; default?: any; example?: any; ref?: string; originalSchema: OpenAPISchema | OpenAPIReference; } interface ParsedSecurity { type: string; name: string; in?: string; scheme?: string; scopes?: string[]; } interface ParsedComponents { schemas: Record; securitySchemes: Record; } /** * Code generation configuration */ interface CodeGenConfig { input: string; output: string; generateTypes: boolean; generateClient: boolean; generateHooks: boolean; typePrefix?: string; typeSuffix?: string; clientName?: string; hookPrefix?: string; enableAuth: boolean; enableCaching: boolean; enableOptimisticUpdates: boolean; enableErrorHandling: boolean; framework: 'react' | 'vue' | 'angular' | 'vanilla'; stateManagement?: 'react-query' | 'swr' | 'zustand' | 'redux' | 'none'; customTemplates?: string; additionalImports?: string[]; skipOperations?: string[]; includeOperations?: string[]; strictMode: boolean; validateResponses: boolean; prettier: boolean; eslint: boolean; } /** * OpenAPI specification parser and validator */ declare class OpenAPIParser { private spec; private resolvedRefs; constructor(spec: OpenAPISpec); /** * Parse the OpenAPI specification */ parse(): Promise; /** * Validate the OpenAPI specification */ private validateSpec; /** * Resolve all $ref references in the specification */ private resolveReferences; /** * Parse all operations from paths */ private parseOperations; /** * Parse a single operation */ private parseOperation; /** * Generate operation ID from method and path */ private generateOperationId; /** * Parse operation parameters */ private parseParameters; /** * Parse request body */ private parseRequestBody; /** * Parse operation responses */ private parseResponses; /** * Parse headers */ private parseHeaders; /** * Parse security requirements */ private parseSecurity; /** * Parse all schemas from components */ private parseSchemas; /** * Parse a single schema */ private parseSchema; /** * Parse object properties */ private parseProperties; /** * Parse components */ private parseComponents; /** * Check if object is a reference */ private isReference; /** * Resolve a reference or return the object as-is */ private resolveReference; } /** * Parse OpenAPI specification from URL or object (browser-safe) */ declare function parseOpenAPISpecFromUrl(input: string | OpenAPISpec): Promise; /** * Parse OpenAPI specification from object */ declare function parseOpenAPISpecFromObject(spec: OpenAPISpec): Promise; /** * TypeScript type generator for OpenAPI specifications */ declare class TypeScriptTypeGenerator { private config; private generatedTypes; constructor(config: CodeGenConfig); /** * Generate TypeScript types from parsed OpenAPI spec */ generateTypes(spec: ParsedOpenAPISpec): string; /** * Generate file header with metadata */ private generateHeader; /** * Generate necessary imports */ private generateImports; /** * Generate base utility types */ private generateBaseTypes; /** * Generate types for all schemas */ private generateSchemaTypes; /** * Generate a single schema type */ private generateSchemaType; /** * Generate type definition for a schema */ private generateTypeDefinition; /** * Generate object type definition */ private generateObjectType; /** * Generate array type definition */ private generateArrayType; /** * Generate primitive type definition */ private generatePrimitiveType; /** * Get TypeScript type for a property */ private getPropertyType; /** * Generate types for all operations */ private generateOperationTypes; /** * Generate types for a single operation */ private generateOperationType; /** * Generate parameter types for an operation */ private generateParameterTypes; /** * Generate parameter interface */ private generateParameterInterface; /** * Generate request type for an operation */ private generateRequestType; /** * Generate response type for an operation */ private generateResponseType; /** * Generate utility types */ private generateUtilityTypes; /** * Get formatted type name */ private getTypeName; /** * Get formatted operation type name */ private getOperationTypeName; /** * Convert string to PascalCase */ private toPascalCase; } /** * API client generator for OpenAPI specifications */ declare class ApiClientGenerator { private config; constructor(config: CodeGenConfig); /** * Generate API client from parsed OpenAPI spec */ generateClient(spec: ParsedOpenAPISpec): string; /** * Generate file header */ private generateHeader; /** * Generate necessary imports */ private generateImports; /** * Generate main class definition */ private generateClassDefinition; /** * Generate constructor */ private generateConstructor; /** * Generate all API methods */ private generateMethods; /** * Generate a single API method */ private generateMethod; /** * Generate method parameters */ private generateMethodParameters; /** * Generate path construction code */ private generatePathConstruction; /** * Generate request configuration */ private generateRequestConfig; /** * Get parameter TypeScript type */ private getParameterType; /** * Get schema TypeScript type */ private getSchemaType; /** * Generate return type for method */ private generateReturnType; /** * Get response data type */ private getResponseDataType; /** * Get request body type */ private getRequestBodyType; /** * Generate the correct method call based on HTTP method */ private generateMethodCall; /** * Generate utility methods */ private generateUtilities; /** * Generate error handler */ private generateErrorHandler; /** * Get client class name from API title */ private getClientName; /** * Get method name from operation ID */ private getMethodName; /** * Convert string to PascalCase */ private toPascalCase; /** * Convert string to camelCase */ private toCamelCase; } /** * React hooks generator for OpenAPI specifications */ declare class ReactHooksGenerator { private config; constructor(config: CodeGenConfig); /** * Generate React hooks from parsed OpenAPI spec */ generateHooks(spec: ParsedOpenAPISpec): string; /** * Generate file header */ private generateHeader; /** * Generate necessary imports */ private generateImports; /** * Generate query hooks (GET operations) */ private generateQueryHooks; /** * Generate a single query hook */ private generateQueryHook; /** * Generate React Query hook */ private generateReactQueryHook; /** * Generate SWR hook */ private generateSWRHook; /** * Generate custom query hook */ private generateCustomQueryHook; /** * Generate mutation hooks (POST, PUT, PATCH, DELETE operations) */ private generateMutationHooks; /** * Generate a single mutation hook */ private generateMutationHook; /** * Generate React Query mutation hook */ private generateReactQueryMutation; /** * Generate custom mutation hook */ private generateCustomMutationHook; /** * Generate utility hooks */ private generateUtilityHooks; private getQueryHookName; private getMutationHookName; private generateHookParameters; private generateMutationParameters; /** * Generate mutation variables type */ private generateMutationVariablesType; private generateQueryKey; private generateFetcher; private generateFetcherArgs; private generateEnabledCondition; private generateDependencyArray; private generateMutationFunction; private generateMutationDependencies; private generateInvalidationLogic; private getQueryReturnType; private getRequestBodyType; private getParameterType; private getMutationReturnType; private getMutationVariablesType; private toPascalCase; private toCamelCase; } /** * Generate all code from OpenAPI specification (browser-safe) */ declare function generateFromSpecUrl(spec: string | OpenAPISpec, config: CodeGenConfig): Promise<{ types?: string; client?: string; hooks?: string; }>; /** * Generate all code from OpenAPI specification object */ declare function generateFromSpecObject(spec: OpenAPISpec, config: CodeGenConfig): Promise<{ types?: string; client?: string; hooks?: string; }>; /** * Generate TypeScript types only */ declare function generateTypes(spec: ParsedOpenAPISpec, config: CodeGenConfig): string; /** * Generate API client only */ declare function generateClient(spec: ParsedOpenAPISpec, config: CodeGenConfig): string; /** * Generate React hooks only */ declare function generateHooks(spec: ParsedOpenAPISpec, config: CodeGenConfig): string; /** * Create default configuration */ declare function createDefaultConfig(overrides?: Partial): CodeGenConfig; /** * Validate configuration */ declare function validateConfig(config: Partial): { isValid: boolean; errors: string[]; warnings: string[]; }; /** * Generate index file content for exports */ declare function generateIndexFileContent(generated: { types?: string; client?: string; hooks?: string; }): string; /** * Merge configurations */ declare function mergeConfigs(...configs: Partial[]): CodeGenConfig; /** * Get configuration template */ declare function getConfigTemplate(format?: 'js' | 'json'): string; /** * Get example OpenAPI specifications */ declare function getExampleSpecs(): Record; interface PaginatedResponse { count: number; next: string | null; previous: string | null; results: T[]; } interface ApiErrorResponse { detail?: string; message?: string; errors?: Record; non_field_errors?: string[]; } interface ListParams { page?: number; page_size?: number; ordering?: string; search?: string; } interface CreateResponse { data: T; message?: string; } interface UpdateResponse { data: T; message?: string; } interface DeleteResponse { message?: string; } interface User { id: string | number; username: string; email: string; first_name?: string; last_name?: string; is_active?: boolean; is_staff?: boolean; is_superuser?: boolean; date_joined?: string; last_login?: string; } interface AuthTokens { access: string; refresh: string; } interface AuthResponse { user: User; tokens: AuthTokens; } interface RefreshTokenResponse { access: string; } interface StateConfig { defaultCacheTTL?: number; maxCacheSize?: number; persistState?: boolean; enableRealtime?: boolean; websocketUrl?: string; syncInterval?: number; enableOffline?: boolean; offlineQueueSize?: number; enableOptimisticUpdates?: boolean; rollbackTimeout?: number; } interface ApiStateOptions { cacheTTL?: number; tags?: string[]; optimistic?: boolean; realtime?: boolean; } interface CacheEntry { data: T; timestamp: number; ttl: number; tags: string[]; } interface ApiState { data: T | null; loading: boolean; error: Error | null; lastFetch: number | null; tags: string[]; } interface GlobalState { [key: string]: unknown; } export { AdminGuard, AdvancedAuthConfigs, AdvancedAuthDebug, AdvancedAuthProvider, ApiClient, ApiClientGenerator, AppleLoginButton, AuthProvider, AuthenticatedGuard, CommonPermissions, CommonRoles, ConditionalGuard, DefaultRBACManager, DefaultSocialLoginManager, DiscordLoginButton, EndpointManager, FacebookLoginButton, FeatureGate, GitHubLoginButton, GoogleLoginButton, LinkedInLoginButton, MicrosoftLoginButton, OpenAPIParser, PermissionBuilder, PermissionComparator, PermissionGuard, PermissionValidator, RBACContent, RBACDebug, ReactHooksGenerator, RoleGuard, RoleHierarchy, SocialLoginButton, TwitterLoginButton, TypeScriptTypeGenerator, authInterceptor, cacheInterceptor, configureAuth, configureDevelopmentAuth, configureEmailAuth, convertToRBACUser, createApiClient, createAuth0Config, createAuthInterceptor, createAuthLoggingInterceptor, createAuthenticatedApiClient, createCustomAuthConfig, createDefaultConfig, createDjangoAllauthConfig, createDjangoApiClient, createDjangoRestFrameworkConfig, createEndpointManager, createFirebaseConfig, createPermission, createRBACUser, createRetryInterceptor, createRole, createSupabaseConfig, detectAuthProvider, generateClient, generateFromSpecObject, generateFromSpecUrl, generateHooks, generateIndexFileContent, generateTypes, getConfigTemplate, getExampleSpecs, getProviderExamples, loggingInterceptor, mergeConfigs, parseOpenAPISpecFromObject, parseOpenAPISpecFromUrl, retryInterceptor, setupAuthInterceptors, setupDevelopmentAuthInterceptors, setupProductionAuthInterceptors, useAdminAccess, useAdvancedAuth, useAdvancedAuthContext, useAppleLogin, useAuth, useAuthError, useAuthErrorMessages, useAuthPermissions, useAuthRedirect, useAuthStatus, useDiscordLogin, useFacebookLogin, useGitHubLogin, useGoogleLogin, useLinkedInLogin, useMicrosoftLogin, usePermission, useRBAC, useRole, useSimpleAuth, useSmartAuth, useSocialCallback, useSocialLogin, useSocialProvider, useTwitterLogin, validateAuthConfig, validateConfig, withAdvancedAuth, withRBACGuard }; export type { ApiError, ApiErrorResponse, ApiResponse, ApiState, ApiStateOptions, AuthConfig, AuthInterceptorConfig, AuthResponse, AuthState, AuthTokens, BatchRequest, BatchResponse, CacheEntry, CreateResponse, DeleteResponse, DownloadOptions, GlobalState, HttpClientConfig, Interceptor, ListParams, LoginCredentials, PaginatedResponse, RefreshTokenResponse, RequestConfig, RequestOptions, StateConfig, StreamOptions, UpdateResponse, UploadOptions, UseAuthOptions$1 as UseAuthOptions, UseAuthReturn$1 as UseAuthReturn, User$1 as User };