@djangocfg/api 2.1.55 → 2.1.56
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth.cjs +28 -15
- package/dist/auth.cjs.map +1 -1
- package/dist/auth.d.cts +6 -6
- package/dist/auth.d.ts +6 -6
- package/dist/auth.mjs +28 -15
- package/dist/auth.mjs.map +1 -1
- package/dist/clients.cjs +56 -17
- package/dist/clients.cjs.map +1 -1
- package/dist/clients.d.cts +17 -17
- package/dist/clients.d.ts +17 -17
- package/dist/clients.mjs +56 -17
- package/dist/clients.mjs.map +1 -1
- package/dist/hooks.cjs +763 -12
- package/dist/hooks.cjs.map +1 -1
- package/dist/hooks.d.cts +11 -11
- package/dist/hooks.d.ts +11 -11
- package/dist/hooks.mjs +763 -12
- package/dist/hooks.mjs.map +1 -1
- package/dist/index.cjs +893 -69
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +59 -41
- package/dist/index.d.ts +59 -41
- package/dist/index.mjs +893 -69
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/generated/cfg_accounts/_utils/schemas/CentrifugoToken.schema.ts +1 -1
- package/src/generated/cfg_accounts/_utils/schemas/OAuthAuthorizeRequestRequest.schema.ts +2 -2
- package/src/generated/cfg_accounts/_utils/schemas/OAuthAuthorizeResponse.schema.ts +1 -1
- package/src/generated/cfg_accounts/_utils/schemas/OAuthCallbackRequestRequest.schema.ts +1 -1
- package/src/generated/cfg_accounts/_utils/schemas/OAuthConnection.schema.ts +1 -1
- package/src/generated/cfg_accounts/_utils/schemas/OAuthProvidersResponse.schema.ts +1 -1
- package/src/generated/cfg_accounts/_utils/schemas/OAuthTokenResponse.schema.ts +1 -1
- package/src/generated/cfg_accounts/_utils/schemas/OTPRequestRequest.schema.ts +1 -1
- package/src/generated/cfg_accounts/_utils/schemas/OTPVerifyRequest.schema.ts +1 -1
- package/src/generated/cfg_accounts/_utils/schemas/User.schema.ts +1 -1
- package/src/generated/cfg_accounts/api-instance.ts +61 -13
- package/src/generated/cfg_centrifugo/api-instance.ts +61 -13
- package/src/generated/cfg_totp/CLAUDE.md +90 -0
- package/src/generated/cfg_totp/_utils/fetchers/index.ts +33 -0
- package/src/generated/cfg_totp/_utils/fetchers/totp.ts +49 -0
- package/src/generated/cfg_totp/_utils/fetchers/totp__2fa_management.ts +108 -0
- package/src/generated/cfg_totp/_utils/fetchers/totp__2fa_setup.ts +153 -0
- package/src/generated/cfg_totp/_utils/fetchers/totp__2fa_verification.ts +152 -0
- package/src/generated/cfg_totp/_utils/fetchers/totp__backup_codes.ts +152 -0
- package/src/generated/cfg_totp/_utils/hooks/index.ts +33 -0
- package/src/generated/cfg_totp/_utils/hooks/totp.ts +42 -0
- package/src/generated/cfg_totp/_utils/hooks/totp__2fa_management.ts +58 -0
- package/src/generated/cfg_totp/_utils/hooks/totp__2fa_setup.ts +63 -0
- package/src/generated/cfg_totp/_utils/hooks/totp__2fa_verification.ts +62 -0
- package/src/generated/cfg_totp/_utils/hooks/totp__backup_codes.ts +59 -0
- package/src/generated/cfg_totp/_utils/schemas/BackupCodesRegenerateRequest.schema.ts +19 -0
- package/src/generated/cfg_totp/_utils/schemas/BackupCodesRegenerateResponse.schema.ts +20 -0
- package/src/generated/cfg_totp/_utils/schemas/BackupCodesStatus.schema.ts +21 -0
- package/src/generated/cfg_totp/_utils/schemas/ConfirmSetupRequest.schema.ts +20 -0
- package/src/generated/cfg_totp/_utils/schemas/ConfirmSetupResponse.schema.ts +21 -0
- package/src/generated/cfg_totp/_utils/schemas/DeviceList.schema.ts +26 -0
- package/src/generated/cfg_totp/_utils/schemas/DisableRequest.schema.ts +19 -0
- package/src/generated/cfg_totp/_utils/schemas/PaginatedDeviceListList.schema.ts +24 -0
- package/src/generated/cfg_totp/_utils/schemas/SetupRequest.schema.ts +19 -0
- package/src/generated/cfg_totp/_utils/schemas/SetupResponse.schema.ts +23 -0
- package/src/generated/cfg_totp/_utils/schemas/VerifyBackupRequest.schema.ts +20 -0
- package/src/generated/cfg_totp/_utils/schemas/VerifyRequest.schema.ts +20 -0
- package/src/generated/cfg_totp/_utils/schemas/VerifyResponse.schema.ts +24 -0
- package/src/generated/cfg_totp/_utils/schemas/index.ts +32 -0
- package/src/generated/cfg_totp/api-instance.ts +180 -0
- package/src/generated/cfg_totp/client.ts +313 -0
- package/src/generated/cfg_totp/enums.ts +12 -0
- package/src/generated/cfg_totp/errors.ts +117 -0
- package/src/generated/cfg_totp/http.ts +104 -0
- package/src/generated/cfg_totp/index.ts +302 -0
- package/src/generated/cfg_totp/logger.ts +260 -0
- package/src/generated/cfg_totp/retry.ts +176 -0
- package/src/generated/cfg_totp/schema.json +859 -0
- package/src/generated/cfg_totp/storage.ts +162 -0
- package/src/generated/cfg_totp/totp/client.ts +23 -0
- package/src/generated/cfg_totp/totp/index.ts +3 -0
- package/src/generated/cfg_totp/totp/models.ts +1 -0
- package/src/generated/cfg_totp/totp__2fa_management/client.ts +41 -0
- package/src/generated/cfg_totp/totp__2fa_management/index.ts +3 -0
- package/src/generated/cfg_totp/totp__2fa_management/models.ts +60 -0
- package/src/generated/cfg_totp/totp__2fa_setup/client.ts +32 -0
- package/src/generated/cfg_totp/totp__2fa_setup/index.ts +3 -0
- package/src/generated/cfg_totp/totp__2fa_setup/models.ts +54 -0
- package/src/generated/cfg_totp/totp__2fa_verification/client.ts +32 -0
- package/src/generated/cfg_totp/totp__2fa_verification/index.ts +3 -0
- package/src/generated/cfg_totp/totp__2fa_verification/models.ts +44 -0
- package/src/generated/cfg_totp/totp__backup_codes/client.ts +31 -0
- package/src/generated/cfg_totp/totp__backup_codes/index.ts +3 -0
- package/src/generated/cfg_totp/totp__backup_codes/models.ts +37 -0
- package/src/generated/cfg_totp/validation-events.ts +134 -0
- package/src/generated/cfg_webpush/_utils/schemas/SendPushRequestRequest.schema.ts +2 -2
- package/src/generated/cfg_webpush/_utils/schemas/SubscribeRequestRequest.schema.ts +1 -1
- package/src/generated/cfg_webpush/api-instance.ts +61 -13
package/dist/auth.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/auth/index.ts","../src/auth/context/AuthContext.tsx","../src/generated/cfg_accounts/accounts__auth/client.ts","../src/generated/cfg_accounts/accounts__oauth/client.ts","../src/generated/cfg_accounts/accounts__user_profile/client.ts","../src/generated/cfg_accounts/accounts/client.ts","../src/generated/cfg_accounts/http.ts","../src/generated/cfg_accounts/errors.ts","../src/generated/cfg_accounts/logger.ts","../src/generated/cfg_accounts/retry.ts","../src/generated/cfg_accounts/client.ts","../src/generated/cfg_accounts/storage.ts","../src/generated/cfg_accounts/enums.ts","../src/generated/cfg_accounts/_utils/schemas/CentrifugoToken.schema.ts","../src/generated/cfg_accounts/_utils/schemas/OAuthAuthorizeRequestRequest.schema.ts","../src/generated/cfg_accounts/_utils/schemas/OAuthAuthorizeResponse.schema.ts","../src/generated/cfg_accounts/_utils/schemas/OAuthCallbackRequestRequest.schema.ts","../src/generated/cfg_accounts/_utils/schemas/OAuthConnection.schema.ts","../src/generated/cfg_accounts/_utils/schemas/OAuthDisconnectRequestRequest.schema.ts","../src/generated/cfg_accounts/_utils/schemas/OAuthError.schema.ts","../src/generated/cfg_accounts/_utils/schemas/OAuthProvidersResponse.schema.ts","../src/generated/cfg_accounts/_utils/schemas/OAuthTokenResponse.schema.ts","../src/generated/cfg_accounts/_utils/schemas/OTPErrorResponse.schema.ts","../src/generated/cfg_accounts/_utils/schemas/OTPRequestRequest.schema.ts","../src/generated/cfg_accounts/_utils/schemas/OTPRequestResponse.schema.ts","../src/generated/cfg_accounts/_utils/schemas/OTPVerifyRequest.schema.ts","../src/generated/cfg_accounts/_utils/schemas/OTPVerifyResponse.schema.ts","../src/generated/cfg_accounts/_utils/schemas/User.schema.ts","../src/generated/cfg_accounts/_utils/schemas/PatchedUserProfileUpdateRequest.schema.ts","../src/generated/cfg_accounts/_utils/schemas/TokenRefresh.schema.ts","../src/generated/cfg_accounts/_utils/schemas/TokenRefreshRequest.schema.ts","../src/generated/cfg_accounts/_utils/schemas/UserProfileUpdateRequest.schema.ts","../src/generated/cfg_accounts/_utils/fetchers/accounts.ts","../src/generated/cfg_accounts/api-instance.ts","../src/generated/cfg_accounts/_utils/fetchers/accounts__auth.ts","../src/generated/cfg_accounts/_utils/fetchers/accounts__oauth.ts","../src/generated/cfg_accounts/_utils/fetchers/accounts__user_profile.ts","../src/generated/cfg_accounts/index.ts","../src/generated/cfg_centrifugo/centrifugo__centrifugo_admin_api/client.ts","../src/generated/cfg_centrifugo/centrifugo__centrifugo_auth/client.ts","../src/generated/cfg_centrifugo/centrifugo__centrifugo_monitoring/client.ts","../src/generated/cfg_centrifugo/centrifugo__centrifugo_testing/client.ts","../src/generated/cfg_centrifugo/http.ts","../src/generated/cfg_centrifugo/errors.ts","../src/generated/cfg_centrifugo/logger.ts","../src/generated/cfg_centrifugo/retry.ts","../src/generated/cfg_centrifugo/client.ts","../src/generated/cfg_centrifugo/storage.ts","../src/generated/cfg_centrifugo/_utils/schemas/CentrifugoChannelInfo.schema.ts","../src/generated/cfg_centrifugo/_utils/schemas/CentrifugoChannelsRequestRequest.schema.ts","../src/generated/cfg_centrifugo/_utils/schemas/CentrifugoChannelsResponse.schema.ts","../src/generated/cfg_centrifugo/_utils/schemas/CentrifugoChannelsResult.schema.ts","../src/generated/cfg_centrifugo/_utils/schemas/CentrifugoError.schema.ts","../src/generated/cfg_centrifugo/_utils/schemas/CentrifugoClientInfo.schema.ts","../src/generated/cfg_centrifugo/_utils/schemas/CentrifugoHealthCheck.schema.ts","../src/generated/cfg_centrifugo/_utils/schemas/CentrifugoHistoryRequestRequest.schema.ts","../src/generated/cfg_centrifugo/_utils/schemas/CentrifugoStreamPosition.schema.ts","../src/generated/cfg_centrifugo/_utils/schemas/CentrifugoHistoryResponse.schema.ts","../src/generated/cfg_centrifugo/_utils/schemas/CentrifugoHistoryResult.schema.ts","../src/generated/cfg_centrifugo/_utils/schemas/CentrifugoPublication.schema.ts","../src/generated/cfg_centrifugo/_utils/schemas/CentrifugoInfoResponse.schema.ts","../src/generated/cfg_centrifugo/_utils/schemas/CentrifugoInfoResult.schema.ts","../src/generated/cfg_centrifugo/_utils/schemas/CentrifugoNodeInfo.schema.ts","../src/generated/cfg_centrifugo/_utils/schemas/CentrifugoMetrics.schema.ts","../src/generated/cfg_centrifugo/_utils/schemas/CentrifugoProcess.schema.ts","../src/generated/cfg_centrifugo/_utils/schemas/CentrifugoOverviewStats.schema.ts","../src/generated/cfg_centrifugo/_utils/schemas/CentrifugoPresenceRequestRequest.schema.ts","../src/generated/cfg_centrifugo/_utils/schemas/CentrifugoPresenceResponse.schema.ts","../src/generated/cfg_centrifugo/_utils/schemas/CentrifugoPresenceResult.schema.ts","../src/generated/cfg_centrifugo/_utils/schemas/CentrifugoPresenceStatsRequestRequest.schema.ts","../src/generated/cfg_centrifugo/_utils/schemas/CentrifugoPresenceStatsResponse.schema.ts","../src/generated/cfg_centrifugo/_utils/schemas/CentrifugoPresenceStatsResult.schema.ts","../src/generated/cfg_centrifugo/_utils/schemas/ChannelList.schema.ts","../src/generated/cfg_centrifugo/_utils/schemas/ChannelStats.schema.ts","../src/generated/cfg_centrifugo/_utils/schemas/ConnectionTokenResponse.schema.ts","../src/generated/cfg_centrifugo/_utils/schemas/ManualAckRequestRequest.schema.ts","../src/generated/cfg_centrifugo/_utils/schemas/ManualAckResponse.schema.ts","../src/generated/cfg_centrifugo/_utils/schemas/PaginatedPublishList.schema.ts","../src/generated/cfg_centrifugo/_utils/schemas/Publish.schema.ts","../src/generated/cfg_centrifugo/_utils/schemas/PublishTestRequestRequest.schema.ts","../src/generated/cfg_centrifugo/_utils/schemas/PublishTestResponse.schema.ts","../src/generated/cfg_centrifugo/_utils/schemas/TimelineItem.schema.ts","../src/generated/cfg_centrifugo/_utils/schemas/TimelineResponse.schema.ts","../src/generated/cfg_centrifugo/_utils/fetchers/centrifugo__centrifugo_admin_api.ts","../src/generated/cfg_centrifugo/_utils/fetchers/centrifugo__centrifugo_auth.ts","../src/generated/cfg_centrifugo/_utils/fetchers/centrifugo__centrifugo_monitoring.ts","../src/generated/cfg_centrifugo/_utils/fetchers/centrifugo__centrifugo_testing.ts","../src/generated/cfg_centrifugo/index.ts","../src/generated/cfg_webpush/webpush__web_push/client.ts","../src/generated/cfg_webpush/http.ts","../src/generated/cfg_webpush/errors.ts","../src/generated/cfg_webpush/logger.ts","../src/generated/cfg_webpush/retry.ts","../src/generated/cfg_webpush/client.ts","../src/generated/cfg_webpush/storage.ts","../src/generated/cfg_webpush/_utils/schemas/SendPushRequestRequest.schema.ts","../src/generated/cfg_webpush/_utils/schemas/SendPushResponse.schema.ts","../src/generated/cfg_webpush/_utils/schemas/SubscribeRequestRequest.schema.ts","../src/generated/cfg_webpush/_utils/schemas/SubscribeResponse.schema.ts","../src/generated/cfg_webpush/_utils/schemas/VapidPublicKeyResponse.schema.ts","../src/generated/cfg_webpush/_utils/fetchers/webpush__web_push.ts","../src/generated/cfg_webpush/index.ts","../src/index.ts","../src/auth/utils/logger.ts","../src/auth/hooks/useBase64.ts","../src/auth/hooks/useProfileCache.ts","../src/auth/hooks/useSessionStorage.ts","../src/auth/hooks/useAuthRedirect.ts","../src/auth/utils/analytics.ts","../src/auth/context/AccountsContext.tsx","../src/generated/cfg_accounts/_utils/hooks/accounts__auth.ts","../src/generated/cfg_accounts/_utils/hooks/accounts__oauth.ts","../src/generated/cfg_accounts/_utils/hooks/accounts__user_profile.ts","../src/generated/cfg_accounts/_utils/hooks/accounts.ts","../src/auth/hooks/useAuthGuard.ts","../src/auth/hooks/useLocalStorage.ts","../src/auth/hooks/useAuthForm.ts","../src/auth/hooks/useAutoAuth.ts","../src/auth/hooks/useGithubAuth.ts","../src/generated/cfg_webpush/_utils/hooks/webpush__web_push.ts","../src/generated/cfg_centrifugo/_utils/hooks/centrifugo__centrifugo_admin_api.ts","../src/generated/cfg_centrifugo/_utils/hooks/centrifugo__centrifugo_auth.ts","../src/generated/cfg_centrifugo/_utils/hooks/centrifugo__centrifugo_monitoring.ts","../src/generated/cfg_centrifugo/_utils/hooks/centrifugo__centrifugo_testing.ts","../src/clients.ts","../src/auth/utils/validation.ts","../src/auth/utils/errors.ts"],"sourcesContent":["/**\n * @djangocfg/api/auth\n *\n * Authentication module with contexts, hooks and utilities.\n * Use this entry point in client components.\n *\n * @example\n * ```tsx\n * 'use client';\n * import { AuthProvider, useAuth } from '@djangocfg/api/auth';\n *\n * export function MyApp({ children }) {\n * return (\n * <AuthProvider>\n * {children}\n * </AuthProvider>\n * );\n * }\n *\n * export function Profile() {\n * const { user, logout } = useAuth();\n * return <div>{user?.email}</div>;\n * }\n * ```\n */\n\n// Contexts\nexport * from './context';\n\n// Hooks\nexport * from './hooks';\n\n// Utils (validation, errors, analytics)\nexport * from './utils';\n","// @ts-nocheck\n'use client';\n\nimport { usePathname } from 'next/navigation';\nimport React, {\n createContext, ReactNode, useCallback, useContext, useEffect, useMemo, useRef, useState\n} from 'react';\n\nimport { useCfgRouter, useLocalStorage, useQueryParams } from '@djangocfg/ui-nextjs/hooks';\n\nimport { api as apiAccounts, Enums } from '../../';\nimport { clearProfileCache, getCachedProfile } from '../hooks/useProfileCache';\nimport { useAuthRedirectManager } from '../hooks/useAuthRedirect';\nimport { Analytics, AnalyticsCategory, AnalyticsEvent } from '../utils/analytics';\nimport { authLogger } from '../utils/logger';\nimport { AccountsProvider, useAccountsContext } from './AccountsContext';\n\nimport type { AuthConfig, AuthContextType, AuthProviderProps, UserProfile } from './types';\n\n// Default routes\nconst defaultRoutes = {\n auth: '/auth',\n defaultCallback: '/dashboard',\n defaultAuthCallback: '/auth',\n};\n\nconst AuthContext = createContext<AuthContextType | undefined>(undefined);\n\n// Constants\nconst EMAIL_STORAGE_KEY = 'auth_email';\nconst PHONE_STORAGE_KEY = 'auth_phone';\n\nconst hasValidTokens = (): boolean => {\n if (typeof window === 'undefined') return false;\n return apiAccounts.isAuthenticated();\n};\n\n// Internal provider that uses AccountsContext\nconst AuthProviderInternal: React.FC<AuthProviderProps> = ({ children, config }) => {\n const accounts = useAccountsContext();\n\n // Redirect URL manager for saving URL before auth redirect\n const redirectManager = useAuthRedirectManager({\n fallbackUrl: config?.routes?.defaultCallback || defaultRoutes.defaultCallback,\n clearOnUse: true,\n });\n\n // Smart initial loading state: only true if we don't have tokens yet\n const [isLoading, setIsLoading] = useState(() => {\n // If we already have tokens and profile, don't show loading\n if (typeof window !== 'undefined') {\n const hasTokens = hasValidTokens();\n // Only show loading on initial mount if no tokens\n return !hasTokens;\n }\n return true;\n });\n\n const [initialized, setInitialized] = useState(false);\n const router = useCfgRouter();\n const pathname = usePathname();\n const queryParams = useQueryParams();\n\n // Use localStorage hooks for email and phone\n const [storedEmail, setStoredEmail, clearStoredEmail] = useLocalStorage<string | null>(EMAIL_STORAGE_KEY, null);\n const [storedPhone, setStoredPhone, clearStoredPhone] = useLocalStorage<string | null>(PHONE_STORAGE_KEY, null);\n\n // Map AccountsContext profile to UserProfile\n const user = accounts.profile as UserProfile | null;\n\n // Use refs to avoid dependency issues\n const userRef = useRef(user);\n const configRef = useRef(config);\n const isLoadingProfileRef = useRef(false);\n\n // Update refs when values change\n useEffect(() => {\n userRef.current = user;\n }, [user]);\n\n useEffect(() => {\n configRef.current = config;\n }, [config]);\n\n // Note: API URL is configured in BaseClient, not at runtime\n\n // Common function to clear auth state\n const clearAuthState = useCallback((caller: string) => {\n authLogger.info('clearAuthState >> caller', caller);\n apiAccounts.clearTokens();\n clearProfileCache(); // Clear profile cache from localStorage\n // Note: user is now managed by AccountsContext, will auto-update\n setInitialized(true);\n setIsLoading(false);\n }, []);\n\n // Global error handler for auth-related errors\n const handleGlobalAuthError = useCallback((error: any, context: string = 'API Request') => {\n // Simple error check - if response has error flag, it's an error\n if (error?.success === false) {\n authLogger.warn(`Error detected in ${context}, clearing tokens`);\n clearAuthState(`globalAuthError:${context}`);\n return true;\n }\n\n return false;\n }, [clearAuthState]);\n\n // Simple profile loading without retry - now uses AccountsContext with memoization\n const loadCurrentProfile = useCallback(async (callerId?: string): Promise<void> => {\n const finalCallerId = callerId || 'AuthContext.loadCurrentProfile';\n\n // Check if profile loading is already in progress\n if (isLoadingProfileRef.current) {\n authLogger.debug(`Profile loading already in progress, skipping duplicate call from: ${finalCallerId}`);\n return;\n }\n\n authLogger.debug(`loadCurrentProfile called by: ${finalCallerId}`);\n\n try {\n isLoadingProfileRef.current = true;\n\n // Ensure API clients are properly initialized with current token\n const isAuth = apiAccounts.isAuthenticated();\n const token = apiAccounts.getToken();\n // authLogger.debug('isAuthenticated:', isAuth, 'token:', token ? token.substring(0, 20) + '...' : 'null');\n\n if (!isAuth) {\n authLogger.warn('No valid authentication token, throwing error');\n throw new Error('No valid authentication token');\n }\n\n // Check if profile is already loaded in AccountsContext to prevent duplicate API calls\n if (accounts.profile && !accounts.isLoadingProfile) {\n authLogger.debug('Profile already loaded in AccountsContext, skipping API call');\n setInitialized(true);\n return;\n }\n\n // Refresh profile from AccountsContext (now with memoization)\n const refreshedProfile = await accounts.refreshProfile(finalCallerId);\n\n if (refreshedProfile) {\n authLogger.info('Profile loaded successfully:', refreshedProfile.id);\n } else {\n authLogger.warn('Profile refresh returned undefined - but keeping tokens');\n }\n\n // Always mark as initialized if we have valid tokens\n // Don't clear tokens just because profile fetch failed\n setInitialized(true);\n } catch (error) {\n authLogger.error('Failed to load profile:', error);\n // Use global error handler first, fallback to clearing state\n if (!handleGlobalAuthError(error, 'loadCurrentProfile')) {\n clearAuthState('loadCurrentProfile:error');\n }\n } finally {\n isLoadingProfileRef.current = false;\n }\n }, [clearAuthState, handleGlobalAuthError, accounts]);\n\n // Initialize auth state once\n useEffect(() => {\n if (initialized) return;\n\n const initializeAuth = async () => {\n authLogger.info('Initializing auth...');\n\n // Check if running in iframe (AdminLayout will handle auth via postMessage)\n const isInIframe = typeof window !== 'undefined' && window.self !== window.top;\n authLogger.info('Is in iframe:', isInIframe);\n\n // Debug token state\n const token = apiAccounts.getToken();\n const refreshToken = apiAccounts.getRefreshToken();\n authLogger.info('Token from API:', token ? `${token.substring(0, 20)}...` : 'null');\n authLogger.info('Refresh token from API:', refreshToken ? `${refreshToken.substring(0, 20)}...` : 'null');\n authLogger.info('localStorage keys:', Object.keys(localStorage).filter(k => k.includes('token') || k.includes('auth')));\n\n const hasTokens = hasValidTokens();\n authLogger.info('Has tokens:', hasTokens);\n\n // Check if profile is already loaded from cache (AccountsContext initialization)\n if (userRef.current) {\n authLogger.info('Profile already loaded from AccountsContext cache, skipping API request');\n setInitialized(true);\n setIsLoading(false);\n return;\n }\n\n // Check if cache exists in localStorage (before userRef updates)\n const cachedProfile = getCachedProfile();\n if (cachedProfile) {\n authLogger.info('Profile found in localStorage cache, skipping API request');\n setInitialized(true);\n setIsLoading(false);\n return;\n }\n\n // In iframe mode WITHOUT tokens yet - wait for AdminLayout to receive them via postMessage\n // Don't initialize yet - AdminLayout.handleAuthToken will call loadCurrentProfile\n if (isInIframe && !hasTokens) {\n authLogger.info('Running in iframe without tokens - waiting for parent to send via postMessage');\n authLogger.info('AdminLayout will handle auth initialization, skipping AuthContext init');\n setInitialized(true); // Mark as initialized to prevent re-initialization\n setIsLoading(false);\n return;\n }\n\n if (hasTokens) {\n setIsLoading(true);\n try {\n authLogger.info('No cached profile found, loading from API...');\n await loadCurrentProfile('AuthContext.initializeAuth');\n } catch (error) {\n authLogger.error('Failed to load profile during initialization:', error);\n // If profile loading fails, clear auth state\n clearAuthState('initializeAuth:loadProfileFailed');\n }\n setIsLoading(false);\n } else {\n setInitialized(true);\n setIsLoading(false);\n }\n };\n\n initializeAuth();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [initialized]);\n\n // Redirect logic - only for unauthenticated users on protected pages\n useEffect(() => {\n if (!initialized) return;\n\n // Consider authenticated if we have valid tokens, even without profile\n const isAuthenticated = apiAccounts.isAuthenticated();\n const authRoute = config?.routes?.auth || defaultRoutes.auth;\n const isAuthPage = pathname === authRoute;\n const flowParam = queryParams.get('flow');\n\n // Only redirect authenticated users away from auth page if they're not in a flow\n // This prevents interference with OTP verification flow\n if (isAuthenticated && isAuthPage && !flowParam) {\n const callbackUrl = config?.routes?.defaultCallback || defaultRoutes.defaultCallback;\n router.push(callbackUrl);\n }\n }, [initialized, pathname, queryParams, config?.routes]);\n\n const pushToDefaultCallbackUrl = useCallback(() => {\n const callbackUrl = config?.routes?.defaultCallback || defaultRoutes.defaultCallback;\n router.push(callbackUrl);\n }, [config?.routes, router]);\n\n const pushToDefaultAuthCallbackUrl = useCallback(() => {\n const authCallbackUrl = config?.routes?.defaultAuthCallback || defaultRoutes.defaultAuthCallback;\n router.push(authCallbackUrl);\n }, [config?.routes, router]);\n\n // Memoized checkAuthAndRedirect function\n const checkAuthAndRedirect = useCallback(async () => {\n try {\n setIsLoading(true);\n const isAuthenticated = apiAccounts.isAuthenticated();\n\n if (isAuthenticated) {\n await loadCurrentProfile();\n if (userRef.current) {\n pushToDefaultCallbackUrl();\n }\n } else {\n pushToDefaultAuthCallbackUrl();\n }\n } catch (error) {\n authLogger.error('Failed to check authentication:', error);\n // Use global error handler first\n if (!handleGlobalAuthError(error, 'checkAuthAndRedirect')) {\n clearAuthState('checkAuthAndRedirect');\n }\n pushToDefaultAuthCallbackUrl();\n } finally {\n setIsLoading(false);\n }\n }, [loadCurrentProfile, clearAuthState, pushToDefaultCallbackUrl, pushToDefaultAuthCallbackUrl, handleGlobalAuthError]);\n\n // OTP methods - supports both email and phone - now uses AccountsContext\n const requestOTP = useCallback(\n async (identifier: string, channel?: 'email' | 'phone', sourceUrl?: string): Promise<{ success: boolean; message: string }> => {\n // Clear tokens before requesting OTP\n apiAccounts.clearTokens();\n\n try {\n const channelValue = channel === 'phone' \n ? Enums.OTPRequestRequestChannel.PHONE \n : Enums.OTPRequestRequestChannel.EMAIL;\n const result = await accounts.requestOTP({\n identifier,\n channel: channelValue,\n });\n\n const channelName = channel === 'phone' ? 'phone number' : 'email address';\n\n // Track OTP request\n Analytics.event(AnalyticsEvent.AUTH_OTP_REQUEST, {\n category: AnalyticsCategory.AUTH,\n label: channel || 'email',\n });\n\n return {\n success: true,\n message: result.message || `OTP code sent to your ${channelName}`,\n };\n } catch (error) {\n authLogger.error('Request OTP error:', error);\n return {\n success: false,\n message: 'Failed to send OTP',\n };\n }\n },\n [accounts],\n );\n\n const verifyOTP = useCallback(\n async (identifier: string, otpCode: string, channel?: 'email' | 'phone', sourceUrl?: string, redirectUrl?: string): Promise<{ success: boolean; message: string; user?: UserProfile }> => {\n try {\n const channelValue = channel === 'phone'\n ? Enums.OTPVerifyRequestChannel.PHONE\n : Enums.OTPVerifyRequestChannel.EMAIL;\n // AccountsContext automatically saves tokens and refreshes profile\n const result = await accounts.verifyOTP({\n identifier,\n otp: otpCode,\n channel: channelValue,\n });\n\n // Verify that we got valid tokens\n if (!result.access || !result.refresh) {\n authLogger.error('Verify OTP returned invalid response:', result);\n return {\n success: false,\n message: 'Invalid OTP verification response',\n };\n }\n\n // Save identifier based on channel and clear opposite channel\n if (channel === 'phone') {\n setStoredPhone(identifier);\n clearStoredEmail();\n } else if (identifier.includes('@')) {\n setStoredEmail(identifier);\n clearStoredPhone();\n }\n\n // Small delay to ensure profile state is updated\n await new Promise(resolve => setTimeout(resolve, 200));\n\n // Track successful login\n Analytics.event(AnalyticsEvent.AUTH_LOGIN_SUCCESS, {\n category: AnalyticsCategory.AUTH,\n label: channel || 'email',\n });\n\n // Set user ID for future tracking\n if (result.user?.id) {\n Analytics.setUser(String(result.user.id));\n }\n\n // Handle redirect logic - priority: provided redirectUrl > saved redirect > config default\n // Use hardPush for full page reload - ensures all React contexts reinitialize\n const savedRedirect = redirectManager.useAndClearRedirect();\n const finalRedirectUrl = redirectUrl || savedRedirect || config?.routes?.defaultCallback || defaultRoutes.defaultCallback;\n authLogger.info('Redirecting after auth to:', finalRedirectUrl);\n router.hardPush(finalRedirectUrl);\n\n return {\n success: true,\n message: 'Login successful',\n user: result.user as UserProfile,\n };\n } catch (error) {\n authLogger.error('Verify OTP error:', error);\n\n // Track failed verification\n Analytics.event(AnalyticsEvent.AUTH_OTP_VERIFY_FAIL, {\n category: AnalyticsCategory.AUTH,\n label: channel || 'email',\n });\n\n return {\n success: false,\n message: 'Failed to verify OTP',\n };\n }\n },\n [setStoredEmail, setStoredPhone, clearStoredEmail, clearStoredPhone, config?.routes?.defaultCallback, accounts, router],\n );\n\n const refreshToken = useCallback(async (): Promise<{ success: boolean; message: string }> => {\n try {\n const refreshTokenValue = apiAccounts.getRefreshToken();\n if (!refreshTokenValue) {\n clearAuthState('refreshToken:noToken');\n\n // Track session expired\n Analytics.event(AnalyticsEvent.AUTH_SESSION_EXPIRED, {\n category: AnalyticsCategory.AUTH,\n });\n\n return {\n success: false,\n message: 'No refresh token available',\n };\n }\n\n await accounts.refreshToken(refreshTokenValue);\n\n // Track successful refresh\n Analytics.event(AnalyticsEvent.AUTH_TOKEN_REFRESH, {\n category: AnalyticsCategory.AUTH,\n });\n\n return {\n success: true,\n message: 'Token refreshed',\n };\n } catch (error) {\n authLogger.error('Refresh token error:', error);\n clearAuthState('refreshToken:error');\n\n // Track refresh failure\n Analytics.event(AnalyticsEvent.AUTH_TOKEN_REFRESH_FAIL, {\n category: AnalyticsCategory.AUTH,\n });\n\n return {\n success: false,\n message: 'Error refreshing token',\n };\n }\n }, [clearAuthState, accounts]);\n\n const logout = useCallback(async (): Promise<void> => {\n const performLogout = () => {\n // Track logout\n Analytics.event(AnalyticsEvent.AUTH_LOGOUT, {\n category: AnalyticsCategory.AUTH,\n });\n\n accounts.logout(); // Clear tokens and profile\n setInitialized(true);\n setIsLoading(false);\n\n // Use hardReplace for full page reload + replace history\n // This ensures contexts reinitialize AND back button won't return to protected page\n const authCallbackUrl = config?.routes?.defaultAuthCallback || defaultRoutes.defaultAuthCallback;\n router.hardReplace(authCallbackUrl);\n };\n\n // Use config.onConfirm if provided, otherwise use a simple confirm\n if (configRef.current?.onConfirm) {\n const { confirmed } = await configRef.current.onConfirm({\n title: 'Logout',\n description: 'Are you sure you want to logout?',\n confirmationButtonText: 'Logout',\n cancellationButtonText: 'Cancel',\n color: 'error',\n });\n if (confirmed) {\n performLogout();\n }\n } else {\n // Fallback to browser confirm\n const confirmed = window.confirm('Are you sure you want to logout?');\n if (confirmed) {\n performLogout();\n }\n }\n }, [accounts, config?.routes?.defaultAuthCallback, router]);\n\n // Computed: Is admin user (staff or superuser)\n const isAdminUser = useMemo(() => {\n return Boolean(user?.is_staff || user?.is_superuser);\n }, [user]);\n\n // Memoized context value\n const value = useMemo<AuthContextType>(\n () => ({\n user,\n isLoading,\n // Consider authenticated if we have valid tokens, even without user profile\n isAuthenticated: apiAccounts.isAuthenticated(),\n isAdminUser,\n loadCurrentProfile,\n checkAuthAndRedirect,\n getToken: () => apiAccounts.getToken(),\n getRefreshToken: () => apiAccounts.getRefreshToken(),\n getSavedEmail: () => storedEmail,\n saveEmail: setStoredEmail,\n clearSavedEmail: clearStoredEmail,\n getSavedPhone: () => storedPhone,\n savePhone: setStoredPhone,\n clearSavedPhone: clearStoredPhone,\n requestOTP,\n verifyOTP,\n refreshToken,\n logout,\n // Redirect URL methods\n saveRedirectUrl: redirectManager.setRedirect,\n getRedirectUrl: redirectManager.getFinalRedirectUrl,\n clearRedirectUrl: redirectManager.clearRedirect,\n hasRedirectUrl: redirectManager.hasRedirect,\n }),\n [\n user,\n isLoading,\n isAdminUser,\n loadCurrentProfile,\n checkAuthAndRedirect,\n storedEmail,\n setStoredEmail,\n clearStoredEmail,\n storedPhone,\n setStoredPhone,\n clearStoredPhone,\n requestOTP,\n verifyOTP,\n refreshToken,\n logout,\n redirectManager,\n ],\n );\n\n return <AuthContext.Provider value={value}>{children}</AuthContext.Provider>;\n};\n\n// Wrapper that provides AccountsContext\nexport const AuthProvider: React.FC<AuthProviderProps> = ({ children, config }) => {\n return (\n <AccountsProvider>\n <AuthProviderInternal config={config}>\n {children}\n </AuthProviderInternal>\n </AccountsProvider>\n );\n};\n\nexport const useAuth = (): AuthContextType => {\n const context = useContext(AuthContext);\n if (context === undefined) {\n throw new Error('useAuth must be used within an AuthProvider');\n }\n return context;\n};\n\nexport default AuthContext; ","import * as Models from \"./models\";\n\n\n/**\n * API endpoints for Auth.\n */\nexport class Auth {\n private client: any;\n\n constructor(client: any) {\n this.client = client;\n }\n\n /**\n * Refresh JWT token.\n */\n async accountsTokenRefreshCreate(data: Models.TokenRefreshRequest): Promise<Models.TokenRefresh> {\n const response = await this.client.request('POST', \"/cfg/accounts/token/refresh/\", { body: data });\n return response;\n }\n\n}","import * as Models from \"./models\";\n\n\n/**\n * API endpoints for Oauth.\n */\nexport class Oauth {\n private client: any;\n\n constructor(client: any) {\n this.client = client;\n }\n\n /**\n * List OAuth connections\n * \n * Get all OAuth connections for the current user.\n */\n async accountsOauthConnectionsList(): Promise<any> {\n const response = await this.client.request('GET', \"/cfg/accounts/oauth/connections/\");\n return response;\n }\n\n /**\n * Disconnect OAuth provider\n * \n * Remove OAuth connection for the specified provider.\n */\n async accountsOauthDisconnectCreate(data: Models.OAuthDisconnectRequestRequest): Promise<any> {\n const response = await this.client.request('POST', \"/cfg/accounts/oauth/disconnect/\", { body: data });\n return response;\n }\n\n /**\n * Start GitHub OAuth\n * \n * Generate GitHub OAuth authorization URL. Redirect user to this URL to\n * start authentication.\n */\n async accountsOauthGithubAuthorizeCreate(data: Models.OAuthAuthorizeRequestRequest): Promise<Models.OAuthAuthorizeResponse> {\n const response = await this.client.request('POST', \"/cfg/accounts/oauth/github/authorize/\", { body: data });\n return response;\n }\n\n /**\n * Complete GitHub OAuth\n * \n * Exchange authorization code for JWT tokens. Call this after GitHub\n * redirects back with code.\n */\n async accountsOauthGithubCallbackCreate(data: Models.OAuthCallbackRequestRequest): Promise<Models.OAuthTokenResponse> {\n const response = await this.client.request('POST', \"/cfg/accounts/oauth/github/callback/\", { body: data });\n return response;\n }\n\n /**\n * List OAuth providers\n * \n * Get list of available OAuth providers for authentication.\n */\n async accountsOauthProvidersRetrieve(): Promise<Models.OAuthProvidersResponse> {\n const response = await this.client.request('GET', \"/cfg/accounts/oauth/providers/\");\n return response;\n }\n\n}","import * as Models from \"./models\";\n\n\n/**\n * API endpoints for User Profile.\n */\nexport class UserProfile {\n private client: any;\n\n constructor(client: any) {\n this.client = client;\n }\n\n /**\n * Get current user profile\n * \n * Retrieve the current authenticated user's profile information.\n */\n async accountsProfileRetrieve(): Promise<Models.User> {\n const response = await this.client.request('GET', \"/cfg/accounts/profile/\");\n return response;\n }\n\n /**\n * Upload user avatar\n * \n * Upload avatar image for the current authenticated user. Accepts\n * multipart/form-data with 'avatar' field.\n */\n async accountsProfileAvatarCreate(data: FormData): Promise<Models.User> {\n const response = await this.client.request('POST', \"/cfg/accounts/profile/avatar/\", { formData: data });\n return response;\n }\n\n /**\n * Partial update user profile\n * \n * Partially update the current authenticated user's profile information.\n * Supports avatar upload.\n */\n async accountsProfilePartialUpdate(data: Models.UserProfileUpdateRequest): Promise<Models.User> {\n const response = await this.client.request('PUT', \"/cfg/accounts/profile/partial/\", { body: data });\n return response;\n }\n\n /**\n * Partial update user profile\n * \n * Partially update the current authenticated user's profile information.\n * Supports avatar upload.\n */\n async accountsProfilePartialPartialUpdate(data?: Models.PatchedUserProfileUpdateRequest): Promise<Models.User> {\n const response = await this.client.request('PATCH', \"/cfg/accounts/profile/partial/\", { body: data });\n return response;\n }\n\n /**\n * Update user profile\n * \n * Update the current authenticated user's profile information.\n */\n async accountsProfileUpdateUpdate(data: Models.UserProfileUpdateRequest): Promise<Models.User> {\n const response = await this.client.request('PUT', \"/cfg/accounts/profile/update/\", { body: data });\n return response;\n }\n\n /**\n * Update user profile\n * \n * Update the current authenticated user's profile information.\n */\n async accountsProfileUpdatePartialUpdate(data?: Models.PatchedUserProfileUpdateRequest): Promise<Models.User> {\n const response = await this.client.request('PATCH', \"/cfg/accounts/profile/update/\", { body: data });\n return response;\n }\n\n}","import * as Models from \"./models\";\n\n\n/**\n * API endpoints for Accounts.\n */\nexport class Accounts {\n private client: any;\n\n constructor(client: any) {\n this.client = client;\n }\n\n /**\n * Request OTP code to email or phone.\n */\n async otpRequestCreate(data: Models.OTPRequestRequest): Promise<Models.OTPRequestResponse> {\n const response = await this.client.request('POST', \"/cfg/accounts/otp/request/\", { body: data });\n return response;\n }\n\n /**\n * Verify OTP code and return JWT tokens.\n */\n async otpVerifyCreate(data: Models.OTPVerifyRequest): Promise<Models.OTPVerifyResponse> {\n const response = await this.client.request('POST', \"/cfg/accounts/otp/verify/\", { body: data });\n return response;\n }\n\n}","// Auto-generated by DjangoCFG - see CLAUDE.md\n/**\n * HTTP Client Adapter Pattern\n *\n * Allows switching between fetch/axios/httpx without changing generated code.\n * Provides unified interface for making HTTP requests.\n */\n\nexport interface HttpRequest {\n method: string;\n url: string;\n headers?: Record<string, string>;\n body?: any;\n params?: Record<string, any>;\n /** FormData for file uploads (multipart/form-data) */\n formData?: FormData;\n}\n\nexport interface HttpResponse<T = any> {\n data: T;\n status: number;\n statusText: string;\n headers: Record<string, string>;\n}\n\n/**\n * HTTP Client Adapter Interface.\n * Implement this to use custom HTTP clients (axios, httpx, etc.)\n */\nexport interface HttpClientAdapter {\n request<T = any>(request: HttpRequest): Promise<HttpResponse<T>>;\n}\n\n/**\n * Default Fetch API adapter.\n * Uses native browser fetch() with proper error handling.\n */\nexport class FetchAdapter implements HttpClientAdapter {\n async request<T = any>(request: HttpRequest): Promise<HttpResponse<T>> {\n const { method, url, headers, body, params, formData } = request;\n\n // Build URL with query params\n let finalUrl = url;\n if (params) {\n const searchParams = new URLSearchParams();\n Object.entries(params).forEach(([key, value]) => {\n if (value !== null && value !== undefined) {\n searchParams.append(key, String(value));\n }\n });\n const queryString = searchParams.toString();\n if (queryString) {\n finalUrl = url.includes('?') ? `${url}&${queryString}` : `${url}?${queryString}`;\n }\n }\n\n // Build headers\n const finalHeaders: Record<string, string> = { ...headers };\n\n // Determine body and content-type\n let requestBody: string | FormData | undefined;\n\n if (formData) {\n // For multipart/form-data, let browser set Content-Type with boundary\n requestBody = formData;\n // Don't set Content-Type - browser will set it with boundary\n } else if (body) {\n // JSON request\n finalHeaders['Content-Type'] = 'application/json';\n requestBody = JSON.stringify(body);\n }\n\n // Make request\n const response = await fetch(finalUrl, {\n method,\n headers: finalHeaders,\n body: requestBody,\n credentials: 'include', // Include Django session cookies\n });\n\n // Parse response\n let data: any = null;\n const contentType = response.headers.get('content-type');\n\n if (response.status !== 204 && contentType?.includes('application/json')) {\n data = await response.json();\n } else if (response.status !== 204) {\n data = await response.text();\n }\n\n // Convert Headers to plain object\n const responseHeaders: Record<string, string> = {};\n response.headers.forEach((value, key) => {\n responseHeaders[key] = value;\n });\n\n return {\n data,\n status: response.status,\n statusText: response.statusText,\n headers: responseHeaders,\n };\n }\n}","// Auto-generated by DjangoCFG - see CLAUDE.md\n/**\n * API Error Classes\n *\n * Typed error classes with Django REST Framework support.\n */\n\n/**\n * HTTP API Error with DRF field-specific validation errors.\n *\n * Usage:\n * ```typescript\n * try {\n * await api.users.create(userData);\n * } catch (error) {\n * if (error instanceof APIError) {\n * if (error.isValidationError) {\n * console.log('Field errors:', error.fieldErrors);\n * // { \"email\": [\"Email already exists\"], \"username\": [\"Required\"] }\n * }\n * }\n * }\n * ```\n */\nexport class APIError extends Error {\n constructor(\n public statusCode: number,\n public statusText: string,\n public response: any,\n public url: string,\n message?: string\n ) {\n super(message || `HTTP ${statusCode}: ${statusText}`);\n this.name = 'APIError';\n }\n\n /**\n * Get error details from response.\n * DRF typically returns: { \"detail\": \"Error message\" } or { \"field\": [\"error1\", \"error2\"] }\n */\n get details(): Record<string, any> | null {\n if (typeof this.response === 'object' && this.response !== null) {\n return this.response;\n }\n return null;\n }\n\n /**\n * Get field-specific validation errors from DRF.\n * Returns: { \"field_name\": [\"error1\", \"error2\"], ... }\n */\n get fieldErrors(): Record<string, string[]> | null {\n const details = this.details;\n if (!details) return null;\n\n // DRF typically returns: { \"field\": [\"error1\", \"error2\"] }\n const fieldErrors: Record<string, string[]> = {};\n for (const [key, value] of Object.entries(details)) {\n if (Array.isArray(value)) {\n fieldErrors[key] = value;\n }\n }\n\n return Object.keys(fieldErrors).length > 0 ? fieldErrors : null;\n }\n\n /**\n * Get single error message from DRF.\n * Checks for \"detail\", \"message\", or first field error.\n */\n get errorMessage(): string {\n const details = this.details;\n if (!details) return this.message;\n\n // Check for \"detail\" field (common in DRF)\n if (details.detail) {\n return Array.isArray(details.detail) ? details.detail.join(', ') : String(details.detail);\n }\n\n // Check for \"message\" field\n if (details.message) {\n return String(details.message);\n }\n\n // Return first field error\n const fieldErrors = this.fieldErrors;\n if (fieldErrors) {\n const firstField = Object.keys(fieldErrors)[0];\n if (firstField) {\n return `${firstField}: ${fieldErrors[firstField]?.join(', ')}`;\n }\n }\n\n return this.message;\n }\n\n // Helper methods for common HTTP status codes\n get isValidationError(): boolean { return this.statusCode === 400; }\n get isAuthError(): boolean { return this.statusCode === 401; }\n get isPermissionError(): boolean { return this.statusCode === 403; }\n get isNotFoundError(): boolean { return this.statusCode === 404; }\n get isServerError(): boolean { return this.statusCode >= 500 && this.statusCode < 600; }\n}\n\n/**\n * Network Error (connection failed, timeout, etc.)\n */\nexport class NetworkError extends Error {\n constructor(\n message: string,\n public url: string,\n public originalError?: Error\n ) {\n super(message);\n this.name = 'NetworkError';\n }\n}","// Auto-generated by DjangoCFG - see CLAUDE.md\n/**\n * API Logger with Consola\n * Beautiful console logging for API requests and responses\n *\n * Installation:\n * npm install consola\n */\n\nimport { type ConsolaInstance, createConsola } from 'consola';\n\n/**\n * Request log data\n */\nexport interface RequestLog {\n method: string;\n url: string;\n headers?: Record<string, string>;\n body?: any;\n timestamp: number;\n}\n\n/**\n * Response log data\n */\nexport interface ResponseLog {\n status: number;\n statusText: string;\n data?: any;\n duration: number;\n timestamp: number;\n}\n\n/**\n * Error log data\n */\nexport interface ErrorLog {\n message: string;\n statusCode?: number;\n fieldErrors?: Record<string, string[]>;\n duration: number;\n timestamp: number;\n}\n\n/**\n * Logger configuration\n */\nexport interface LoggerConfig {\n /** Enable logging */\n enabled: boolean;\n /** Log requests */\n logRequests: boolean;\n /** Log responses */\n logResponses: boolean;\n /** Log errors */\n logErrors: boolean;\n /** Log request/response bodies */\n logBodies: boolean;\n /** Log headers (excluding sensitive ones) */\n logHeaders: boolean;\n /** Custom consola instance */\n consola?: ConsolaInstance;\n}\n\n/**\n * Default logger configuration\n */\nconst DEFAULT_CONFIG: LoggerConfig = {\n enabled: process.env.NODE_ENV !== 'production',\n logRequests: true,\n logResponses: true,\n logErrors: true,\n logBodies: true,\n logHeaders: false,\n};\n\n/**\n * Sensitive header names to filter out\n */\nconst SENSITIVE_HEADERS = [\n 'authorization',\n 'cookie',\n 'set-cookie',\n 'x-api-key',\n 'x-csrf-token',\n];\n\n/**\n * API Logger class\n */\nexport class APILogger {\n private config: LoggerConfig;\n private consola: ConsolaInstance;\n\n constructor(config: Partial<LoggerConfig> = {}) {\n this.config = { ...DEFAULT_CONFIG, ...config };\n this.consola = config.consola || createConsola({\n level: this.config.enabled ? 4 : 0,\n });\n }\n\n /**\n * Enable logging\n */\n enable(): void {\n this.config.enabled = true;\n }\n\n /**\n * Disable logging\n */\n disable(): void {\n this.config.enabled = false;\n }\n\n /**\n * Update configuration\n */\n setConfig(config: Partial<LoggerConfig>): void {\n this.config = { ...this.config, ...config };\n }\n\n /**\n * Filter sensitive headers\n */\n private filterHeaders(headers?: Record<string, string>): Record<string, string> {\n if (!headers) return {};\n\n const filtered: Record<string, string> = {};\n Object.keys(headers).forEach((key) => {\n const lowerKey = key.toLowerCase();\n if (SENSITIVE_HEADERS.includes(lowerKey)) {\n filtered[key] = '***';\n } else {\n filtered[key] = headers[key] || '';\n }\n });\n\n return filtered;\n }\n\n /**\n * Log request\n */\n logRequest(request: RequestLog): void {\n if (!this.config.enabled || !this.config.logRequests) return;\n\n const { method, url, headers, body } = request;\n\n this.consola.start(`${method} ${url}`);\n\n if (this.config.logHeaders && headers) {\n this.consola.debug('Headers:', this.filterHeaders(headers));\n }\n\n if (this.config.logBodies && body) {\n this.consola.debug('Body:', body);\n }\n }\n\n /**\n * Log response\n */\n logResponse(request: RequestLog, response: ResponseLog): void {\n if (!this.config.enabled || !this.config.logResponses) return;\n\n const { method, url } = request;\n const { status, statusText, data, duration } = response;\n\n const statusColor = status >= 500 ? 'red'\n : status >= 400 ? 'yellow'\n : status >= 300 ? 'cyan'\n : 'green';\n\n this.consola.success(\n `${method} ${url} ${status} ${statusText} (${duration}ms)`\n );\n\n if (this.config.logBodies && data) {\n this.consola.debug('Response:', data);\n }\n }\n\n /**\n * Log error\n */\n logError(request: RequestLog, error: ErrorLog): void {\n if (!this.config.enabled || !this.config.logErrors) return;\n\n const { method, url } = request;\n const { message, statusCode, fieldErrors, duration } = error;\n\n this.consola.error(\n `${method} ${url} ${statusCode || 'Network'} Error (${duration}ms)`\n );\n\n this.consola.error('Message:', message);\n\n if (fieldErrors && Object.keys(fieldErrors).length > 0) {\n this.consola.error('Field Errors:');\n Object.entries(fieldErrors).forEach(([field, errors]) => {\n errors.forEach((err) => {\n this.consola.error(` • ${field}: ${err}`);\n });\n });\n }\n }\n\n /**\n * Log general info\n */\n info(message: string, ...args: any[]): void {\n if (!this.config.enabled) return;\n this.consola.info(message, ...args);\n }\n\n /**\n * Log warning\n */\n warn(message: string, ...args: any[]): void {\n if (!this.config.enabled) return;\n this.consola.warn(message, ...args);\n }\n\n /**\n * Log error\n */\n error(message: string, ...args: any[]): void {\n if (!this.config.enabled) return;\n this.consola.error(message, ...args);\n }\n\n /**\n * Log debug\n */\n debug(message: string, ...args: any[]): void {\n if (!this.config.enabled) return;\n this.consola.debug(message, ...args);\n }\n\n /**\n * Log success\n */\n success(message: string, ...args: any[]): void {\n if (!this.config.enabled) return;\n this.consola.success(message, ...args);\n }\n\n /**\n * Create a sub-logger with prefix\n */\n withTag(tag: string): ConsolaInstance {\n return this.consola.withTag(tag);\n }\n}\n\n/**\n * Default logger instance\n */\nexport const defaultLogger = new APILogger();","// Auto-generated by DjangoCFG - see CLAUDE.md\n/**\n * Retry Configuration and Utilities\n *\n * Provides automatic retry logic for failed HTTP requests using p-retry.\n * Retries only on network errors and server errors (5xx), not client errors (4xx).\n */\n\nimport pRetry, { AbortError } from 'p-retry';\nimport { APIError, NetworkError } from './errors';\n\n/**\n * Information about a failed retry attempt.\n */\nexport interface FailedAttemptInfo {\n /** The error that caused the failure */\n error: Error;\n /** The attempt number (1-indexed) */\n attemptNumber: number;\n /** Number of retries left */\n retriesLeft: number;\n}\n\n/**\n * Retry configuration options.\n *\n * Uses exponential backoff with jitter by default to avoid thundering herd.\n */\nexport interface RetryConfig {\n /**\n * Maximum number of retry attempts.\n * @default 3\n */\n retries?: number;\n\n /**\n * Exponential backoff factor.\n * @default 2\n */\n factor?: number;\n\n /**\n * Minimum wait time between retries (ms).\n * @default 1000\n */\n minTimeout?: number;\n\n /**\n * Maximum wait time between retries (ms).\n * @default 60000\n */\n maxTimeout?: number;\n\n /**\n * Add randomness to wait times (jitter).\n * Helps avoid thundering herd problem.\n * @default true\n */\n randomize?: boolean;\n\n /**\n * Callback called on each failed attempt.\n */\n onFailedAttempt?: (info: FailedAttemptInfo) => void;\n}\n\n/**\n * Default retry configuration.\n */\nexport const DEFAULT_RETRY_CONFIG: Required<RetryConfig> = {\n retries: 3,\n factor: 2,\n minTimeout: 1000,\n maxTimeout: 60000,\n randomize: true,\n onFailedAttempt: () => {},\n};\n\n/**\n * Determine if an error should trigger a retry.\n *\n * Retries on:\n * - Network errors (connection refused, timeout, etc.)\n * - Server errors (5xx status codes)\n * - Rate limiting (429 status code)\n *\n * Does NOT retry on:\n * - Client errors (4xx except 429)\n * - Authentication errors (401, 403)\n * - Not found (404)\n *\n * @param error - The error to check\n * @returns true if should retry, false otherwise\n */\nexport function shouldRetry(error: any): boolean {\n // Always retry network errors\n if (error instanceof NetworkError) {\n return true;\n }\n\n // For API errors, check status code\n if (error instanceof APIError) {\n const status = error.statusCode;\n\n // Retry on 5xx server errors\n if (status >= 500 && status < 600) {\n return true;\n }\n\n // Retry on 429 (rate limit)\n if (status === 429) {\n return true;\n }\n\n // Do NOT retry on 4xx client errors\n return false;\n }\n\n // Retry on unknown errors (might be network issues)\n return true;\n}\n\n/**\n * Wrap a function with retry logic.\n *\n * @param fn - Async function to retry\n * @param config - Retry configuration\n * @returns Result of the function\n *\n * @example\n * ```typescript\n * const result = await withRetry(\n * async () => fetch('https://api.example.com/users'),\n * { retries: 5, minTimeout: 2000 }\n * );\n * ```\n */\nexport async function withRetry<T>(\n fn: () => Promise<T>,\n config?: RetryConfig\n): Promise<T> {\n const finalConfig = { ...DEFAULT_RETRY_CONFIG, ...config };\n\n return pRetry(\n async () => {\n try {\n return await fn();\n } catch (error) {\n // Check if we should retry this error\n if (!shouldRetry(error)) {\n // Abort retry immediately for non-retryable errors\n throw new AbortError(error as Error);\n }\n\n // Re-throw error to trigger retry\n throw error;\n }\n },\n {\n retries: finalConfig.retries,\n factor: finalConfig.factor,\n minTimeout: finalConfig.minTimeout,\n maxTimeout: finalConfig.maxTimeout,\n randomize: finalConfig.randomize,\n onFailedAttempt: finalConfig.onFailedAttempt ? (error) => {\n // Adapt p-retry's FailedAttemptError to our FailedAttemptInfo\n const pRetryError = error as any; // p-retry's internal type\n finalConfig.onFailedAttempt!({\n error: pRetryError as Error,\n attemptNumber: pRetryError.attemptNumber,\n retriesLeft: pRetryError.retriesLeft,\n });\n } : undefined,\n }\n );\n}","import { Auth } from \"./accounts__auth\";\nimport { Oauth } from \"./accounts__oauth\";\nimport { UserProfile } from \"./accounts__user_profile\";\nimport { Accounts } from \"./accounts\";\nimport { HttpClientAdapter, FetchAdapter } from \"./http\";\nimport { APIError, NetworkError } from \"./errors\";\nimport { APILogger, type LoggerConfig } from \"./logger\";\nimport { withRetry, type RetryConfig } from \"./retry\";\n\n\n/**\n * Async API client for Django CFG API.\n *\n * Usage:\n * ```typescript\n * const client = new APIClient('https://api.example.com');\n * const users = await client.users.list();\n * const post = await client.posts.create(newPost);\n *\n * // Custom HTTP adapter (e.g., Axios)\n * const client = new APIClient('https://api.example.com', {\n * httpClient: new AxiosAdapter()\n * });\n * ```\n */\nexport class APIClient {\n private baseUrl: string;\n private httpClient: HttpClientAdapter;\n private logger: APILogger | null = null;\n private retryConfig: RetryConfig | null = null;\n\n // Sub-clients\n public auth: Auth;\n public oauth: Oauth;\n public user_profile: UserProfile;\n public accounts: Accounts;\n\n constructor(\n baseUrl: string,\n options?: {\n httpClient?: HttpClientAdapter;\n loggerConfig?: Partial<LoggerConfig>;\n retryConfig?: RetryConfig;\n }\n ) {\n this.baseUrl = baseUrl.replace(/\\/$/, '');\n this.httpClient = options?.httpClient || new FetchAdapter();\n\n // Initialize logger if config provided\n if (options?.loggerConfig !== undefined) {\n this.logger = new APILogger(options.loggerConfig);\n }\n\n // Store retry configuration\n if (options?.retryConfig !== undefined) {\n this.retryConfig = options.retryConfig;\n }\n\n // Initialize sub-clients\n this.auth = new Auth(this);\n this.oauth = new Oauth(this);\n this.user_profile = new UserProfile(this);\n this.accounts = new Accounts(this);\n }\n\n /**\n * Get CSRF token from cookies (for SessionAuthentication).\n *\n * Returns null if cookie doesn't exist (JWT-only auth).\n */\n getCsrfToken(): string | null {\n const name = 'csrftoken';\n const value = `; ${document.cookie}`;\n const parts = value.split(`; ${name}=`);\n if (parts.length === 2) {\n return parts.pop()?.split(';').shift() || null;\n }\n return null;\n }\n\n /**\n * Make HTTP request with Django CSRF and session handling.\n * Automatically retries on network errors and 5xx server errors.\n */\n async request<T>(\n method: string,\n path: string,\n options?: {\n params?: Record<string, any>;\n body?: any;\n formData?: FormData;\n headers?: Record<string, string>;\n }\n ): Promise<T> {\n // Wrap request in retry logic if configured\n if (this.retryConfig) {\n return withRetry(() => this._makeRequest<T>(method, path, options), {\n ...this.retryConfig,\n onFailedAttempt: (info) => {\n // Log retry attempts\n if (this.logger) {\n this.logger.warn(\n `Retry attempt ${info.attemptNumber}/${info.retriesLeft + info.attemptNumber} ` +\n `for ${method} ${path}: ${info.error.message}`\n );\n }\n // Call user's onFailedAttempt if provided\n this.retryConfig?.onFailedAttempt?.(info);\n },\n });\n }\n\n // No retry configured, make request directly\n return this._makeRequest<T>(method, path, options);\n }\n\n /**\n * Internal request method (without retry wrapper).\n * Used by request() method with optional retry logic.\n */\n private async _makeRequest<T>(\n method: string,\n path: string,\n options?: {\n params?: Record<string, any>;\n body?: any;\n formData?: FormData;\n headers?: Record<string, string>;\n }\n ): Promise<T> {\n // Build URL - handle both absolute and relative paths\n // When baseUrl is empty (static builds), path is used as-is (relative to current origin)\n const url = this.baseUrl ? `${this.baseUrl}${path}` : path;\n const startTime = Date.now();\n\n // Build headers - start with custom headers from options\n const headers: Record<string, string> = {\n ...(options?.headers || {})\n };\n\n // Don't set Content-Type for FormData (browser will set it with boundary)\n if (!options?.formData && !headers['Content-Type']) {\n headers['Content-Type'] = 'application/json';\n }\n\n // CSRF not needed - SessionAuthentication not enabled in DRF config\n // Your API uses JWT/Token authentication (no CSRF required)\n\n // Log request\n if (this.logger) {\n this.logger.logRequest({\n method,\n url: url,\n headers,\n body: options?.formData || options?.body,\n timestamp: startTime,\n });\n }\n\n try {\n // Make request via HTTP adapter\n const response = await this.httpClient.request<T>({\n method,\n url: url,\n headers,\n params: options?.params,\n body: options?.body,\n formData: options?.formData,\n });\n\n const duration = Date.now() - startTime;\n\n // Check for HTTP errors\n if (response.status >= 400) {\n const error = new APIError(\n response.status,\n response.statusText,\n response.data,\n url\n );\n\n // Log error\n if (this.logger) {\n this.logger.logError(\n {\n method,\n url: url,\n headers,\n body: options?.formData || options?.body,\n timestamp: startTime,\n },\n {\n message: error.message,\n statusCode: response.status,\n duration,\n timestamp: Date.now(),\n }\n );\n }\n\n throw error;\n }\n\n // Log successful response\n if (this.logger) {\n this.logger.logResponse(\n {\n method,\n url: url,\n headers,\n body: options?.formData || options?.body,\n timestamp: startTime,\n },\n {\n status: response.status,\n statusText: response.statusText,\n data: response.data,\n duration,\n timestamp: Date.now(),\n }\n );\n }\n\n return response.data as T;\n } catch (error) {\n const duration = Date.now() - startTime;\n\n // Re-throw APIError as-is\n if (error instanceof APIError) {\n throw error;\n }\n\n // Detect CORS errors and dispatch event\n const isCORSError = error instanceof TypeError &&\n (error.message.toLowerCase().includes('cors') ||\n error.message.toLowerCase().includes('failed to fetch') ||\n error.message.toLowerCase().includes('network request failed'));\n\n // Log specific error type first\n if (this.logger) {\n if (isCORSError) {\n this.logger.error(`🚫 CORS Error: ${method} ${url}`);\n this.logger.error(` → ${error instanceof Error ? error.message : String(error)}`);\n this.logger.error(` → Configure security_domains parameter on the server`);\n } else {\n this.logger.error(`⚠️ Network Error: ${method} ${url}`);\n this.logger.error(` → ${error instanceof Error ? error.message : String(error)}`);\n }\n }\n\n // Dispatch browser events\n if (typeof window !== 'undefined') {\n try {\n if (isCORSError) {\n // Dispatch CORS-specific error event\n window.dispatchEvent(new CustomEvent('cors-error', {\n detail: {\n url: url,\n method: method,\n error: error instanceof Error ? error.message : String(error),\n timestamp: new Date(),\n },\n bubbles: true,\n cancelable: false,\n }));\n } else {\n // Dispatch generic network error event\n window.dispatchEvent(new CustomEvent('network-error', {\n detail: {\n url: url,\n method: method,\n error: error instanceof Error ? error.message : String(error),\n timestamp: new Date(),\n },\n bubbles: true,\n cancelable: false,\n }));\n }\n } catch (eventError) {\n // Silently fail - event dispatch should never crash the app\n }\n }\n\n // Wrap other errors as NetworkError\n const networkError = error instanceof Error\n ? new NetworkError(error.message, url, error)\n : new NetworkError('Unknown error', url);\n\n // Detailed logging via logger.logError\n if (this.logger) {\n this.logger.logError(\n {\n method,\n url: url,\n headers,\n body: options?.formData || options?.body,\n timestamp: startTime,\n },\n {\n message: networkError.message,\n duration,\n timestamp: Date.now(),\n }\n );\n }\n\n throw networkError;\n }\n }\n}\n","// Auto-generated by DjangoCFG - see CLAUDE.md\n/**\n * Storage adapters for cross-platform token storage.\n *\n * Supports:\n * - LocalStorage (browser)\n * - Cookies (SSR/browser)\n * - Memory (Node.js/Electron/testing)\n */\n\nimport type { APILogger } from './logger';\n\n/**\n * Storage adapter interface for cross-platform token storage.\n */\nexport interface StorageAdapter {\n getItem(key: string): string | null;\n setItem(key: string, value: string): void;\n removeItem(key: string): void;\n}\n\n/**\n * LocalStorage adapter with safe try-catch for browser environments.\n * Works in modern browsers with localStorage support.\n * \n * Note: This adapter uses window.localStorage and should only be used in browser/client environments.\n * For server-side usage, use MemoryStorageAdapter or CookieStorageAdapter instead.\n */\nexport class LocalStorageAdapter implements StorageAdapter {\n private logger?: APILogger;\n\n constructor(logger?: APILogger) {\n this.logger = logger;\n }\n\n getItem(key: string): string | null {\n try {\n if (typeof window !== 'undefined' && window.localStorage) {\n const value = localStorage.getItem(key);\n this.logger?.debug(`LocalStorage.getItem(\"${key}\"): ${value ? 'found' : 'not found'}`);\n return value;\n }\n this.logger?.warn('LocalStorage not available: window.localStorage is undefined');\n } catch (error) {\n this.logger?.error('LocalStorage.getItem failed:', error);\n }\n return null;\n }\n\n setItem(key: string, value: string): void {\n try {\n if (typeof window !== 'undefined' && window.localStorage) {\n localStorage.setItem(key, value);\n this.logger?.debug(`LocalStorage.setItem(\"${key}\"): success`);\n } else {\n this.logger?.warn('LocalStorage not available: window.localStorage is undefined');\n }\n } catch (error) {\n this.logger?.error('LocalStorage.setItem failed:', error);\n }\n }\n\n removeItem(key: string): void {\n try {\n if (typeof window !== 'undefined' && window.localStorage) {\n localStorage.removeItem(key);\n this.logger?.debug(`LocalStorage.removeItem(\"${key}\"): success`);\n } else {\n this.logger?.warn('LocalStorage not available: window.localStorage is undefined');\n }\n } catch (error) {\n this.logger?.error('LocalStorage.removeItem failed:', error);\n }\n }\n}\n\n/**\n * Cookie-based storage adapter for SSR and browser environments.\n * Useful for Next.js, Nuxt.js, and other SSR frameworks.\n */\nexport class CookieStorageAdapter implements StorageAdapter {\n private logger?: APILogger;\n\n constructor(logger?: APILogger) {\n this.logger = logger;\n }\n\n getItem(key: string): string | null {\n try {\n if (typeof document === 'undefined') {\n this.logger?.warn('Cookies not available: document is undefined (SSR context?)');\n return null;\n }\n const value = `; ${document.cookie}`;\n const parts = value.split(`; ${key}=`);\n if (parts.length === 2) {\n const result = parts.pop()?.split(';').shift() || null;\n this.logger?.debug(`CookieStorage.getItem(\"${key}\"): ${result ? 'found' : 'not found'}`);\n return result;\n }\n this.logger?.debug(`CookieStorage.getItem(\"${key}\"): not found`);\n } catch (error) {\n this.logger?.error('CookieStorage.getItem failed:', error);\n }\n return null;\n }\n\n setItem(key: string, value: string): void {\n try {\n if (typeof document !== 'undefined') {\n document.cookie = `${key}=${value}; path=/; max-age=31536000`;\n this.logger?.debug(`CookieStorage.setItem(\"${key}\"): success`);\n } else {\n this.logger?.warn('Cookies not available: document is undefined (SSR context?)');\n }\n } catch (error) {\n this.logger?.error('CookieStorage.setItem failed:', error);\n }\n }\n\n removeItem(key: string): void {\n try {\n if (typeof document !== 'undefined') {\n document.cookie = `${key}=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT`;\n this.logger?.debug(`CookieStorage.removeItem(\"${key}\"): success`);\n } else {\n this.logger?.warn('Cookies not available: document is undefined (SSR context?)');\n }\n } catch (error) {\n this.logger?.error('CookieStorage.removeItem failed:', error);\n }\n }\n}\n\n/**\n * In-memory storage adapter for Node.js, Electron, and testing environments.\n * Data is stored in RAM and cleared when process exits.\n */\nexport class MemoryStorageAdapter implements StorageAdapter {\n private storage: Map<string, string> = new Map();\n private logger?: APILogger;\n\n constructor(logger?: APILogger) {\n this.logger = logger;\n }\n\n getItem(key: string): string | null {\n const value = this.storage.get(key) || null;\n this.logger?.debug(`MemoryStorage.getItem(\"${key}\"): ${value ? 'found' : 'not found'}`);\n return value;\n }\n\n setItem(key: string, value: string): void {\n this.storage.set(key, value);\n this.logger?.debug(`MemoryStorage.setItem(\"${key}\"): success`);\n }\n\n removeItem(key: string): void {\n this.storage.delete(key);\n this.logger?.debug(`MemoryStorage.removeItem(\"${key}\"): success`);\n }\n}","// Auto-generated by DjangoCFG - see CLAUDE.md\n/**\n * OAuth provider name (github, google, etc.)\n * * `github` - GitHub\n */\nexport enum OAuthConnectionProvider {\n GITHUB = \"github\",\n}\n\n/**\n * OAuth provider to disconnect\n * * `github` - GitHub\n */\nexport enum OAuthDisconnectRequestRequestProvider {\n GITHUB = \"github\",\n}\n\n/**\n * Delivery channel: 'email' or 'phone'. Auto-detected if not provided.\n * * `email` - Email\n * * `phone` - Phone\n */\nexport enum OTPRequestRequestChannel {\n EMAIL = \"email\",\n PHONE = \"phone\",\n}\n\n/**\n * Delivery channel: 'email' or 'phone'. Auto-detected if not provided.\n * * `email` - Email\n * * `phone` - Phone\n */\nexport enum OTPVerifyRequestChannel {\n EMAIL = \"email\",\n PHONE = \"phone\",\n}\n\n","/**\n * Zod schema for CentrifugoToken\n *\n * This schema provides runtime validation and type inference.\n * * Nested serializer for Centrifugo WebSocket connection token.\n * */\nimport { z } from 'zod'\n\n/**\n * Nested serializer for Centrifugo WebSocket connection token.\n */\nexport const CentrifugoTokenSchema = z.object({\n token: z.string(),\n centrifugo_url: z.url(),\n expires_at: z.iso.datetime(),\n channels: z.array(z.string()),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type CentrifugoToken = z.infer<typeof CentrifugoTokenSchema>","/**\n * Zod schema for OAuthAuthorizeRequestRequest\n *\n * This schema provides runtime validation and type inference.\n * * Request to start OAuth flow.\n * */\nimport { z } from 'zod'\n\n/**\n * Request to start OAuth flow.\n */\nexport const OAuthAuthorizeRequestRequestSchema = z.object({\n redirect_uri: z.url().optional(),\n source_url: z.url().optional(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type OAuthAuthorizeRequestRequest = z.infer<typeof OAuthAuthorizeRequestRequestSchema>","/**\n * Zod schema for OAuthAuthorizeResponse\n *\n * This schema provides runtime validation and type inference.\n * * Response with OAuth authorization URL.\n * */\nimport { z } from 'zod'\n\n/**\n * Response with OAuth authorization URL.\n */\nexport const OAuthAuthorizeResponseSchema = z.object({\n authorization_url: z.url(),\n state: z.string(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type OAuthAuthorizeResponse = z.infer<typeof OAuthAuthorizeResponseSchema>","/**\n * Zod schema for OAuthCallbackRequestRequest\n *\n * This schema provides runtime validation and type inference.\n * * Request to complete OAuth flow (callback handler).\n * */\nimport { z } from 'zod'\n\n/**\n * Request to complete OAuth flow (callback handler).\n */\nexport const OAuthCallbackRequestRequestSchema = z.object({\n code: z.string().min(10).max(500),\n state: z.string().min(20).max(100),\n redirect_uri: z.url().optional(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type OAuthCallbackRequestRequest = z.infer<typeof OAuthCallbackRequestRequestSchema>","/**\n * Zod schema for OAuthConnection\n *\n * This schema provides runtime validation and type inference.\n * * Serializer for OAuth connection info (user-facing).\n * */\nimport { z } from 'zod'\nimport * as Enums from '../../enums'\n\n/**\n * Serializer for OAuth connection info (user-facing).\n */\nexport const OAuthConnectionSchema = z.object({\n id: z.int(),\n provider: z.nativeEnum(Enums.OAuthConnectionProvider),\n provider_display: z.string(),\n provider_username: z.string(),\n provider_email: z.email(),\n provider_avatar_url: z.url(),\n connected_at: z.iso.datetime(),\n last_login_at: z.iso.datetime(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type OAuthConnection = z.infer<typeof OAuthConnectionSchema>","/**\n * Zod schema for OAuthDisconnectRequestRequest\n *\n * This schema provides runtime validation and type inference.\n * * Request to disconnect OAuth provider.\n * */\nimport { z } from 'zod'\nimport * as Enums from '../../enums'\n\n/**\n * Request to disconnect OAuth provider.\n */\nexport const OAuthDisconnectRequestRequestSchema = z.object({\n provider: z.nativeEnum(Enums.OAuthDisconnectRequestRequestProvider),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type OAuthDisconnectRequestRequest = z.infer<typeof OAuthDisconnectRequestRequestSchema>","/**\n * Zod schema for OAuthError\n *\n * This schema provides runtime validation and type inference.\n * * Error response for OAuth endpoints.\n * */\nimport { z } from 'zod'\n\n/**\n * Error response for OAuth endpoints.\n */\nexport const OAuthErrorSchema = z.object({\n error: z.string(),\n error_description: z.string().optional(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type OAuthError = z.infer<typeof OAuthErrorSchema>","/**\n * Zod schema for OAuthProvidersResponse\n *\n * This schema provides runtime validation and type inference.\n * * Response with available OAuth providers.\n * */\nimport { z } from 'zod'\n\n/**\n * Response with available OAuth providers.\n */\nexport const OAuthProvidersResponseSchema = z.object({\n providers: z.array(z.record(z.string(), z.record(z.string(), z.any()))),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type OAuthProvidersResponse = z.infer<typeof OAuthProvidersResponseSchema>","/**\n * Zod schema for OAuthTokenResponse\n *\n * This schema provides runtime validation and type inference.\n * * Response with JWT tokens after OAuth authentication.\n * */\nimport { z } from 'zod'\n\n/**\n * Response with JWT tokens after OAuth authentication.\n */\nexport const OAuthTokenResponseSchema = z.object({\n access: z.string(),\n refresh: z.string(),\n user: z.record(z.string(), z.record(z.string(), z.any())),\n is_new_user: z.boolean(),\n is_new_connection: z.boolean(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type OAuthTokenResponse = z.infer<typeof OAuthTokenResponseSchema>","/**\n * Zod schema for OTPErrorResponse\n *\n * This schema provides runtime validation and type inference.\n * * Error response for OTP operations.\n * */\nimport { z } from 'zod'\n\n/**\n * Error response for OTP operations.\n */\nexport const OTPErrorResponseSchema = z.object({\n error: z.string(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type OTPErrorResponse = z.infer<typeof OTPErrorResponseSchema>","/**\n * Zod schema for OTPRequestRequest\n *\n * This schema provides runtime validation and type inference.\n * * Serializer for OTP request.\n * */\nimport { z } from 'zod'\nimport * as Enums from '../../enums'\n\n/**\n * Serializer for OTP request.\n */\nexport const OTPRequestRequestSchema = z.object({\n identifier: z.string().min(1),\n channel: z.nativeEnum(Enums.OTPRequestRequestChannel).optional(),\n source_url: z.url().optional(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type OTPRequestRequest = z.infer<typeof OTPRequestRequestSchema>","/**\n * Zod schema for OTPRequestResponse\n *\n * This schema provides runtime validation and type inference.\n * * OTP request response.\n * */\nimport { z } from 'zod'\n\n/**\n * OTP request response.\n */\nexport const OTPRequestResponseSchema = z.object({\n message: z.string(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type OTPRequestResponse = z.infer<typeof OTPRequestResponseSchema>","/**\n * Zod schema for OTPVerifyRequest\n *\n * This schema provides runtime validation and type inference.\n * * Serializer for OTP verification.\n * */\nimport { z } from 'zod'\nimport * as Enums from '../../enums'\n\n/**\n * Serializer for OTP verification.\n */\nexport const OTPVerifyRequestSchema = z.object({\n identifier: z.string().min(1),\n otp: z.string().min(6).max(6),\n channel: z.nativeEnum(Enums.OTPVerifyRequestChannel).optional(),\n source_url: z.url().optional(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type OTPVerifyRequest = z.infer<typeof OTPVerifyRequestSchema>","/**\n * Zod schema for OTPVerifyResponse\n *\n * This schema provides runtime validation and type inference.\n * * OTP verification response.\n * */\nimport { z } from 'zod'\nimport { UserSchema } from './User.schema'\n\n/**\n * OTP verification response.\n */\nexport const OTPVerifyResponseSchema = z.object({\n refresh: z.string(),\n access: z.string(),\n user: UserSchema,\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type OTPVerifyResponse = z.infer<typeof OTPVerifyResponseSchema>","/**\n * Zod schema for User\n *\n * This schema provides runtime validation and type inference.\n * * Serializer for user details.\n * */\nimport { z } from 'zod'\nimport { CentrifugoTokenSchema } from './CentrifugoToken.schema'\n\n/**\n * Serializer for user details.\n */\nexport const UserSchema = z.object({\n id: z.int(),\n email: z.email(),\n first_name: z.string().max(50).optional(),\n last_name: z.string().max(50).optional(),\n full_name: z.string(),\n initials: z.string(),\n display_username: z.string(),\n company: z.string().max(100).optional(),\n phone: z.string().max(20).optional(),\n position: z.string().max(100).optional(),\n avatar: z.url().nullable(),\n is_staff: z.boolean(),\n is_superuser: z.boolean(),\n date_joined: z.iso.datetime(),\n last_login: z.iso.datetime().nullable(),\n unanswered_messages_count: z.int(),\n centrifugo: CentrifugoTokenSchema.nullable(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type User = z.infer<typeof UserSchema>","/**\n * Zod schema for PatchedUserProfileUpdateRequest\n *\n * This schema provides runtime validation and type inference.\n * * Serializer for updating user profile.\n * */\nimport { z } from 'zod'\n\n/**\n * Serializer for updating user profile.\n */\nexport const PatchedUserProfileUpdateRequestSchema = z.object({\n first_name: z.string().max(50).optional(),\n last_name: z.string().max(50).optional(),\n company: z.string().max(100).optional(),\n phone: z.string().max(20).optional(),\n position: z.string().max(100).optional(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type PatchedUserProfileUpdateRequest = z.infer<typeof PatchedUserProfileUpdateRequestSchema>","/**\n * Zod schema for TokenRefresh\n *\n * This schema provides runtime validation and type inference.\n * */\nimport { z } from 'zod'\n\nexport const TokenRefreshSchema = z.object({\n access: z.string(),\n refresh: z.string(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type TokenRefresh = z.infer<typeof TokenRefreshSchema>","/**\n * Zod schema for TokenRefreshRequest\n *\n * This schema provides runtime validation and type inference.\n * */\nimport { z } from 'zod'\n\nexport const TokenRefreshRequestSchema = z.object({\n refresh: z.string().min(1),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type TokenRefreshRequest = z.infer<typeof TokenRefreshRequestSchema>","/**\n * Zod schema for UserProfileUpdateRequest\n *\n * This schema provides runtime validation and type inference.\n * * Serializer for updating user profile.\n * */\nimport { z } from 'zod'\n\n/**\n * Serializer for updating user profile.\n */\nexport const UserProfileUpdateRequestSchema = z.object({\n first_name: z.string().max(50).optional(),\n last_name: z.string().max(50).optional(),\n company: z.string().max(100).optional(),\n phone: z.string().max(20).optional(),\n position: z.string().max(100).optional(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type UserProfileUpdateRequest = z.infer<typeof UserProfileUpdateRequestSchema>","// Auto-generated by DjangoCFG - see CLAUDE.md\n/**\n * Typed fetchers for Accounts\n *\n * Universal functions that work in any environment:\n * - Next.js (App Router / Pages Router / Server Components)\n * - React Native\n * - Node.js backend\n *\n * These fetchers use Zod schemas for runtime validation.\n *\n * Usage:\n * ```typescript\n * // Configure API once (in your app entry point)\n * import { configureAPI } from '../../api-instance'\n * configureAPI({ baseUrl: 'https://api.example.com' })\n *\n * // Then use fetchers anywhere\n * const users = await getUsers({ page: 1 })\n *\n * // With SWR\n * const { data } = useSWR(['users', params], () => getUsers(params))\n *\n * // With React Query\n * const { data } = useQuery(['users', params], () => getUsers(params))\n *\n * // In Server Component or SSR (pass custom client)\n * import { API } from '../../index'\n * const api = new API('https://api.example.com')\n * const users = await getUsers({ page: 1 }, api)\n * ```\n */\nimport { consola } from 'consola'\nimport { OTPRequestRequestSchema, type OTPRequestRequest } from '../schemas/OTPRequestRequest.schema'\nimport { OTPRequestResponseSchema, type OTPRequestResponse } from '../schemas/OTPRequestResponse.schema'\nimport { OTPVerifyRequestSchema, type OTPVerifyRequest } from '../schemas/OTPVerifyRequest.schema'\nimport { OTPVerifyResponseSchema, type OTPVerifyResponse } from '../schemas/OTPVerifyResponse.schema'\nimport { getAPIInstance } from '../../api-instance'\n\n/**\n * API operation\n *\n * @method POST\n * @path /cfg/accounts/otp/request/\n */\nexport async function createAccountsOtpRequestCreate( data: OTPRequestRequest, client?: any\n): Promise<OTPRequestResponse> {\n const api = client || getAPIInstance()\n const response = await api.accounts.otpRequestCreate(data)\n try {\n return OTPRequestResponseSchema.parse(response)\n } catch (error) {\n // Zod validation error - log detailed information\n consola.error('❌ Zod Validation Failed');\n consola.box(`createAccountsOtpRequestCreate\\nPath: /cfg/accounts/otp/request/\\nMethod: POST`);\n\n if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {\n consola.error('Validation Issues:');\n (error as any).issues.forEach((issue: any, index: number) => {\n consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);\n consola.error(` ├─ Message: ${issue.message}`);\n if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);\n if (issue.received) consola.error(` └─ Received: ${issue.received}`);\n });\n }\n\n consola.error('Response data:', response);\n\n // Dispatch browser CustomEvent (only if window is defined)\n if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {\n try {\n const event = new CustomEvent('zod-validation-error', {\n detail: {\n operation: 'createAccountsOtpRequestCreate',\n path: '/cfg/accounts/otp/request/',\n method: 'POST',\n error: error,\n response: response,\n timestamp: new Date(),\n },\n bubbles: true,\n cancelable: false,\n });\n window.dispatchEvent(event);\n } catch (eventError) {\n // Silently fail - event dispatch should never crash the app\n consola.warn('Failed to dispatch validation error event:', eventError);\n }\n }\n\n // Re-throw the error\n throw error;\n }\n}\n\n\n/**\n * API operation\n *\n * @method POST\n * @path /cfg/accounts/otp/verify/\n */\nexport async function createAccountsOtpVerifyCreate( data: OTPVerifyRequest, client?: any\n): Promise<OTPVerifyResponse> {\n const api = client || getAPIInstance()\n const response = await api.accounts.otpVerifyCreate(data)\n try {\n return OTPVerifyResponseSchema.parse(response)\n } catch (error) {\n // Zod validation error - log detailed information\n consola.error('❌ Zod Validation Failed');\n consola.box(`createAccountsOtpVerifyCreate\\nPath: /cfg/accounts/otp/verify/\\nMethod: POST`);\n\n if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {\n consola.error('Validation Issues:');\n (error as any).issues.forEach((issue: any, index: number) => {\n consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);\n consola.error(` ├─ Message: ${issue.message}`);\n if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);\n if (issue.received) consola.error(` └─ Received: ${issue.received}`);\n });\n }\n\n consola.error('Response data:', response);\n\n // Dispatch browser CustomEvent (only if window is defined)\n if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {\n try {\n const event = new CustomEvent('zod-validation-error', {\n detail: {\n operation: 'createAccountsOtpVerifyCreate',\n path: '/cfg/accounts/otp/verify/',\n method: 'POST',\n error: error,\n response: response,\n timestamp: new Date(),\n },\n bubbles: true,\n cancelable: false,\n });\n window.dispatchEvent(event);\n } catch (eventError) {\n // Silently fail - event dispatch should never crash the app\n consola.warn('Failed to dispatch validation error event:', eventError);\n }\n }\n\n // Re-throw the error\n throw error;\n }\n}\n\n\n","// Auto-generated by DjangoCFG - see CLAUDE.md\n/**\n * Global API Instance - Singleton configuration\n *\n * This module provides a global API instance that can be configured once\n * and used throughout your application.\n *\n * Usage:\n * ```typescript\n * // Configure once (e.g., in your app entry point)\n * import { configureAPI } from './api-instance'\n *\n * configureAPI({\n * baseUrl: 'https://api.example.com',\n * token: 'your-jwt-token'\n * })\n *\n * // Then use fetchers and hooks anywhere without configuration\n * import { getUsers } from './fetchers'\n * const users = await getUsers({ page: 1 })\n * ```\n *\n * For SSR or multiple instances:\n * ```typescript\n * import { API } from './index'\n * import { getUsers } from './fetchers'\n *\n * const api = new API('https://api.example.com')\n * const users = await getUsers({ page: 1 }, api)\n * ```\n */\n\nimport { API, type APIOptions } from './index'\n\nlet globalAPI: API | null = null\n\n/**\n * Get the global API instance\n * @throws Error if API is not configured\n */\nexport function getAPIInstance(): API {\n if (!globalAPI) {\n throw new Error(\n 'API not configured. Call configureAPI() with your base URL before using fetchers or hooks.\\n\\n' +\n 'Example:\\n' +\n ' import { configureAPI } from \"./api-instance\"\\n' +\n ' configureAPI({ baseUrl: \"https://api.example.com\" })'\n )\n }\n return globalAPI\n}\n\n/**\n * Check if API is configured\n */\nexport function isAPIConfigured(): boolean {\n return globalAPI !== null\n}\n\n/**\n * Configure the global API instance\n *\n * @param baseUrl - Base URL for the API\n * @param options - Optional configuration (storage, retry, logger)\n *\n * @example\n * ```typescript\n * configureAPI({\n * baseUrl: 'https://api.example.com',\n * token: 'jwt-token',\n * options: {\n * retryConfig: { maxRetries: 3 },\n * loggerConfig: { enabled: true }\n * }\n * })\n * ```\n */\nexport function configureAPI(config: {\n baseUrl: string\n token?: string\n refreshToken?: string\n options?: APIOptions\n}): API {\n globalAPI = new API(config.baseUrl, config.options)\n\n if (config.token) {\n globalAPI.setToken(config.token, config.refreshToken)\n }\n\n return globalAPI\n}\n\n/**\n * Reconfigure the global API instance with new settings\n * Useful for updating tokens or base URL\n */\nexport function reconfigureAPI(updates: {\n baseUrl?: string\n token?: string\n refreshToken?: string\n}): API {\n const instance = getAPIInstance()\n\n if (updates.baseUrl) {\n instance.setBaseUrl(updates.baseUrl)\n }\n\n if (updates.token) {\n instance.setToken(updates.token, updates.refreshToken)\n }\n\n return instance\n}\n\n/**\n * Clear tokens from the global API instance\n */\nexport function clearAPITokens(): void {\n const instance = getAPIInstance()\n instance.clearTokens()\n}\n\n/**\n * Reset the global API instance\n * Useful for testing or logout scenarios\n */\nexport function resetAPI(): void {\n if (globalAPI) {\n globalAPI.clearTokens()\n }\n globalAPI = null\n}","// Auto-generated by DjangoCFG - see CLAUDE.md\n/**\n * Typed fetchers for Auth\n *\n * Universal functions that work in any environment:\n * - Next.js (App Router / Pages Router / Server Components)\n * - React Native\n * - Node.js backend\n *\n * These fetchers use Zod schemas for runtime validation.\n *\n * Usage:\n * ```typescript\n * // Configure API once (in your app entry point)\n * import { configureAPI } from '../../api-instance'\n * configureAPI({ baseUrl: 'https://api.example.com' })\n *\n * // Then use fetchers anywhere\n * const users = await getUsers({ page: 1 })\n *\n * // With SWR\n * const { data } = useSWR(['users', params], () => getUsers(params))\n *\n * // With React Query\n * const { data } = useQuery(['users', params], () => getUsers(params))\n *\n * // In Server Component or SSR (pass custom client)\n * import { API } from '../../index'\n * const api = new API('https://api.example.com')\n * const users = await getUsers({ page: 1 }, api)\n * ```\n */\nimport { consola } from 'consola'\nimport { TokenRefreshSchema, type TokenRefresh } from '../schemas/TokenRefresh.schema'\nimport { TokenRefreshRequestSchema, type TokenRefreshRequest } from '../schemas/TokenRefreshRequest.schema'\nimport { getAPIInstance } from '../../api-instance'\n\n/**\n * API operation\n *\n * @method POST\n * @path /cfg/accounts/token/refresh/\n */\nexport async function createAccountsTokenRefreshCreate( data: TokenRefreshRequest, client?: any\n): Promise<TokenRefresh> {\n const api = client || getAPIInstance()\n const response = await api.auth.accountsTokenRefreshCreate(data)\n try {\n return TokenRefreshSchema.parse(response)\n } catch (error) {\n // Zod validation error - log detailed information\n consola.error('❌ Zod Validation Failed');\n consola.box(`createAccountsTokenRefreshCreate\\nPath: /cfg/accounts/token/refresh/\\nMethod: POST`);\n\n if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {\n consola.error('Validation Issues:');\n (error as any).issues.forEach((issue: any, index: number) => {\n consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);\n consola.error(` ├─ Message: ${issue.message}`);\n if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);\n if (issue.received) consola.error(` └─ Received: ${issue.received}`);\n });\n }\n\n consola.error('Response data:', response);\n\n // Dispatch browser CustomEvent (only if window is defined)\n if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {\n try {\n const event = new CustomEvent('zod-validation-error', {\n detail: {\n operation: 'createAccountsTokenRefreshCreate',\n path: '/cfg/accounts/token/refresh/',\n method: 'POST',\n error: error,\n response: response,\n timestamp: new Date(),\n },\n bubbles: true,\n cancelable: false,\n });\n window.dispatchEvent(event);\n } catch (eventError) {\n // Silently fail - event dispatch should never crash the app\n consola.warn('Failed to dispatch validation error event:', eventError);\n }\n }\n\n // Re-throw the error\n throw error;\n }\n}\n\n\n","// Auto-generated by DjangoCFG - see CLAUDE.md\n/**\n * Typed fetchers for Oauth\n *\n * Universal functions that work in any environment:\n * - Next.js (App Router / Pages Router / Server Components)\n * - React Native\n * - Node.js backend\n *\n * These fetchers use Zod schemas for runtime validation.\n *\n * Usage:\n * ```typescript\n * // Configure API once (in your app entry point)\n * import { configureAPI } from '../../api-instance'\n * configureAPI({ baseUrl: 'https://api.example.com' })\n *\n * // Then use fetchers anywhere\n * const users = await getUsers({ page: 1 })\n *\n * // With SWR\n * const { data } = useSWR(['users', params], () => getUsers(params))\n *\n * // With React Query\n * const { data } = useQuery(['users', params], () => getUsers(params))\n *\n * // In Server Component or SSR (pass custom client)\n * import { API } from '../../index'\n * const api = new API('https://api.example.com')\n * const users = await getUsers({ page: 1 }, api)\n * ```\n */\nimport { consola } from 'consola'\nimport { OAuthAuthorizeRequestRequestSchema, type OAuthAuthorizeRequestRequest } from '../schemas/OAuthAuthorizeRequestRequest.schema'\nimport { OAuthAuthorizeResponseSchema, type OAuthAuthorizeResponse } from '../schemas/OAuthAuthorizeResponse.schema'\nimport { OAuthCallbackRequestRequestSchema, type OAuthCallbackRequestRequest } from '../schemas/OAuthCallbackRequestRequest.schema'\nimport { OAuthDisconnectRequestRequestSchema, type OAuthDisconnectRequestRequest } from '../schemas/OAuthDisconnectRequestRequest.schema'\nimport { OAuthProvidersResponseSchema, type OAuthProvidersResponse } from '../schemas/OAuthProvidersResponse.schema'\nimport { OAuthTokenResponseSchema, type OAuthTokenResponse } from '../schemas/OAuthTokenResponse.schema'\nimport { getAPIInstance } from '../../api-instance'\n\n/**\n * List OAuth connections\n *\n * @method GET\n * @path /cfg/accounts/oauth/connections/\n */\nexport async function getAccountsOauthConnectionsList( client?: any\n): Promise<any> {\n const api = client || getAPIInstance()\n const response = await api.oauth.accountsOauthConnectionsList()\n return response\n}\n\n\n/**\n * Disconnect OAuth provider\n *\n * @method POST\n * @path /cfg/accounts/oauth/disconnect/\n */\nexport async function createAccountsOauthDisconnectCreate( data: OAuthDisconnectRequestRequest, client?: any\n): Promise<any> {\n const api = client || getAPIInstance()\n const response = await api.oauth.accountsOauthDisconnectCreate(data)\n return response\n}\n\n\n/**\n * Start GitHub OAuth\n *\n * @method POST\n * @path /cfg/accounts/oauth/github/authorize/\n */\nexport async function createAccountsOauthGithubAuthorizeCreate( data: OAuthAuthorizeRequestRequest, client?: any\n): Promise<OAuthAuthorizeResponse> {\n const api = client || getAPIInstance()\n const response = await api.oauth.accountsOauthGithubAuthorizeCreate(data)\n try {\n return OAuthAuthorizeResponseSchema.parse(response)\n } catch (error) {\n // Zod validation error - log detailed information\n consola.error('❌ Zod Validation Failed');\n consola.box(`createAccountsOauthGithubAuthorizeCreate\\nPath: /cfg/accounts/oauth/github/authorize/\\nMethod: POST`);\n\n if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {\n consola.error('Validation Issues:');\n (error as any).issues.forEach((issue: any, index: number) => {\n consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);\n consola.error(` ├─ Message: ${issue.message}`);\n if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);\n if (issue.received) consola.error(` └─ Received: ${issue.received}`);\n });\n }\n\n consola.error('Response data:', response);\n\n // Dispatch browser CustomEvent (only if window is defined)\n if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {\n try {\n const event = new CustomEvent('zod-validation-error', {\n detail: {\n operation: 'createAccountsOauthGithubAuthorizeCreate',\n path: '/cfg/accounts/oauth/github/authorize/',\n method: 'POST',\n error: error,\n response: response,\n timestamp: new Date(),\n },\n bubbles: true,\n cancelable: false,\n });\n window.dispatchEvent(event);\n } catch (eventError) {\n // Silently fail - event dispatch should never crash the app\n consola.warn('Failed to dispatch validation error event:', eventError);\n }\n }\n\n // Re-throw the error\n throw error;\n }\n}\n\n\n/**\n * Complete GitHub OAuth\n *\n * @method POST\n * @path /cfg/accounts/oauth/github/callback/\n */\nexport async function createAccountsOauthGithubCallbackCreate( data: OAuthCallbackRequestRequest, client?: any\n): Promise<OAuthTokenResponse> {\n const api = client || getAPIInstance()\n const response = await api.oauth.accountsOauthGithubCallbackCreate(data)\n try {\n return OAuthTokenResponseSchema.parse(response)\n } catch (error) {\n // Zod validation error - log detailed information\n consola.error('❌ Zod Validation Failed');\n consola.box(`createAccountsOauthGithubCallbackCreate\\nPath: /cfg/accounts/oauth/github/callback/\\nMethod: POST`);\n\n if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {\n consola.error('Validation Issues:');\n (error as any).issues.forEach((issue: any, index: number) => {\n consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);\n consola.error(` ├─ Message: ${issue.message}`);\n if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);\n if (issue.received) consola.error(` └─ Received: ${issue.received}`);\n });\n }\n\n consola.error('Response data:', response);\n\n // Dispatch browser CustomEvent (only if window is defined)\n if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {\n try {\n const event = new CustomEvent('zod-validation-error', {\n detail: {\n operation: 'createAccountsOauthGithubCallbackCreate',\n path: '/cfg/accounts/oauth/github/callback/',\n method: 'POST',\n error: error,\n response: response,\n timestamp: new Date(),\n },\n bubbles: true,\n cancelable: false,\n });\n window.dispatchEvent(event);\n } catch (eventError) {\n // Silently fail - event dispatch should never crash the app\n consola.warn('Failed to dispatch validation error event:', eventError);\n }\n }\n\n // Re-throw the error\n throw error;\n }\n}\n\n\n/**\n * List OAuth providers\n *\n * @method GET\n * @path /cfg/accounts/oauth/providers/\n */\nexport async function getAccountsOauthProvidersRetrieve( client?: any\n): Promise<OAuthProvidersResponse> {\n const api = client || getAPIInstance()\n const response = await api.oauth.accountsOauthProvidersRetrieve()\n try {\n return OAuthProvidersResponseSchema.parse(response)\n } catch (error) {\n // Zod validation error - log detailed information\n consola.error('❌ Zod Validation Failed');\n consola.box(`getAccountsOauthProvidersRetrieve\\nPath: /cfg/accounts/oauth/providers/\\nMethod: GET`);\n\n if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {\n consola.error('Validation Issues:');\n (error as any).issues.forEach((issue: any, index: number) => {\n consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);\n consola.error(` ├─ Message: ${issue.message}`);\n if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);\n if (issue.received) consola.error(` └─ Received: ${issue.received}`);\n });\n }\n\n consola.error('Response data:', response);\n\n // Dispatch browser CustomEvent (only if window is defined)\n if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {\n try {\n const event = new CustomEvent('zod-validation-error', {\n detail: {\n operation: 'getAccountsOauthProvidersRetrieve',\n path: '/cfg/accounts/oauth/providers/',\n method: 'GET',\n error: error,\n response: response,\n timestamp: new Date(),\n },\n bubbles: true,\n cancelable: false,\n });\n window.dispatchEvent(event);\n } catch (eventError) {\n // Silently fail - event dispatch should never crash the app\n consola.warn('Failed to dispatch validation error event:', eventError);\n }\n }\n\n // Re-throw the error\n throw error;\n }\n}\n\n\n","// Auto-generated by DjangoCFG - see CLAUDE.md\n/**\n * Typed fetchers for User Profile\n *\n * Universal functions that work in any environment:\n * - Next.js (App Router / Pages Router / Server Components)\n * - React Native\n * - Node.js backend\n *\n * These fetchers use Zod schemas for runtime validation.\n *\n * Usage:\n * ```typescript\n * // Configure API once (in your app entry point)\n * import { configureAPI } from '../../api-instance'\n * configureAPI({ baseUrl: 'https://api.example.com' })\n *\n * // Then use fetchers anywhere\n * const users = await getUsers({ page: 1 })\n *\n * // With SWR\n * const { data } = useSWR(['users', params], () => getUsers(params))\n *\n * // With React Query\n * const { data } = useQuery(['users', params], () => getUsers(params))\n *\n * // In Server Component or SSR (pass custom client)\n * import { API } from '../../index'\n * const api = new API('https://api.example.com')\n * const users = await getUsers({ page: 1 }, api)\n * ```\n */\nimport { consola } from 'consola'\nimport { PatchedUserProfileUpdateRequestSchema, type PatchedUserProfileUpdateRequest } from '../schemas/PatchedUserProfileUpdateRequest.schema'\nimport { UserSchema, type User } from '../schemas/User.schema'\nimport { UserProfileUpdateRequestSchema, type UserProfileUpdateRequest } from '../schemas/UserProfileUpdateRequest.schema'\nimport { getAPIInstance } from '../../api-instance'\n\n/**\n * Get current user profile\n *\n * @method GET\n * @path /cfg/accounts/profile/\n */\nexport async function getAccountsProfileRetrieve( client?: any\n): Promise<User> {\n const api = client || getAPIInstance()\n const response = await api.user_profile.accountsProfileRetrieve()\n try {\n return UserSchema.parse(response)\n } catch (error) {\n // Zod validation error - log detailed information\n consola.error('❌ Zod Validation Failed');\n consola.box(`getAccountsProfileRetrieve\\nPath: /cfg/accounts/profile/\\nMethod: GET`);\n\n if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {\n consola.error('Validation Issues:');\n (error as any).issues.forEach((issue: any, index: number) => {\n consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);\n consola.error(` ├─ Message: ${issue.message}`);\n if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);\n if (issue.received) consola.error(` └─ Received: ${issue.received}`);\n });\n }\n\n consola.error('Response data:', response);\n\n // Dispatch browser CustomEvent (only if window is defined)\n if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {\n try {\n const event = new CustomEvent('zod-validation-error', {\n detail: {\n operation: 'getAccountsProfileRetrieve',\n path: '/cfg/accounts/profile/',\n method: 'GET',\n error: error,\n response: response,\n timestamp: new Date(),\n },\n bubbles: true,\n cancelable: false,\n });\n window.dispatchEvent(event);\n } catch (eventError) {\n // Silently fail - event dispatch should never crash the app\n consola.warn('Failed to dispatch validation error event:', eventError);\n }\n }\n\n // Re-throw the error\n throw error;\n }\n}\n\n\n/**\n * Upload user avatar\n *\n * @method POST\n * @path /cfg/accounts/profile/avatar/\n */\nexport async function createAccountsProfileAvatarCreate( data: any, client?: any\n): Promise<User> {\n const api = client || getAPIInstance()\n const response = await api.user_profile.accountsProfileAvatarCreate(data)\n try {\n return UserSchema.parse(response)\n } catch (error) {\n // Zod validation error - log detailed information\n consola.error('❌ Zod Validation Failed');\n consola.box(`createAccountsProfileAvatarCreate\\nPath: /cfg/accounts/profile/avatar/\\nMethod: POST`);\n\n if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {\n consola.error('Validation Issues:');\n (error as any).issues.forEach((issue: any, index: number) => {\n consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);\n consola.error(` ├─ Message: ${issue.message}`);\n if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);\n if (issue.received) consola.error(` └─ Received: ${issue.received}`);\n });\n }\n\n consola.error('Response data:', response);\n\n // Dispatch browser CustomEvent (only if window is defined)\n if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {\n try {\n const event = new CustomEvent('zod-validation-error', {\n detail: {\n operation: 'createAccountsProfileAvatarCreate',\n path: '/cfg/accounts/profile/avatar/',\n method: 'POST',\n error: error,\n response: response,\n timestamp: new Date(),\n },\n bubbles: true,\n cancelable: false,\n });\n window.dispatchEvent(event);\n } catch (eventError) {\n // Silently fail - event dispatch should never crash the app\n consola.warn('Failed to dispatch validation error event:', eventError);\n }\n }\n\n // Re-throw the error\n throw error;\n }\n}\n\n\n/**\n * Partial update user profile\n *\n * @method PUT\n * @path /cfg/accounts/profile/partial/\n */\nexport async function partialUpdateAccountsProfilePartialUpdate( data: UserProfileUpdateRequest, client?: any\n): Promise<User> {\n const api = client || getAPIInstance()\n const response = await api.user_profile.accountsProfilePartialUpdate(data)\n try {\n return UserSchema.parse(response)\n } catch (error) {\n // Zod validation error - log detailed information\n consola.error('❌ Zod Validation Failed');\n consola.box(`partialUpdateAccountsProfilePartialUpdate\\nPath: /cfg/accounts/profile/partial/\\nMethod: PUT`);\n\n if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {\n consola.error('Validation Issues:');\n (error as any).issues.forEach((issue: any, index: number) => {\n consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);\n consola.error(` ├─ Message: ${issue.message}`);\n if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);\n if (issue.received) consola.error(` └─ Received: ${issue.received}`);\n });\n }\n\n consola.error('Response data:', response);\n\n // Dispatch browser CustomEvent (only if window is defined)\n if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {\n try {\n const event = new CustomEvent('zod-validation-error', {\n detail: {\n operation: 'partialUpdateAccountsProfilePartialUpdate',\n path: '/cfg/accounts/profile/partial/',\n method: 'PUT',\n error: error,\n response: response,\n timestamp: new Date(),\n },\n bubbles: true,\n cancelable: false,\n });\n window.dispatchEvent(event);\n } catch (eventError) {\n // Silently fail - event dispatch should never crash the app\n consola.warn('Failed to dispatch validation error event:', eventError);\n }\n }\n\n // Re-throw the error\n throw error;\n }\n}\n\n\n/**\n * Partial update user profile\n *\n * @method PATCH\n * @path /cfg/accounts/profile/partial/\n */\nexport async function partialUpdateAccountsProfilePartialPartialUpdate( data?: PatchedUserProfileUpdateRequest, client?: any\n): Promise<User> {\n const api = client || getAPIInstance()\n const response = await api.user_profile.accountsProfilePartialPartialUpdate(data)\n try {\n return UserSchema.parse(response)\n } catch (error) {\n // Zod validation error - log detailed information\n consola.error('❌ Zod Validation Failed');\n consola.box(`partialUpdateAccountsProfilePartialPartialUpdate\\nPath: /cfg/accounts/profile/partial/\\nMethod: PATCH`);\n\n if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {\n consola.error('Validation Issues:');\n (error as any).issues.forEach((issue: any, index: number) => {\n consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);\n consola.error(` ├─ Message: ${issue.message}`);\n if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);\n if (issue.received) consola.error(` └─ Received: ${issue.received}`);\n });\n }\n\n consola.error('Response data:', response);\n\n // Dispatch browser CustomEvent (only if window is defined)\n if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {\n try {\n const event = new CustomEvent('zod-validation-error', {\n detail: {\n operation: 'partialUpdateAccountsProfilePartialPartialUpdate',\n path: '/cfg/accounts/profile/partial/',\n method: 'PATCH',\n error: error,\n response: response,\n timestamp: new Date(),\n },\n bubbles: true,\n cancelable: false,\n });\n window.dispatchEvent(event);\n } catch (eventError) {\n // Silently fail - event dispatch should never crash the app\n consola.warn('Failed to dispatch validation error event:', eventError);\n }\n }\n\n // Re-throw the error\n throw error;\n }\n}\n\n\n/**\n * Update user profile\n *\n * @method PUT\n * @path /cfg/accounts/profile/update/\n */\nexport async function updateAccountsProfileUpdateUpdate( data: UserProfileUpdateRequest, client?: any\n): Promise<User> {\n const api = client || getAPIInstance()\n const response = await api.user_profile.accountsProfileUpdateUpdate(data)\n try {\n return UserSchema.parse(response)\n } catch (error) {\n // Zod validation error - log detailed information\n consola.error('❌ Zod Validation Failed');\n consola.box(`updateAccountsProfileUpdateUpdate\\nPath: /cfg/accounts/profile/update/\\nMethod: PUT`);\n\n if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {\n consola.error('Validation Issues:');\n (error as any).issues.forEach((issue: any, index: number) => {\n consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);\n consola.error(` ├─ Message: ${issue.message}`);\n if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);\n if (issue.received) consola.error(` └─ Received: ${issue.received}`);\n });\n }\n\n consola.error('Response data:', response);\n\n // Dispatch browser CustomEvent (only if window is defined)\n if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {\n try {\n const event = new CustomEvent('zod-validation-error', {\n detail: {\n operation: 'updateAccountsProfileUpdateUpdate',\n path: '/cfg/accounts/profile/update/',\n method: 'PUT',\n error: error,\n response: response,\n timestamp: new Date(),\n },\n bubbles: true,\n cancelable: false,\n });\n window.dispatchEvent(event);\n } catch (eventError) {\n // Silently fail - event dispatch should never crash the app\n consola.warn('Failed to dispatch validation error event:', eventError);\n }\n }\n\n // Re-throw the error\n throw error;\n }\n}\n\n\n/**\n * Update user profile\n *\n * @method PATCH\n * @path /cfg/accounts/profile/update/\n */\nexport async function partialUpdateAccountsProfileUpdatePartialUpdate( data?: PatchedUserProfileUpdateRequest, client?: any\n): Promise<User> {\n const api = client || getAPIInstance()\n const response = await api.user_profile.accountsProfileUpdatePartialUpdate(data)\n try {\n return UserSchema.parse(response)\n } catch (error) {\n // Zod validation error - log detailed information\n consola.error('❌ Zod Validation Failed');\n consola.box(`partialUpdateAccountsProfileUpdatePartialUpdate\\nPath: /cfg/accounts/profile/update/\\nMethod: PATCH`);\n\n if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {\n consola.error('Validation Issues:');\n (error as any).issues.forEach((issue: any, index: number) => {\n consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);\n consola.error(` ├─ Message: ${issue.message}`);\n if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);\n if (issue.received) consola.error(` └─ Received: ${issue.received}`);\n });\n }\n\n consola.error('Response data:', response);\n\n // Dispatch browser CustomEvent (only if window is defined)\n if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {\n try {\n const event = new CustomEvent('zod-validation-error', {\n detail: {\n operation: 'partialUpdateAccountsProfileUpdatePartialUpdate',\n path: '/cfg/accounts/profile/update/',\n method: 'PATCH',\n error: error,\n response: response,\n timestamp: new Date(),\n },\n bubbles: true,\n cancelable: false,\n });\n window.dispatchEvent(event);\n } catch (eventError) {\n // Silently fail - event dispatch should never crash the app\n consola.warn('Failed to dispatch validation error event:', eventError);\n }\n }\n\n // Re-throw the error\n throw error;\n }\n}\n\n\n","// Auto-generated by DjangoCFG - see CLAUDE.md\n/**\n * Django CFG API - API Client with JWT Management\n *\n * Usage:\n * ```typescript\n * import { API } from './api';\n *\n * const api = new API('https://api.example.com');\n *\n * // Set JWT token\n * api.setToken('your-jwt-token', 'refresh-token');\n *\n * // Use API\n * const posts = await api.posts.list();\n * const user = await api.users.retrieve(1);\n *\n * // Check authentication\n * if (api.isAuthenticated()) {\n * // ...\n * }\n *\n * // Custom storage with logging (for Electron/Node.js)\n * import { MemoryStorageAdapter, APILogger } from './storage';\n * const logger = new APILogger({ enabled: true, logLevel: 'debug' });\n * const api = new API('https://api.example.com', {\n * storage: new MemoryStorageAdapter(logger),\n * loggerConfig: { enabled: true, logLevel: 'debug' }\n * });\n *\n * // Get OpenAPI schema\n * const schema = api.getSchema();\n * ```\n */\n\nimport { APIClient } from \"./client\";\nimport {\n StorageAdapter,\n LocalStorageAdapter,\n CookieStorageAdapter,\n MemoryStorageAdapter\n} from \"./storage\";\nimport type { RetryConfig } from \"./retry\";\nimport type { LoggerConfig } from \"./logger\";\nimport { APILogger } from \"./logger\";\nimport { Auth } from \"./accounts__auth/client\";\nimport { Oauth } from \"./accounts__oauth/client\";\nimport { UserProfile } from \"./accounts__user_profile/client\";\nimport { Accounts } from \"./accounts/client\";\nexport * as AuthTypes from \"./accounts__auth/models\";\n// Note: Direct exports (export * from) are removed to avoid duplicate type conflicts\n// Use namespace exports like CfgAccountsTypes.User or import from specific modules\nexport * as OauthTypes from \"./accounts__oauth/models\";\n// Note: Direct exports (export * from) are removed to avoid duplicate type conflicts\n// Use namespace exports like CfgAccountsTypes.User or import from specific modules\nexport * as UserProfileTypes from \"./accounts__user_profile/models\";\n// Note: Direct exports (export * from) are removed to avoid duplicate type conflicts\n// Use namespace exports like CfgAccountsTypes.User or import from specific modules\nexport * as AccountsTypes from \"./accounts/models\";\n// Note: Direct exports (export * from) are removed to avoid duplicate type conflicts\n// Use namespace exports like CfgAccountsTypes.User or import from specific modules\nexport * as Enums from \"./enums\";\n\n// Re-export Zod schemas for runtime validation\nexport * as Schemas from \"./_utils/schemas\";\n// Also export all schemas directly for convenience\nexport * from \"./_utils/schemas\";\n\n// Re-export Zod validation events for browser integration\nexport type { ValidationErrorDetail, ValidationErrorEvent } from \"./validation-events\";\nexport { dispatchValidationError, onValidationError, formatZodError } from \"./validation-events\";\n\n// Re-export typed fetchers for universal usage\nexport * as Fetchers from \"./_utils/fetchers\";\nexport * from \"./_utils/fetchers\";\n\n// Re-export API instance configuration functions\nexport {\n configureAPI,\n getAPIInstance,\n reconfigureAPI,\n clearAPITokens,\n resetAPI,\n isAPIConfigured\n} from \"./api-instance\";\n// NOTE: SWR hooks are generated in ./_utils/hooks/ but NOT exported here to keep\n// the main bundle server-safe. Import hooks directly from the hooks directory:\n// import { useUsers } from './_utils/hooks';\n// Or use a separate entry point like '@djangocfg/api/hooks' for client components.\n\n// Re-export core client\nexport { APIClient };\n\n// Re-export storage adapters for convenience\nexport type { StorageAdapter };\nexport { LocalStorageAdapter, CookieStorageAdapter, MemoryStorageAdapter };\n\n// Re-export error classes for convenience\nexport { APIError, NetworkError } from \"./errors\";\n\n// Re-export HTTP adapters for custom implementations\nexport type { HttpClientAdapter, HttpRequest, HttpResponse } from \"./http\";\nexport { FetchAdapter } from \"./http\";\n\n// Re-export logger types and classes\nexport type { LoggerConfig, RequestLog, ResponseLog, ErrorLog } from \"./logger\";\nexport { APILogger } from \"./logger\";\n\n// Re-export retry configuration and utilities\nexport type { RetryConfig, FailedAttemptInfo } from \"./retry\";\nexport { withRetry, shouldRetry, DEFAULT_RETRY_CONFIG } from \"./retry\";\n\nexport const TOKEN_KEY = \"auth_token\";\nexport const REFRESH_TOKEN_KEY = \"refresh_token\";\n\nexport interface APIOptions {\n /** Custom storage adapter (defaults to LocalStorageAdapter) */\n storage?: StorageAdapter;\n /** Retry configuration for failed requests */\n retryConfig?: RetryConfig;\n /** Logger configuration */\n loggerConfig?: Partial<LoggerConfig>;\n}\n\nexport class API {\n private baseUrl: string;\n private _client: APIClient;\n private _token: string | null = null;\n private _refreshToken: string | null = null;\n private storage: StorageAdapter;\n private options?: APIOptions;\n\n // Sub-clients\n public auth!: Auth;\n public oauth!: Oauth;\n public user_profile!: UserProfile;\n public accounts!: Accounts;\n\n constructor(baseUrl: string, options?: APIOptions) {\n this.baseUrl = baseUrl;\n this.options = options;\n\n // Create logger if config provided\n const logger = options?.loggerConfig ? new APILogger(options.loggerConfig) : undefined;\n\n // Initialize storage with logger\n this.storage = options?.storage || new LocalStorageAdapter(logger);\n\n this._loadTokensFromStorage();\n\n // Initialize APIClient\n this._client = new APIClient(this.baseUrl, {\n retryConfig: this.options?.retryConfig,\n loggerConfig: this.options?.loggerConfig,\n });\n\n // Always inject auth header wrapper (reads token dynamically from storage)\n this._injectAuthHeader();\n\n // Initialize sub-clients from APIClient\n this.auth = this._client.auth;\n this.oauth = this._client.oauth;\n this.user_profile = this._client.user_profile;\n this.accounts = this._client.accounts;\n }\n\n private _loadTokensFromStorage(): void {\n this._token = this.storage.getItem(TOKEN_KEY);\n this._refreshToken = this.storage.getItem(REFRESH_TOKEN_KEY);\n }\n\n private _reinitClients(): void {\n this._client = new APIClient(this.baseUrl, {\n retryConfig: this.options?.retryConfig,\n loggerConfig: this.options?.loggerConfig,\n });\n\n // Always inject auth header wrapper (reads token dynamically from storage)\n this._injectAuthHeader();\n\n // Reinitialize sub-clients\n this.auth = this._client.auth;\n this.oauth = this._client.oauth;\n this.user_profile = this._client.user_profile;\n this.accounts = this._client.accounts;\n }\n\n private _injectAuthHeader(): void {\n // Override request method to inject auth header\n const originalRequest = this._client.request.bind(this._client);\n this._client.request = async <T>(\n method: string,\n path: string,\n options?: { params?: Record<string, any>; body?: any; formData?: FormData; headers?: Record<string, string> }\n ): Promise<T> => {\n // Read token from storage dynamically (supports JWT injection after instantiation)\n const token = this.getToken();\n const mergedOptions = {\n ...options,\n headers: {\n ...(options?.headers || {}),\n ...(token ? { 'Authorization': `Bearer ${token}` } : {}),\n },\n };\n\n return originalRequest(method, path, mergedOptions);\n };\n }\n\n /**\n * Get current JWT token\n */\n getToken(): string | null {\n return this.storage.getItem(TOKEN_KEY);\n }\n\n /**\n * Get current refresh token\n */\n getRefreshToken(): string | null {\n return this.storage.getItem(REFRESH_TOKEN_KEY);\n }\n\n /**\n * Set JWT token and refresh token\n * @param token - JWT access token\n * @param refreshToken - JWT refresh token (optional)\n */\n setToken(token: string, refreshToken?: string): void {\n this._token = token;\n this.storage.setItem(TOKEN_KEY, token);\n\n if (refreshToken) {\n this._refreshToken = refreshToken;\n this.storage.setItem(REFRESH_TOKEN_KEY, refreshToken);\n }\n\n // Reinitialize clients with new token\n this._reinitClients();\n }\n\n /**\n * Clear all tokens\n */\n clearTokens(): void {\n this._token = null;\n this._refreshToken = null;\n this.storage.removeItem(TOKEN_KEY);\n this.storage.removeItem(REFRESH_TOKEN_KEY);\n\n // Reinitialize clients without token\n this._reinitClients();\n }\n\n /**\n * Check if user is authenticated\n */\n isAuthenticated(): boolean {\n return !!this.getToken();\n }\n\n /**\n * Update base URL and reinitialize clients\n * @param url - New base URL\n */\n setBaseUrl(url: string): void {\n this.baseUrl = url;\n this._reinitClients();\n }\n\n /**\n * Get current base URL\n */\n getBaseUrl(): string {\n return this.baseUrl;\n }\n\n /**\n * Get OpenAPI schema path\n * @returns Path to the OpenAPI schema JSON file\n *\n * Note: The OpenAPI schema is available in the schema.json file.\n * You can load it dynamically using:\n * ```typescript\n * const schema = await fetch('./schema.json').then(r => r.json());\n * // or using fs in Node.js:\n * // const schema = JSON.parse(fs.readFileSync('./schema.json', 'utf-8'));\n * ```\n */\n getSchemaPath(): string {\n return './schema.json';\n }\n}\n\nexport default API;","import * as Models from \"./models\";\n\n\n/**\n * API endpoints for Centrifugo Admin API.\n */\nexport class CentrifugoAdminApi {\n private client: any;\n\n constructor(client: any) {\n this.client = client;\n }\n\n /**\n * Get connection token for dashboard\n * \n * Returns JWT token and config for WebSocket connection to Centrifugo.\n */\n async centrifugoServerAuthTokenCreate(): Promise<any> {\n const response = await this.client.request('POST', \"/cfg/centrifugo/server/auth/token/\");\n return response;\n }\n\n /**\n * List active channels\n * \n * Returns list of active channels with optional pattern filter.\n */\n async centrifugoServerChannelsCreate(data: Models.CentrifugoChannelsRequestRequest): Promise<Models.CentrifugoChannelsResponse> {\n const response = await this.client.request('POST', \"/cfg/centrifugo/server/channels/\", { body: data });\n return response;\n }\n\n /**\n * Get channel history\n * \n * Returns message history for a channel.\n */\n async centrifugoServerHistoryCreate(data: Models.CentrifugoHistoryRequestRequest): Promise<Models.CentrifugoHistoryResponse> {\n const response = await this.client.request('POST', \"/cfg/centrifugo/server/history/\", { body: data });\n return response;\n }\n\n /**\n * Get Centrifugo server info\n * \n * Returns server information including node count, version, and uptime.\n */\n async centrifugoServerInfoCreate(): Promise<Models.CentrifugoInfoResponse> {\n const response = await this.client.request('POST', \"/cfg/centrifugo/server/info/\");\n return response;\n }\n\n /**\n * Get channel presence\n * \n * Returns list of clients currently subscribed to a channel.\n */\n async centrifugoServerPresenceCreate(data: Models.CentrifugoPresenceRequestRequest): Promise<Models.CentrifugoPresenceResponse> {\n const response = await this.client.request('POST', \"/cfg/centrifugo/server/presence/\", { body: data });\n return response;\n }\n\n /**\n * Get channel presence statistics\n * \n * Returns quick statistics about channel presence (num_clients,\n * num_users).\n */\n async centrifugoServerPresenceStatsCreate(data: Models.CentrifugoPresenceStatsRequestRequest): Promise<Models.CentrifugoPresenceStatsResponse> {\n const response = await this.client.request('POST', \"/cfg/centrifugo/server/presence-stats/\", { body: data });\n return response;\n }\n\n}","import * as Models from \"./models\";\n\n\n/**\n * API endpoints for Centrifugo Auth.\n */\nexport class CentrifugoAuth {\n private client: any;\n\n constructor(client: any) {\n this.client = client;\n }\n\n /**\n * Get Centrifugo connection token\n * \n * Generate JWT token for WebSocket connection to Centrifugo. Token\n * includes user's allowed channels based on their permissions. Requires\n * authentication.\n */\n async tokenRetrieve(): Promise<Models.ConnectionTokenResponse> {\n const response = await this.client.request('GET', \"/cfg/centrifugo/auth/token/\");\n return response;\n }\n\n}","import * as Models from \"./models\";\n\n\n/**\n * API endpoints for Centrifugo Monitoring.\n */\nexport class CentrifugoMonitoring {\n private client: any;\n\n constructor(client: any) {\n this.client = client;\n }\n\n async centrifugoMonitorChannelsRetrieve(hours?: number): Promise<Models.ChannelList[]>;\n async centrifugoMonitorChannelsRetrieve(params?: { hours?: number }): Promise<Models.ChannelList[]>;\n\n /**\n * Get channel statistics\n * \n * Returns statistics grouped by channel.\n */\n async centrifugoMonitorChannelsRetrieve(...args: any[]): Promise<Models.ChannelList[]> {\n const isParamsObject = args.length === 1 && typeof args[0] === 'object' && args[0] !== null && !Array.isArray(args[0]);\n \n let params;\n if (isParamsObject) {\n params = args[0];\n } else {\n params = { hours: args[0] };\n }\n const response = await this.client.request('GET', \"/cfg/centrifugo/monitor/channels/\", { params });\n return (response as any).results || response;\n }\n\n /**\n * Get Centrifugo health status\n * \n * Returns the current health status of the Centrifugo client.\n */\n async centrifugoMonitorHealthRetrieve(): Promise<Models.CentrifugoHealthCheck> {\n const response = await this.client.request('GET', \"/cfg/centrifugo/monitor/health/\");\n return response;\n }\n\n async centrifugoMonitorOverviewRetrieve(hours?: number): Promise<Models.CentrifugoOverviewStats>;\n async centrifugoMonitorOverviewRetrieve(params?: { hours?: number }): Promise<Models.CentrifugoOverviewStats>;\n\n /**\n * Get overview statistics\n * \n * Returns overview statistics for Centrifugo publishes.\n */\n async centrifugoMonitorOverviewRetrieve(...args: any[]): Promise<Models.CentrifugoOverviewStats> {\n const isParamsObject = args.length === 1 && typeof args[0] === 'object' && args[0] !== null && !Array.isArray(args[0]);\n \n let params;\n if (isParamsObject) {\n params = args[0];\n } else {\n params = { hours: args[0] };\n }\n const response = await this.client.request('GET', \"/cfg/centrifugo/monitor/overview/\", { params });\n return response;\n }\n\n async centrifugoMonitorPublishesList(channel?: string, page?: number, page_size?: number, status?: string): Promise<Models.PaginatedPublishList>;\n async centrifugoMonitorPublishesList(params?: { channel?: string; page?: number; page_size?: number; status?: string }): Promise<Models.PaginatedPublishList>;\n\n /**\n * Get recent publishes\n * \n * Returns a paginated list of recent Centrifugo publishes with their\n * details. Uses standard DRF pagination.\n */\n async centrifugoMonitorPublishesList(...args: any[]): Promise<Models.PaginatedPublishList> {\n const isParamsObject = args.length === 1 && typeof args[0] === 'object' && args[0] !== null && !Array.isArray(args[0]);\n \n let params;\n if (isParamsObject) {\n params = args[0];\n } else {\n params = { channel: args[0], page: args[1], page_size: args[2], status: args[3] };\n }\n const response = await this.client.request('GET', \"/cfg/centrifugo/monitor/publishes/\", { params });\n return response;\n }\n\n async centrifugoMonitorTimelineRetrieve(hours?: number, interval?: string): Promise<Models.TimelineResponse>;\n async centrifugoMonitorTimelineRetrieve(params?: { hours?: number; interval?: string }): Promise<Models.TimelineResponse>;\n\n /**\n * Get publish timeline\n * \n * Returns hourly or daily breakdown of publish counts for charts.\n */\n async centrifugoMonitorTimelineRetrieve(...args: any[]): Promise<Models.TimelineResponse> {\n const isParamsObject = args.length === 1 && typeof args[0] === 'object' && args[0] !== null && !Array.isArray(args[0]);\n \n let params;\n if (isParamsObject) {\n params = args[0];\n } else {\n params = { hours: args[0], interval: args[1] };\n }\n const response = await this.client.request('GET', \"/cfg/centrifugo/monitor/timeline/\", { params });\n return response;\n }\n\n}","import * as Models from \"./models\";\n\n\n/**\n * API endpoints for Centrifugo Testing.\n */\nexport class CentrifugoTesting {\n private client: any;\n\n constructor(client: any) {\n this.client = client;\n }\n\n /**\n * Publish test message\n * \n * Publish test message to Centrifugo via wrapper with optional ACK\n * tracking.\n */\n async publishTestCreate(data: Models.PublishTestRequestRequest): Promise<Models.PublishTestResponse> {\n const response = await this.client.request('POST', \"/cfg/centrifugo/testing/publish-test/\", { body: data });\n return response;\n }\n\n /**\n * Publish with database logging\n * \n * Publish message using CentrifugoClient with database logging. This will\n * create CentrifugoLog records.\n */\n async publishWithLoggingCreate(data: Models.PublishTestRequestRequest): Promise<Models.PublishTestResponse> {\n const response = await this.client.request('POST', \"/cfg/centrifugo/testing/publish-with-logging/\", { body: data });\n return response;\n }\n\n /**\n * Send manual ACK\n * \n * Manually send ACK for a message to the wrapper. Pass message_id in\n * request body.\n */\n async sendAckCreate(data: Models.ManualAckRequestRequest): Promise<Models.ManualAckResponse> {\n const response = await this.client.request('POST', \"/cfg/centrifugo/testing/send-ack/\", { body: data });\n return response;\n }\n\n}","// Auto-generated by DjangoCFG - see CLAUDE.md\n/**\n * HTTP Client Adapter Pattern\n *\n * Allows switching between fetch/axios/httpx without changing generated code.\n * Provides unified interface for making HTTP requests.\n */\n\nexport interface HttpRequest {\n method: string;\n url: string;\n headers?: Record<string, string>;\n body?: any;\n params?: Record<string, any>;\n /** FormData for file uploads (multipart/form-data) */\n formData?: FormData;\n}\n\nexport interface HttpResponse<T = any> {\n data: T;\n status: number;\n statusText: string;\n headers: Record<string, string>;\n}\n\n/**\n * HTTP Client Adapter Interface.\n * Implement this to use custom HTTP clients (axios, httpx, etc.)\n */\nexport interface HttpClientAdapter {\n request<T = any>(request: HttpRequest): Promise<HttpResponse<T>>;\n}\n\n/**\n * Default Fetch API adapter.\n * Uses native browser fetch() with proper error handling.\n */\nexport class FetchAdapter implements HttpClientAdapter {\n async request<T = any>(request: HttpRequest): Promise<HttpResponse<T>> {\n const { method, url, headers, body, params, formData } = request;\n\n // Build URL with query params\n let finalUrl = url;\n if (params) {\n const searchParams = new URLSearchParams();\n Object.entries(params).forEach(([key, value]) => {\n if (value !== null && value !== undefined) {\n searchParams.append(key, String(value));\n }\n });\n const queryString = searchParams.toString();\n if (queryString) {\n finalUrl = url.includes('?') ? `${url}&${queryString}` : `${url}?${queryString}`;\n }\n }\n\n // Build headers\n const finalHeaders: Record<string, string> = { ...headers };\n\n // Determine body and content-type\n let requestBody: string | FormData | undefined;\n\n if (formData) {\n // For multipart/form-data, let browser set Content-Type with boundary\n requestBody = formData;\n // Don't set Content-Type - browser will set it with boundary\n } else if (body) {\n // JSON request\n finalHeaders['Content-Type'] = 'application/json';\n requestBody = JSON.stringify(body);\n }\n\n // Make request\n const response = await fetch(finalUrl, {\n method,\n headers: finalHeaders,\n body: requestBody,\n credentials: 'include', // Include Django session cookies\n });\n\n // Parse response\n let data: any = null;\n const contentType = response.headers.get('content-type');\n\n if (response.status !== 204 && contentType?.includes('application/json')) {\n data = await response.json();\n } else if (response.status !== 204) {\n data = await response.text();\n }\n\n // Convert Headers to plain object\n const responseHeaders: Record<string, string> = {};\n response.headers.forEach((value, key) => {\n responseHeaders[key] = value;\n });\n\n return {\n data,\n status: response.status,\n statusText: response.statusText,\n headers: responseHeaders,\n };\n }\n}","// Auto-generated by DjangoCFG - see CLAUDE.md\n/**\n * API Error Classes\n *\n * Typed error classes with Django REST Framework support.\n */\n\n/**\n * HTTP API Error with DRF field-specific validation errors.\n *\n * Usage:\n * ```typescript\n * try {\n * await api.users.create(userData);\n * } catch (error) {\n * if (error instanceof APIError) {\n * if (error.isValidationError) {\n * console.log('Field errors:', error.fieldErrors);\n * // { \"email\": [\"Email already exists\"], \"username\": [\"Required\"] }\n * }\n * }\n * }\n * ```\n */\nexport class APIError extends Error {\n constructor(\n public statusCode: number,\n public statusText: string,\n public response: any,\n public url: string,\n message?: string\n ) {\n super(message || `HTTP ${statusCode}: ${statusText}`);\n this.name = 'APIError';\n }\n\n /**\n * Get error details from response.\n * DRF typically returns: { \"detail\": \"Error message\" } or { \"field\": [\"error1\", \"error2\"] }\n */\n get details(): Record<string, any> | null {\n if (typeof this.response === 'object' && this.response !== null) {\n return this.response;\n }\n return null;\n }\n\n /**\n * Get field-specific validation errors from DRF.\n * Returns: { \"field_name\": [\"error1\", \"error2\"], ... }\n */\n get fieldErrors(): Record<string, string[]> | null {\n const details = this.details;\n if (!details) return null;\n\n // DRF typically returns: { \"field\": [\"error1\", \"error2\"] }\n const fieldErrors: Record<string, string[]> = {};\n for (const [key, value] of Object.entries(details)) {\n if (Array.isArray(value)) {\n fieldErrors[key] = value;\n }\n }\n\n return Object.keys(fieldErrors).length > 0 ? fieldErrors : null;\n }\n\n /**\n * Get single error message from DRF.\n * Checks for \"detail\", \"message\", or first field error.\n */\n get errorMessage(): string {\n const details = this.details;\n if (!details) return this.message;\n\n // Check for \"detail\" field (common in DRF)\n if (details.detail) {\n return Array.isArray(details.detail) ? details.detail.join(', ') : String(details.detail);\n }\n\n // Check for \"message\" field\n if (details.message) {\n return String(details.message);\n }\n\n // Return first field error\n const fieldErrors = this.fieldErrors;\n if (fieldErrors) {\n const firstField = Object.keys(fieldErrors)[0];\n if (firstField) {\n return `${firstField}: ${fieldErrors[firstField]?.join(', ')}`;\n }\n }\n\n return this.message;\n }\n\n // Helper methods for common HTTP status codes\n get isValidationError(): boolean { return this.statusCode === 400; }\n get isAuthError(): boolean { return this.statusCode === 401; }\n get isPermissionError(): boolean { return this.statusCode === 403; }\n get isNotFoundError(): boolean { return this.statusCode === 404; }\n get isServerError(): boolean { return this.statusCode >= 500 && this.statusCode < 600; }\n}\n\n/**\n * Network Error (connection failed, timeout, etc.)\n */\nexport class NetworkError extends Error {\n constructor(\n message: string,\n public url: string,\n public originalError?: Error\n ) {\n super(message);\n this.name = 'NetworkError';\n }\n}","// Auto-generated by DjangoCFG - see CLAUDE.md\n/**\n * API Logger with Consola\n * Beautiful console logging for API requests and responses\n *\n * Installation:\n * npm install consola\n */\n\nimport { type ConsolaInstance, createConsola } from 'consola';\n\n/**\n * Request log data\n */\nexport interface RequestLog {\n method: string;\n url: string;\n headers?: Record<string, string>;\n body?: any;\n timestamp: number;\n}\n\n/**\n * Response log data\n */\nexport interface ResponseLog {\n status: number;\n statusText: string;\n data?: any;\n duration: number;\n timestamp: number;\n}\n\n/**\n * Error log data\n */\nexport interface ErrorLog {\n message: string;\n statusCode?: number;\n fieldErrors?: Record<string, string[]>;\n duration: number;\n timestamp: number;\n}\n\n/**\n * Logger configuration\n */\nexport interface LoggerConfig {\n /** Enable logging */\n enabled: boolean;\n /** Log requests */\n logRequests: boolean;\n /** Log responses */\n logResponses: boolean;\n /** Log errors */\n logErrors: boolean;\n /** Log request/response bodies */\n logBodies: boolean;\n /** Log headers (excluding sensitive ones) */\n logHeaders: boolean;\n /** Custom consola instance */\n consola?: ConsolaInstance;\n}\n\n/**\n * Default logger configuration\n */\nconst DEFAULT_CONFIG: LoggerConfig = {\n enabled: process.env.NODE_ENV !== 'production',\n logRequests: true,\n logResponses: true,\n logErrors: true,\n logBodies: true,\n logHeaders: false,\n};\n\n/**\n * Sensitive header names to filter out\n */\nconst SENSITIVE_HEADERS = [\n 'authorization',\n 'cookie',\n 'set-cookie',\n 'x-api-key',\n 'x-csrf-token',\n];\n\n/**\n * API Logger class\n */\nexport class APILogger {\n private config: LoggerConfig;\n private consola: ConsolaInstance;\n\n constructor(config: Partial<LoggerConfig> = {}) {\n this.config = { ...DEFAULT_CONFIG, ...config };\n this.consola = config.consola || createConsola({\n level: this.config.enabled ? 4 : 0,\n });\n }\n\n /**\n * Enable logging\n */\n enable(): void {\n this.config.enabled = true;\n }\n\n /**\n * Disable logging\n */\n disable(): void {\n this.config.enabled = false;\n }\n\n /**\n * Update configuration\n */\n setConfig(config: Partial<LoggerConfig>): void {\n this.config = { ...this.config, ...config };\n }\n\n /**\n * Filter sensitive headers\n */\n private filterHeaders(headers?: Record<string, string>): Record<string, string> {\n if (!headers) return {};\n\n const filtered: Record<string, string> = {};\n Object.keys(headers).forEach((key) => {\n const lowerKey = key.toLowerCase();\n if (SENSITIVE_HEADERS.includes(lowerKey)) {\n filtered[key] = '***';\n } else {\n filtered[key] = headers[key] || '';\n }\n });\n\n return filtered;\n }\n\n /**\n * Log request\n */\n logRequest(request: RequestLog): void {\n if (!this.config.enabled || !this.config.logRequests) return;\n\n const { method, url, headers, body } = request;\n\n this.consola.start(`${method} ${url}`);\n\n if (this.config.logHeaders && headers) {\n this.consola.debug('Headers:', this.filterHeaders(headers));\n }\n\n if (this.config.logBodies && body) {\n this.consola.debug('Body:', body);\n }\n }\n\n /**\n * Log response\n */\n logResponse(request: RequestLog, response: ResponseLog): void {\n if (!this.config.enabled || !this.config.logResponses) return;\n\n const { method, url } = request;\n const { status, statusText, data, duration } = response;\n\n const statusColor = status >= 500 ? 'red'\n : status >= 400 ? 'yellow'\n : status >= 300 ? 'cyan'\n : 'green';\n\n this.consola.success(\n `${method} ${url} ${status} ${statusText} (${duration}ms)`\n );\n\n if (this.config.logBodies && data) {\n this.consola.debug('Response:', data);\n }\n }\n\n /**\n * Log error\n */\n logError(request: RequestLog, error: ErrorLog): void {\n if (!this.config.enabled || !this.config.logErrors) return;\n\n const { method, url } = request;\n const { message, statusCode, fieldErrors, duration } = error;\n\n this.consola.error(\n `${method} ${url} ${statusCode || 'Network'} Error (${duration}ms)`\n );\n\n this.consola.error('Message:', message);\n\n if (fieldErrors && Object.keys(fieldErrors).length > 0) {\n this.consola.error('Field Errors:');\n Object.entries(fieldErrors).forEach(([field, errors]) => {\n errors.forEach((err) => {\n this.consola.error(` • ${field}: ${err}`);\n });\n });\n }\n }\n\n /**\n * Log general info\n */\n info(message: string, ...args: any[]): void {\n if (!this.config.enabled) return;\n this.consola.info(message, ...args);\n }\n\n /**\n * Log warning\n */\n warn(message: string, ...args: any[]): void {\n if (!this.config.enabled) return;\n this.consola.warn(message, ...args);\n }\n\n /**\n * Log error\n */\n error(message: string, ...args: any[]): void {\n if (!this.config.enabled) return;\n this.consola.error(message, ...args);\n }\n\n /**\n * Log debug\n */\n debug(message: string, ...args: any[]): void {\n if (!this.config.enabled) return;\n this.consola.debug(message, ...args);\n }\n\n /**\n * Log success\n */\n success(message: string, ...args: any[]): void {\n if (!this.config.enabled) return;\n this.consola.success(message, ...args);\n }\n\n /**\n * Create a sub-logger with prefix\n */\n withTag(tag: string): ConsolaInstance {\n return this.consola.withTag(tag);\n }\n}\n\n/**\n * Default logger instance\n */\nexport const defaultLogger = new APILogger();","// Auto-generated by DjangoCFG - see CLAUDE.md\n/**\n * Retry Configuration and Utilities\n *\n * Provides automatic retry logic for failed HTTP requests using p-retry.\n * Retries only on network errors and server errors (5xx), not client errors (4xx).\n */\n\nimport pRetry, { AbortError } from 'p-retry';\nimport { APIError, NetworkError } from './errors';\n\n/**\n * Information about a failed retry attempt.\n */\nexport interface FailedAttemptInfo {\n /** The error that caused the failure */\n error: Error;\n /** The attempt number (1-indexed) */\n attemptNumber: number;\n /** Number of retries left */\n retriesLeft: number;\n}\n\n/**\n * Retry configuration options.\n *\n * Uses exponential backoff with jitter by default to avoid thundering herd.\n */\nexport interface RetryConfig {\n /**\n * Maximum number of retry attempts.\n * @default 3\n */\n retries?: number;\n\n /**\n * Exponential backoff factor.\n * @default 2\n */\n factor?: number;\n\n /**\n * Minimum wait time between retries (ms).\n * @default 1000\n */\n minTimeout?: number;\n\n /**\n * Maximum wait time between retries (ms).\n * @default 60000\n */\n maxTimeout?: number;\n\n /**\n * Add randomness to wait times (jitter).\n * Helps avoid thundering herd problem.\n * @default true\n */\n randomize?: boolean;\n\n /**\n * Callback called on each failed attempt.\n */\n onFailedAttempt?: (info: FailedAttemptInfo) => void;\n}\n\n/**\n * Default retry configuration.\n */\nexport const DEFAULT_RETRY_CONFIG: Required<RetryConfig> = {\n retries: 3,\n factor: 2,\n minTimeout: 1000,\n maxTimeout: 60000,\n randomize: true,\n onFailedAttempt: () => {},\n};\n\n/**\n * Determine if an error should trigger a retry.\n *\n * Retries on:\n * - Network errors (connection refused, timeout, etc.)\n * - Server errors (5xx status codes)\n * - Rate limiting (429 status code)\n *\n * Does NOT retry on:\n * - Client errors (4xx except 429)\n * - Authentication errors (401, 403)\n * - Not found (404)\n *\n * @param error - The error to check\n * @returns true if should retry, false otherwise\n */\nexport function shouldRetry(error: any): boolean {\n // Always retry network errors\n if (error instanceof NetworkError) {\n return true;\n }\n\n // For API errors, check status code\n if (error instanceof APIError) {\n const status = error.statusCode;\n\n // Retry on 5xx server errors\n if (status >= 500 && status < 600) {\n return true;\n }\n\n // Retry on 429 (rate limit)\n if (status === 429) {\n return true;\n }\n\n // Do NOT retry on 4xx client errors\n return false;\n }\n\n // Retry on unknown errors (might be network issues)\n return true;\n}\n\n/**\n * Wrap a function with retry logic.\n *\n * @param fn - Async function to retry\n * @param config - Retry configuration\n * @returns Result of the function\n *\n * @example\n * ```typescript\n * const result = await withRetry(\n * async () => fetch('https://api.example.com/users'),\n * { retries: 5, minTimeout: 2000 }\n * );\n * ```\n */\nexport async function withRetry<T>(\n fn: () => Promise<T>,\n config?: RetryConfig\n): Promise<T> {\n const finalConfig = { ...DEFAULT_RETRY_CONFIG, ...config };\n\n return pRetry(\n async () => {\n try {\n return await fn();\n } catch (error) {\n // Check if we should retry this error\n if (!shouldRetry(error)) {\n // Abort retry immediately for non-retryable errors\n throw new AbortError(error as Error);\n }\n\n // Re-throw error to trigger retry\n throw error;\n }\n },\n {\n retries: finalConfig.retries,\n factor: finalConfig.factor,\n minTimeout: finalConfig.minTimeout,\n maxTimeout: finalConfig.maxTimeout,\n randomize: finalConfig.randomize,\n onFailedAttempt: finalConfig.onFailedAttempt ? (error) => {\n // Adapt p-retry's FailedAttemptError to our FailedAttemptInfo\n const pRetryError = error as any; // p-retry's internal type\n finalConfig.onFailedAttempt!({\n error: pRetryError as Error,\n attemptNumber: pRetryError.attemptNumber,\n retriesLeft: pRetryError.retriesLeft,\n });\n } : undefined,\n }\n );\n}","import { CentrifugoAdminApi } from \"./centrifugo__centrifugo_admin_api\";\nimport { CentrifugoAuth } from \"./centrifugo__centrifugo_auth\";\nimport { CentrifugoMonitoring } from \"./centrifugo__centrifugo_monitoring\";\nimport { CentrifugoTesting } from \"./centrifugo__centrifugo_testing\";\nimport { HttpClientAdapter, FetchAdapter } from \"./http\";\nimport { APIError, NetworkError } from \"./errors\";\nimport { APILogger, type LoggerConfig } from \"./logger\";\nimport { withRetry, type RetryConfig } from \"./retry\";\n\n\n/**\n * Async API client for Django CFG API.\n *\n * Usage:\n * ```typescript\n * const client = new APIClient('https://api.example.com');\n * const users = await client.users.list();\n * const post = await client.posts.create(newPost);\n *\n * // Custom HTTP adapter (e.g., Axios)\n * const client = new APIClient('https://api.example.com', {\n * httpClient: new AxiosAdapter()\n * });\n * ```\n */\nexport class APIClient {\n private baseUrl: string;\n private httpClient: HttpClientAdapter;\n private logger: APILogger | null = null;\n private retryConfig: RetryConfig | null = null;\n\n // Sub-clients\n public centrifugo_admin_api: CentrifugoAdminApi;\n public centrifugo_auth: CentrifugoAuth;\n public centrifugo_monitoring: CentrifugoMonitoring;\n public centrifugo_testing: CentrifugoTesting;\n\n constructor(\n baseUrl: string,\n options?: {\n httpClient?: HttpClientAdapter;\n loggerConfig?: Partial<LoggerConfig>;\n retryConfig?: RetryConfig;\n }\n ) {\n this.baseUrl = baseUrl.replace(/\\/$/, '');\n this.httpClient = options?.httpClient || new FetchAdapter();\n\n // Initialize logger if config provided\n if (options?.loggerConfig !== undefined) {\n this.logger = new APILogger(options.loggerConfig);\n }\n\n // Store retry configuration\n if (options?.retryConfig !== undefined) {\n this.retryConfig = options.retryConfig;\n }\n\n // Initialize sub-clients\n this.centrifugo_admin_api = new CentrifugoAdminApi(this);\n this.centrifugo_auth = new CentrifugoAuth(this);\n this.centrifugo_monitoring = new CentrifugoMonitoring(this);\n this.centrifugo_testing = new CentrifugoTesting(this);\n }\n\n /**\n * Get CSRF token from cookies (for SessionAuthentication).\n *\n * Returns null if cookie doesn't exist (JWT-only auth).\n */\n getCsrfToken(): string | null {\n const name = 'csrftoken';\n const value = `; ${document.cookie}`;\n const parts = value.split(`; ${name}=`);\n if (parts.length === 2) {\n return parts.pop()?.split(';').shift() || null;\n }\n return null;\n }\n\n /**\n * Make HTTP request with Django CSRF and session handling.\n * Automatically retries on network errors and 5xx server errors.\n */\n async request<T>(\n method: string,\n path: string,\n options?: {\n params?: Record<string, any>;\n body?: any;\n formData?: FormData;\n headers?: Record<string, string>;\n }\n ): Promise<T> {\n // Wrap request in retry logic if configured\n if (this.retryConfig) {\n return withRetry(() => this._makeRequest<T>(method, path, options), {\n ...this.retryConfig,\n onFailedAttempt: (info) => {\n // Log retry attempts\n if (this.logger) {\n this.logger.warn(\n `Retry attempt ${info.attemptNumber}/${info.retriesLeft + info.attemptNumber} ` +\n `for ${method} ${path}: ${info.error.message}`\n );\n }\n // Call user's onFailedAttempt if provided\n this.retryConfig?.onFailedAttempt?.(info);\n },\n });\n }\n\n // No retry configured, make request directly\n return this._makeRequest<T>(method, path, options);\n }\n\n /**\n * Internal request method (without retry wrapper).\n * Used by request() method with optional retry logic.\n */\n private async _makeRequest<T>(\n method: string,\n path: string,\n options?: {\n params?: Record<string, any>;\n body?: any;\n formData?: FormData;\n headers?: Record<string, string>;\n }\n ): Promise<T> {\n // Build URL - handle both absolute and relative paths\n // When baseUrl is empty (static builds), path is used as-is (relative to current origin)\n const url = this.baseUrl ? `${this.baseUrl}${path}` : path;\n const startTime = Date.now();\n\n // Build headers - start with custom headers from options\n const headers: Record<string, string> = {\n ...(options?.headers || {})\n };\n\n // Don't set Content-Type for FormData (browser will set it with boundary)\n if (!options?.formData && !headers['Content-Type']) {\n headers['Content-Type'] = 'application/json';\n }\n\n // CSRF not needed - SessionAuthentication not enabled in DRF config\n // Your API uses JWT/Token authentication (no CSRF required)\n\n // Log request\n if (this.logger) {\n this.logger.logRequest({\n method,\n url: url,\n headers,\n body: options?.formData || options?.body,\n timestamp: startTime,\n });\n }\n\n try {\n // Make request via HTTP adapter\n const response = await this.httpClient.request<T>({\n method,\n url: url,\n headers,\n params: options?.params,\n body: options?.body,\n formData: options?.formData,\n });\n\n const duration = Date.now() - startTime;\n\n // Check for HTTP errors\n if (response.status >= 400) {\n const error = new APIError(\n response.status,\n response.statusText,\n response.data,\n url\n );\n\n // Log error\n if (this.logger) {\n this.logger.logError(\n {\n method,\n url: url,\n headers,\n body: options?.formData || options?.body,\n timestamp: startTime,\n },\n {\n message: error.message,\n statusCode: response.status,\n duration,\n timestamp: Date.now(),\n }\n );\n }\n\n throw error;\n }\n\n // Log successful response\n if (this.logger) {\n this.logger.logResponse(\n {\n method,\n url: url,\n headers,\n body: options?.formData || options?.body,\n timestamp: startTime,\n },\n {\n status: response.status,\n statusText: response.statusText,\n data: response.data,\n duration,\n timestamp: Date.now(),\n }\n );\n }\n\n return response.data as T;\n } catch (error) {\n const duration = Date.now() - startTime;\n\n // Re-throw APIError as-is\n if (error instanceof APIError) {\n throw error;\n }\n\n // Detect CORS errors and dispatch event\n const isCORSError = error instanceof TypeError &&\n (error.message.toLowerCase().includes('cors') ||\n error.message.toLowerCase().includes('failed to fetch') ||\n error.message.toLowerCase().includes('network request failed'));\n\n // Log specific error type first\n if (this.logger) {\n if (isCORSError) {\n this.logger.error(`🚫 CORS Error: ${method} ${url}`);\n this.logger.error(` → ${error instanceof Error ? error.message : String(error)}`);\n this.logger.error(` → Configure security_domains parameter on the server`);\n } else {\n this.logger.error(`⚠️ Network Error: ${method} ${url}`);\n this.logger.error(` → ${error instanceof Error ? error.message : String(error)}`);\n }\n }\n\n // Dispatch browser events\n if (typeof window !== 'undefined') {\n try {\n if (isCORSError) {\n // Dispatch CORS-specific error event\n window.dispatchEvent(new CustomEvent('cors-error', {\n detail: {\n url: url,\n method: method,\n error: error instanceof Error ? error.message : String(error),\n timestamp: new Date(),\n },\n bubbles: true,\n cancelable: false,\n }));\n } else {\n // Dispatch generic network error event\n window.dispatchEvent(new CustomEvent('network-error', {\n detail: {\n url: url,\n method: method,\n error: error instanceof Error ? error.message : String(error),\n timestamp: new Date(),\n },\n bubbles: true,\n cancelable: false,\n }));\n }\n } catch (eventError) {\n // Silently fail - event dispatch should never crash the app\n }\n }\n\n // Wrap other errors as NetworkError\n const networkError = error instanceof Error\n ? new NetworkError(error.message, url, error)\n : new NetworkError('Unknown error', url);\n\n // Detailed logging via logger.logError\n if (this.logger) {\n this.logger.logError(\n {\n method,\n url: url,\n headers,\n body: options?.formData || options?.body,\n timestamp: startTime,\n },\n {\n message: networkError.message,\n duration,\n timestamp: Date.now(),\n }\n );\n }\n\n throw networkError;\n }\n }\n}\n","// Auto-generated by DjangoCFG - see CLAUDE.md\n/**\n * Storage adapters for cross-platform token storage.\n *\n * Supports:\n * - LocalStorage (browser)\n * - Cookies (SSR/browser)\n * - Memory (Node.js/Electron/testing)\n */\n\nimport type { APILogger } from './logger';\n\n/**\n * Storage adapter interface for cross-platform token storage.\n */\nexport interface StorageAdapter {\n getItem(key: string): string | null;\n setItem(key: string, value: string): void;\n removeItem(key: string): void;\n}\n\n/**\n * LocalStorage adapter with safe try-catch for browser environments.\n * Works in modern browsers with localStorage support.\n * \n * Note: This adapter uses window.localStorage and should only be used in browser/client environments.\n * For server-side usage, use MemoryStorageAdapter or CookieStorageAdapter instead.\n */\nexport class LocalStorageAdapter implements StorageAdapter {\n private logger?: APILogger;\n\n constructor(logger?: APILogger) {\n this.logger = logger;\n }\n\n getItem(key: string): string | null {\n try {\n if (typeof window !== 'undefined' && window.localStorage) {\n const value = localStorage.getItem(key);\n this.logger?.debug(`LocalStorage.getItem(\"${key}\"): ${value ? 'found' : 'not found'}`);\n return value;\n }\n this.logger?.warn('LocalStorage not available: window.localStorage is undefined');\n } catch (error) {\n this.logger?.error('LocalStorage.getItem failed:', error);\n }\n return null;\n }\n\n setItem(key: string, value: string): void {\n try {\n if (typeof window !== 'undefined' && window.localStorage) {\n localStorage.setItem(key, value);\n this.logger?.debug(`LocalStorage.setItem(\"${key}\"): success`);\n } else {\n this.logger?.warn('LocalStorage not available: window.localStorage is undefined');\n }\n } catch (error) {\n this.logger?.error('LocalStorage.setItem failed:', error);\n }\n }\n\n removeItem(key: string): void {\n try {\n if (typeof window !== 'undefined' && window.localStorage) {\n localStorage.removeItem(key);\n this.logger?.debug(`LocalStorage.removeItem(\"${key}\"): success`);\n } else {\n this.logger?.warn('LocalStorage not available: window.localStorage is undefined');\n }\n } catch (error) {\n this.logger?.error('LocalStorage.removeItem failed:', error);\n }\n }\n}\n\n/**\n * Cookie-based storage adapter for SSR and browser environments.\n * Useful for Next.js, Nuxt.js, and other SSR frameworks.\n */\nexport class CookieStorageAdapter implements StorageAdapter {\n private logger?: APILogger;\n\n constructor(logger?: APILogger) {\n this.logger = logger;\n }\n\n getItem(key: string): string | null {\n try {\n if (typeof document === 'undefined') {\n this.logger?.warn('Cookies not available: document is undefined (SSR context?)');\n return null;\n }\n const value = `; ${document.cookie}`;\n const parts = value.split(`; ${key}=`);\n if (parts.length === 2) {\n const result = parts.pop()?.split(';').shift() || null;\n this.logger?.debug(`CookieStorage.getItem(\"${key}\"): ${result ? 'found' : 'not found'}`);\n return result;\n }\n this.logger?.debug(`CookieStorage.getItem(\"${key}\"): not found`);\n } catch (error) {\n this.logger?.error('CookieStorage.getItem failed:', error);\n }\n return null;\n }\n\n setItem(key: string, value: string): void {\n try {\n if (typeof document !== 'undefined') {\n document.cookie = `${key}=${value}; path=/; max-age=31536000`;\n this.logger?.debug(`CookieStorage.setItem(\"${key}\"): success`);\n } else {\n this.logger?.warn('Cookies not available: document is undefined (SSR context?)');\n }\n } catch (error) {\n this.logger?.error('CookieStorage.setItem failed:', error);\n }\n }\n\n removeItem(key: string): void {\n try {\n if (typeof document !== 'undefined') {\n document.cookie = `${key}=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT`;\n this.logger?.debug(`CookieStorage.removeItem(\"${key}\"): success`);\n } else {\n this.logger?.warn('Cookies not available: document is undefined (SSR context?)');\n }\n } catch (error) {\n this.logger?.error('CookieStorage.removeItem failed:', error);\n }\n }\n}\n\n/**\n * In-memory storage adapter for Node.js, Electron, and testing environments.\n * Data is stored in RAM and cleared when process exits.\n */\nexport class MemoryStorageAdapter implements StorageAdapter {\n private storage: Map<string, string> = new Map();\n private logger?: APILogger;\n\n constructor(logger?: APILogger) {\n this.logger = logger;\n }\n\n getItem(key: string): string | null {\n const value = this.storage.get(key) || null;\n this.logger?.debug(`MemoryStorage.getItem(\"${key}\"): ${value ? 'found' : 'not found'}`);\n return value;\n }\n\n setItem(key: string, value: string): void {\n this.storage.set(key, value);\n this.logger?.debug(`MemoryStorage.setItem(\"${key}\"): success`);\n }\n\n removeItem(key: string): void {\n this.storage.delete(key);\n this.logger?.debug(`MemoryStorage.removeItem(\"${key}\"): success`);\n }\n}","/**\n * Zod schema for CentrifugoChannelInfo\n *\n * This schema provides runtime validation and type inference.\n * * Information about a single channel.\n * */\nimport { z } from 'zod'\n\n/**\n * Information about a single channel.\n */\nexport const CentrifugoChannelInfoSchema = z.object({\n num_clients: z.int(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type CentrifugoChannelInfo = z.infer<typeof CentrifugoChannelInfoSchema>","/**\n * Zod schema for CentrifugoChannelsRequestRequest\n *\n * This schema provides runtime validation and type inference.\n * * Request to list active channels.\n * */\nimport { z } from 'zod'\n\n/**\n * Request to list active channels.\n */\nexport const CentrifugoChannelsRequestRequestSchema = z.object({\n pattern: z.string().nullable().optional(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type CentrifugoChannelsRequestRequest = z.infer<typeof CentrifugoChannelsRequestRequestSchema>","/**\n * Zod schema for CentrifugoChannelsResponse\n *\n * This schema provides runtime validation and type inference.\n * * List of active channels response.\n * */\nimport { z } from 'zod'\nimport { CentrifugoChannelsResultSchema } from './CentrifugoChannelsResult.schema'\nimport { CentrifugoErrorSchema } from './CentrifugoError.schema'\n\n/**\n * List of active channels response.\n */\nexport const CentrifugoChannelsResponseSchema = z.object({\n error: CentrifugoErrorSchema.optional(),\n result: CentrifugoChannelsResultSchema.optional(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type CentrifugoChannelsResponse = z.infer<typeof CentrifugoChannelsResponseSchema>","/**\n * Zod schema for CentrifugoChannelsResult\n *\n * This schema provides runtime validation and type inference.\n * * Channels result wrapper.\n * */\nimport { z } from 'zod'\nimport { CentrifugoChannelInfoSchema } from './CentrifugoChannelInfo.schema'\n\n/**\n * Channels result wrapper.\n */\nexport const CentrifugoChannelsResultSchema = z.object({\n channels: z.record(z.string(), CentrifugoChannelInfoSchema),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type CentrifugoChannelsResult = z.infer<typeof CentrifugoChannelsResultSchema>","/**\n * Zod schema for CentrifugoError\n *\n * This schema provides runtime validation and type inference.\n * * Centrifugo API error structure.\n * */\nimport { z } from 'zod'\n\n/**\n * Centrifugo API error structure.\n */\nexport const CentrifugoErrorSchema = z.object({\n code: z.int().optional(),\n message: z.string().optional(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type CentrifugoError = z.infer<typeof CentrifugoErrorSchema>","/**\n * Zod schema for CentrifugoClientInfo\n *\n * This schema provides runtime validation and type inference.\n * * Information about connected client.\n * */\nimport { z } from 'zod'\n\n/**\n * Information about connected client.\n */\nexport const CentrifugoClientInfoSchema = z.object({\n user: z.string(),\n client: z.string(),\n conn_info: z.record(z.string(), z.any()).nullable().optional(),\n chan_info: z.record(z.string(), z.any()).nullable().optional(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type CentrifugoClientInfo = z.infer<typeof CentrifugoClientInfoSchema>","/**\n * Zod schema for CentrifugoHealthCheck\n *\n * This schema provides runtime validation and type inference.\n * * Health check response.\n * */\nimport { z } from 'zod'\n\n/**\n * Health check response.\n */\nexport const CentrifugoHealthCheckSchema = z.object({\n status: z.string(),\n wrapper_url: z.string(),\n has_api_key: z.boolean(),\n timestamp: z.string(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type CentrifugoHealthCheck = z.infer<typeof CentrifugoHealthCheckSchema>","/**\n * Zod schema for CentrifugoHistoryRequestRequest\n *\n * This schema provides runtime validation and type inference.\n * * Request to get channel history.\n * */\nimport { z } from 'zod'\nimport { CentrifugoStreamPositionSchema } from './CentrifugoStreamPosition.schema'\n\n/**\n * Request to get channel history.\n */\nexport const CentrifugoHistoryRequestRequestSchema = z.object({\n channel: z.string(),\n limit: z.int().nullable().optional(),\n since: CentrifugoStreamPositionSchema.optional(),\n reverse: z.boolean().nullable().optional(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type CentrifugoHistoryRequestRequest = z.infer<typeof CentrifugoHistoryRequestRequestSchema>","/**\n * Zod schema for CentrifugoStreamPosition\n *\n * This schema provides runtime validation and type inference.\n * * Stream position for pagination.\n * */\nimport { z } from 'zod'\n\n/**\n * Stream position for pagination.\n */\nexport const CentrifugoStreamPositionSchema = z.object({\n offset: z.int(),\n epoch: z.string(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type CentrifugoStreamPosition = z.infer<typeof CentrifugoStreamPositionSchema>","/**\n * Zod schema for CentrifugoHistoryResponse\n *\n * This schema provides runtime validation and type inference.\n * * Channel history response.\n * */\nimport { z } from 'zod'\nimport { CentrifugoErrorSchema } from './CentrifugoError.schema'\nimport { CentrifugoHistoryResultSchema } from './CentrifugoHistoryResult.schema'\n\n/**\n * Channel history response.\n */\nexport const CentrifugoHistoryResponseSchema = z.object({\n error: CentrifugoErrorSchema.optional(),\n result: CentrifugoHistoryResultSchema.optional(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type CentrifugoHistoryResponse = z.infer<typeof CentrifugoHistoryResponseSchema>","/**\n * Zod schema for CentrifugoHistoryResult\n *\n * This schema provides runtime validation and type inference.\n * * History result wrapper.\n * */\nimport { z } from 'zod'\nimport { CentrifugoPublicationSchema } from './CentrifugoPublication.schema'\n\n/**\n * History result wrapper.\n */\nexport const CentrifugoHistoryResultSchema = z.object({\n publications: z.array(CentrifugoPublicationSchema),\n epoch: z.string(),\n offset: z.int(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type CentrifugoHistoryResult = z.infer<typeof CentrifugoHistoryResultSchema>","/**\n * Zod schema for CentrifugoPublication\n *\n * This schema provides runtime validation and type inference.\n * * Single publication (message) in channel history.\n * */\nimport { z } from 'zod'\nimport { CentrifugoClientInfoSchema } from './CentrifugoClientInfo.schema'\n\n/**\n * Single publication (message) in channel history.\n */\nexport const CentrifugoPublicationSchema = z.object({\n data: z.record(z.string(), z.any()),\n info: CentrifugoClientInfoSchema.optional(),\n offset: z.int(),\n tags: z.record(z.string(), z.any()).nullable().optional(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type CentrifugoPublication = z.infer<typeof CentrifugoPublicationSchema>","/**\n * Zod schema for CentrifugoInfoResponse\n *\n * This schema provides runtime validation and type inference.\n * * Server info response.\n * */\nimport { z } from 'zod'\nimport { CentrifugoErrorSchema } from './CentrifugoError.schema'\nimport { CentrifugoInfoResultSchema } from './CentrifugoInfoResult.schema'\n\n/**\n * Server info response.\n */\nexport const CentrifugoInfoResponseSchema = z.object({\n error: CentrifugoErrorSchema.optional(),\n result: CentrifugoInfoResultSchema.optional(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type CentrifugoInfoResponse = z.infer<typeof CentrifugoInfoResponseSchema>","/**\n * Zod schema for CentrifugoInfoResult\n *\n * This schema provides runtime validation and type inference.\n * * Info result wrapper.\n * */\nimport { z } from 'zod'\nimport { CentrifugoNodeInfoSchema } from './CentrifugoNodeInfo.schema'\n\n/**\n * Info result wrapper.\n */\nexport const CentrifugoInfoResultSchema = z.object({\n nodes: z.array(CentrifugoNodeInfoSchema),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type CentrifugoInfoResult = z.infer<typeof CentrifugoInfoResultSchema>","/**\n * Zod schema for CentrifugoNodeInfo\n *\n * This schema provides runtime validation and type inference.\n * * Information about a single Centrifugo node.\n * */\nimport { z } from 'zod'\nimport { CentrifugoMetricsSchema } from './CentrifugoMetrics.schema'\nimport { CentrifugoProcessSchema } from './CentrifugoProcess.schema'\n\n/**\n * Information about a single Centrifugo node.\n */\nexport const CentrifugoNodeInfoSchema = z.object({\n uid: z.string(),\n name: z.string(),\n version: z.string(),\n num_clients: z.int(),\n num_users: z.int(),\n num_channels: z.int(),\n uptime: z.int(),\n num_subs: z.int(),\n metrics: CentrifugoMetricsSchema.optional(),\n process: CentrifugoProcessSchema.optional(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type CentrifugoNodeInfo = z.infer<typeof CentrifugoNodeInfoSchema>","/**\n * Zod schema for CentrifugoMetrics\n *\n * This schema provides runtime validation and type inference.\n * * Server metrics.\n * */\nimport { z } from 'zod'\n\n/**\n * Server metrics.\n */\nexport const CentrifugoMetricsSchema = z.object({\n interval: z.number(),\n items: z.record(z.string(), z.number()),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type CentrifugoMetrics = z.infer<typeof CentrifugoMetricsSchema>","/**\n * Zod schema for CentrifugoProcess\n *\n * This schema provides runtime validation and type inference.\n * * Process information.\n * */\nimport { z } from 'zod'\n\n/**\n * Process information.\n */\nexport const CentrifugoProcessSchema = z.object({\n cpu: z.number(),\n rss: z.int(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type CentrifugoProcess = z.infer<typeof CentrifugoProcessSchema>","/**\n * Zod schema for CentrifugoOverviewStats\n *\n * This schema provides runtime validation and type inference.\n * * Overview statistics for Centrifugo publishes.\n * */\nimport { z } from 'zod'\n\n/**\n * Overview statistics for Centrifugo publishes.\n */\nexport const CentrifugoOverviewStatsSchema = z.object({\n total: z.int(),\n successful: z.int(),\n failed: z.int(),\n timeout: z.int(),\n success_rate: z.number(),\n avg_duration_ms: z.number(),\n avg_acks_received: z.number(),\n period_hours: z.int(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type CentrifugoOverviewStats = z.infer<typeof CentrifugoOverviewStatsSchema>","/**\n * Zod schema for CentrifugoPresenceRequestRequest\n *\n * This schema provides runtime validation and type inference.\n * * Request to get channel presence.\n * */\nimport { z } from 'zod'\n\n/**\n * Request to get channel presence.\n */\nexport const CentrifugoPresenceRequestRequestSchema = z.object({\n channel: z.string(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type CentrifugoPresenceRequestRequest = z.infer<typeof CentrifugoPresenceRequestRequestSchema>","/**\n * Zod schema for CentrifugoPresenceResponse\n *\n * This schema provides runtime validation and type inference.\n * * Channel presence response.\n * */\nimport { z } from 'zod'\nimport { CentrifugoErrorSchema } from './CentrifugoError.schema'\nimport { CentrifugoPresenceResultSchema } from './CentrifugoPresenceResult.schema'\n\n/**\n * Channel presence response.\n */\nexport const CentrifugoPresenceResponseSchema = z.object({\n error: CentrifugoErrorSchema.optional(),\n result: CentrifugoPresenceResultSchema.optional(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type CentrifugoPresenceResponse = z.infer<typeof CentrifugoPresenceResponseSchema>","/**\n * Zod schema for CentrifugoPresenceResult\n *\n * This schema provides runtime validation and type inference.\n * * Presence result wrapper.\n * */\nimport { z } from 'zod'\nimport { CentrifugoClientInfoSchema } from './CentrifugoClientInfo.schema'\n\n/**\n * Presence result wrapper.\n */\nexport const CentrifugoPresenceResultSchema = z.object({\n presence: z.record(z.string(), CentrifugoClientInfoSchema),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type CentrifugoPresenceResult = z.infer<typeof CentrifugoPresenceResultSchema>","/**\n * Zod schema for CentrifugoPresenceStatsRequestRequest\n *\n * This schema provides runtime validation and type inference.\n * * Request to get channel presence statistics.\n * */\nimport { z } from 'zod'\n\n/**\n * Request to get channel presence statistics.\n */\nexport const CentrifugoPresenceStatsRequestRequestSchema = z.object({\n channel: z.string(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type CentrifugoPresenceStatsRequestRequest = z.infer<typeof CentrifugoPresenceStatsRequestRequestSchema>","/**\n * Zod schema for CentrifugoPresenceStatsResponse\n *\n * This schema provides runtime validation and type inference.\n * * Channel presence stats response.\n * */\nimport { z } from 'zod'\nimport { CentrifugoErrorSchema } from './CentrifugoError.schema'\nimport { CentrifugoPresenceStatsResultSchema } from './CentrifugoPresenceStatsResult.schema'\n\n/**\n * Channel presence stats response.\n */\nexport const CentrifugoPresenceStatsResponseSchema = z.object({\n error: CentrifugoErrorSchema.optional(),\n result: CentrifugoPresenceStatsResultSchema.optional(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type CentrifugoPresenceStatsResponse = z.infer<typeof CentrifugoPresenceStatsResponseSchema>","/**\n * Zod schema for CentrifugoPresenceStatsResult\n *\n * This schema provides runtime validation and type inference.\n * * Presence stats result.\n * */\nimport { z } from 'zod'\n\n/**\n * Presence stats result.\n */\nexport const CentrifugoPresenceStatsResultSchema = z.object({\n num_clients: z.int(),\n num_users: z.int(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type CentrifugoPresenceStatsResult = z.infer<typeof CentrifugoPresenceStatsResultSchema>","/**\n * Zod schema for ChannelList\n *\n * This schema provides runtime validation and type inference.\n * * List of channel statistics.\n * */\nimport { z } from 'zod'\nimport { ChannelStatsSchema } from './ChannelStats.schema'\n\n/**\n * List of channel statistics.\n */\nexport const ChannelListSchema = z.object({\n channels: z.array(ChannelStatsSchema),\n total_channels: z.int(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type ChannelList = z.infer<typeof ChannelListSchema>","/**\n * Zod schema for ChannelStats\n *\n * This schema provides runtime validation and type inference.\n * * Statistics per channel.\n * */\nimport { z } from 'zod'\n\n/**\n * Statistics per channel.\n */\nexport const ChannelStatsSchema = z.object({\n channel: z.string(),\n total: z.int(),\n successful: z.int(),\n failed: z.int(),\n avg_duration_ms: z.number(),\n avg_acks: z.number(),\n last_activity_at: z.string().nullable(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type ChannelStats = z.infer<typeof ChannelStatsSchema>","/**\n * Zod schema for ConnectionTokenResponse\n *\n * This schema provides runtime validation and type inference.\n * * Response model for Centrifugo connection token.\n * */\nimport { z } from 'zod'\n\n/**\n * Response model for Centrifugo connection token.\n */\nexport const ConnectionTokenResponseSchema = z.object({\n token: z.string(),\n centrifugo_url: z.string(),\n expires_at: z.string(),\n channels: z.array(z.string()),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type ConnectionTokenResponse = z.infer<typeof ConnectionTokenResponseSchema>","/**\n * Zod schema for ManualAckRequestRequest\n *\n * This schema provides runtime validation and type inference.\n * * Request model for manual ACK sending.\n * */\nimport { z } from 'zod'\n\n/**\n * Request model for manual ACK sending.\n */\nexport const ManualAckRequestRequestSchema = z.object({\n message_id: z.string(),\n client_id: z.string(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type ManualAckRequestRequest = z.infer<typeof ManualAckRequestRequestSchema>","/**\n * Zod schema for ManualAckResponse\n *\n * This schema provides runtime validation and type inference.\n * * Response model for manual ACK.\n * */\nimport { z } from 'zod'\n\n/**\n * Response model for manual ACK.\n */\nexport const ManualAckResponseSchema = z.object({\n success: z.boolean(),\n message_id: z.string(),\n error: z.string().nullable().optional(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type ManualAckResponse = z.infer<typeof ManualAckResponseSchema>","/**\n * Zod schema for PaginatedPublishList\n *\n * This schema provides runtime validation and type inference.\n * */\nimport { z } from 'zod'\nimport { PublishSchema } from './Publish.schema'\n\nexport const PaginatedPublishListSchema = z.object({\n count: z.int(),\n page: z.int(),\n pages: z.int(),\n page_size: z.int(),\n has_next: z.boolean(),\n has_previous: z.boolean(),\n next_page: z.int().nullable().optional(),\n previous_page: z.int().nullable().optional(),\n results: z.array(PublishSchema),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type PaginatedPublishList = z.infer<typeof PaginatedPublishListSchema>","/**\n * Zod schema for Publish\n *\n * This schema provides runtime validation and type inference.\n * * Single publish item for DRF pagination.\n * */\nimport { z } from 'zod'\n\n/**\n * Single publish item for DRF pagination.\n */\nexport const PublishSchema = z.object({\n message_id: z.string(),\n channel: z.string(),\n status: z.string(),\n wait_for_ack: z.boolean(),\n acks_received: z.int(),\n acks_expected: z.int().nullable(),\n duration_ms: z.number().nullable(),\n created_at: z.iso.datetime(),\n completed_at: z.iso.datetime().nullable(),\n error_code: z.string().nullable(),\n error_message: z.string().nullable(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type Publish = z.infer<typeof PublishSchema>","/**\n * Zod schema for PublishTestRequestRequest\n *\n * This schema provides runtime validation and type inference.\n * * Request model for test message publishing.\n * */\nimport { z } from 'zod'\n\n/**\n * Request model for test message publishing.\n */\nexport const PublishTestRequestRequestSchema = z.object({\n channel: z.string(),\n data: z.record(z.string(), z.any()),\n wait_for_ack: z.boolean().optional(),\n ack_timeout: z.int().min(1.0).max(60.0).optional(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type PublishTestRequestRequest = z.infer<typeof PublishTestRequestRequestSchema>","/**\n * Zod schema for PublishTestResponse\n *\n * This schema provides runtime validation and type inference.\n * * Response model for test message publishing.\n * */\nimport { z } from 'zod'\n\n/**\n * Response model for test message publishing.\n */\nexport const PublishTestResponseSchema = z.object({\n success: z.boolean(),\n message_id: z.string(),\n channel: z.string(),\n acks_received: z.int().optional(),\n delivered: z.boolean().optional(),\n error: z.string().nullable().optional(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type PublishTestResponse = z.infer<typeof PublishTestResponseSchema>","/**\n * Zod schema for TimelineItem\n *\n * This schema provides runtime validation and type inference.\n * * Single timeline data point for DRF.\n * */\nimport { z } from 'zod'\n\n/**\n * Single timeline data point for DRF.\n */\nexport const TimelineItemSchema = z.object({\n timestamp: z.string(),\n count: z.int(),\n successful: z.int(),\n failed: z.int(),\n timeout: z.int(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type TimelineItem = z.infer<typeof TimelineItemSchema>","/**\n * Zod schema for TimelineResponse\n *\n * This schema provides runtime validation and type inference.\n * * Timeline response with hourly/daily breakdown for DRF.\n * */\nimport { z } from 'zod'\nimport { TimelineItemSchema } from './TimelineItem.schema'\n\n/**\n * Timeline response with hourly/daily breakdown for DRF.\n */\nexport const TimelineResponseSchema = z.object({\n timeline: z.array(TimelineItemSchema),\n period_hours: z.int(),\n interval: z.string(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type TimelineResponse = z.infer<typeof TimelineResponseSchema>","// Auto-generated by DjangoCFG - see CLAUDE.md\n/**\n * Typed fetchers for Centrifugo Admin API\n *\n * Universal functions that work in any environment:\n * - Next.js (App Router / Pages Router / Server Components)\n * - React Native\n * - Node.js backend\n *\n * These fetchers use Zod schemas for runtime validation.\n *\n * Usage:\n * ```typescript\n * // Configure API once (in your app entry point)\n * import { configureAPI } from '../../api-instance'\n * configureAPI({ baseUrl: 'https://api.example.com' })\n *\n * // Then use fetchers anywhere\n * const users = await getUsers({ page: 1 })\n *\n * // With SWR\n * const { data } = useSWR(['users', params], () => getUsers(params))\n *\n * // With React Query\n * const { data } = useQuery(['users', params], () => getUsers(params))\n *\n * // In Server Component or SSR (pass custom client)\n * import { API } from '../../index'\n * const api = new API('https://api.example.com')\n * const users = await getUsers({ page: 1 }, api)\n * ```\n */\nimport { consola } from 'consola'\nimport { CentrifugoChannelsRequestRequestSchema, type CentrifugoChannelsRequestRequest } from '../schemas/CentrifugoChannelsRequestRequest.schema'\nimport { CentrifugoChannelsResponseSchema, type CentrifugoChannelsResponse } from '../schemas/CentrifugoChannelsResponse.schema'\nimport { CentrifugoHistoryRequestRequestSchema, type CentrifugoHistoryRequestRequest } from '../schemas/CentrifugoHistoryRequestRequest.schema'\nimport { CentrifugoHistoryResponseSchema, type CentrifugoHistoryResponse } from '../schemas/CentrifugoHistoryResponse.schema'\nimport { CentrifugoInfoResponseSchema, type CentrifugoInfoResponse } from '../schemas/CentrifugoInfoResponse.schema'\nimport { CentrifugoPresenceRequestRequestSchema, type CentrifugoPresenceRequestRequest } from '../schemas/CentrifugoPresenceRequestRequest.schema'\nimport { CentrifugoPresenceResponseSchema, type CentrifugoPresenceResponse } from '../schemas/CentrifugoPresenceResponse.schema'\nimport { CentrifugoPresenceStatsRequestRequestSchema, type CentrifugoPresenceStatsRequestRequest } from '../schemas/CentrifugoPresenceStatsRequestRequest.schema'\nimport { CentrifugoPresenceStatsResponseSchema, type CentrifugoPresenceStatsResponse } from '../schemas/CentrifugoPresenceStatsResponse.schema'\nimport { getAPIInstance } from '../../api-instance'\n\n/**\n * Get connection token for dashboard\n *\n * @method POST\n * @path /cfg/centrifugo/server/auth/token/\n */\nexport async function createCentrifugoServerAuthTokenCreate( client?: any\n): Promise<any> {\n const api = client || getAPIInstance()\n const response = await api.centrifugo_admin_api.centrifugoServerAuthTokenCreate()\n return response\n}\n\n\n/**\n * List active channels\n *\n * @method POST\n * @path /cfg/centrifugo/server/channels/\n */\nexport async function createCentrifugoServerChannelsCreate( data: CentrifugoChannelsRequestRequest, client?: any\n): Promise<CentrifugoChannelsResponse> {\n const api = client || getAPIInstance()\n const response = await api.centrifugo_admin_api.centrifugoServerChannelsCreate(data)\n try {\n return CentrifugoChannelsResponseSchema.parse(response)\n } catch (error) {\n // Zod validation error - log detailed information\n consola.error('❌ Zod Validation Failed');\n consola.box(`createCentrifugoServerChannelsCreate\\nPath: /cfg/centrifugo/server/channels/\\nMethod: POST`);\n\n if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {\n consola.error('Validation Issues:');\n (error as any).issues.forEach((issue: any, index: number) => {\n consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);\n consola.error(` ├─ Message: ${issue.message}`);\n if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);\n if (issue.received) consola.error(` └─ Received: ${issue.received}`);\n });\n }\n\n consola.error('Response data:', response);\n\n // Dispatch browser CustomEvent (only if window is defined)\n if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {\n try {\n const event = new CustomEvent('zod-validation-error', {\n detail: {\n operation: 'createCentrifugoServerChannelsCreate',\n path: '/cfg/centrifugo/server/channels/',\n method: 'POST',\n error: error,\n response: response,\n timestamp: new Date(),\n },\n bubbles: true,\n cancelable: false,\n });\n window.dispatchEvent(event);\n } catch (eventError) {\n // Silently fail - event dispatch should never crash the app\n consola.warn('Failed to dispatch validation error event:', eventError);\n }\n }\n\n // Re-throw the error\n throw error;\n }\n}\n\n\n/**\n * Get channel history\n *\n * @method POST\n * @path /cfg/centrifugo/server/history/\n */\nexport async function createCentrifugoServerHistoryCreate( data: CentrifugoHistoryRequestRequest, client?: any\n): Promise<CentrifugoHistoryResponse> {\n const api = client || getAPIInstance()\n const response = await api.centrifugo_admin_api.centrifugoServerHistoryCreate(data)\n try {\n return CentrifugoHistoryResponseSchema.parse(response)\n } catch (error) {\n // Zod validation error - log detailed information\n consola.error('❌ Zod Validation Failed');\n consola.box(`createCentrifugoServerHistoryCreate\\nPath: /cfg/centrifugo/server/history/\\nMethod: POST`);\n\n if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {\n consola.error('Validation Issues:');\n (error as any).issues.forEach((issue: any, index: number) => {\n consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);\n consola.error(` ├─ Message: ${issue.message}`);\n if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);\n if (issue.received) consola.error(` └─ Received: ${issue.received}`);\n });\n }\n\n consola.error('Response data:', response);\n\n // Dispatch browser CustomEvent (only if window is defined)\n if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {\n try {\n const event = new CustomEvent('zod-validation-error', {\n detail: {\n operation: 'createCentrifugoServerHistoryCreate',\n path: '/cfg/centrifugo/server/history/',\n method: 'POST',\n error: error,\n response: response,\n timestamp: new Date(),\n },\n bubbles: true,\n cancelable: false,\n });\n window.dispatchEvent(event);\n } catch (eventError) {\n // Silently fail - event dispatch should never crash the app\n consola.warn('Failed to dispatch validation error event:', eventError);\n }\n }\n\n // Re-throw the error\n throw error;\n }\n}\n\n\n/**\n * Get Centrifugo server info\n *\n * @method POST\n * @path /cfg/centrifugo/server/info/\n */\nexport async function createCentrifugoServerInfoCreate( client?: any\n): Promise<CentrifugoInfoResponse> {\n const api = client || getAPIInstance()\n const response = await api.centrifugo_admin_api.centrifugoServerInfoCreate()\n try {\n return CentrifugoInfoResponseSchema.parse(response)\n } catch (error) {\n // Zod validation error - log detailed information\n consola.error('❌ Zod Validation Failed');\n consola.box(`createCentrifugoServerInfoCreate\\nPath: /cfg/centrifugo/server/info/\\nMethod: POST`);\n\n if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {\n consola.error('Validation Issues:');\n (error as any).issues.forEach((issue: any, index: number) => {\n consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);\n consola.error(` ├─ Message: ${issue.message}`);\n if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);\n if (issue.received) consola.error(` └─ Received: ${issue.received}`);\n });\n }\n\n consola.error('Response data:', response);\n\n // Dispatch browser CustomEvent (only if window is defined)\n if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {\n try {\n const event = new CustomEvent('zod-validation-error', {\n detail: {\n operation: 'createCentrifugoServerInfoCreate',\n path: '/cfg/centrifugo/server/info/',\n method: 'POST',\n error: error,\n response: response,\n timestamp: new Date(),\n },\n bubbles: true,\n cancelable: false,\n });\n window.dispatchEvent(event);\n } catch (eventError) {\n // Silently fail - event dispatch should never crash the app\n consola.warn('Failed to dispatch validation error event:', eventError);\n }\n }\n\n // Re-throw the error\n throw error;\n }\n}\n\n\n/**\n * Get channel presence\n *\n * @method POST\n * @path /cfg/centrifugo/server/presence/\n */\nexport async function createCentrifugoServerPresenceCreate( data: CentrifugoPresenceRequestRequest, client?: any\n): Promise<CentrifugoPresenceResponse> {\n const api = client || getAPIInstance()\n const response = await api.centrifugo_admin_api.centrifugoServerPresenceCreate(data)\n try {\n return CentrifugoPresenceResponseSchema.parse(response)\n } catch (error) {\n // Zod validation error - log detailed information\n consola.error('❌ Zod Validation Failed');\n consola.box(`createCentrifugoServerPresenceCreate\\nPath: /cfg/centrifugo/server/presence/\\nMethod: POST`);\n\n if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {\n consola.error('Validation Issues:');\n (error as any).issues.forEach((issue: any, index: number) => {\n consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);\n consola.error(` ├─ Message: ${issue.message}`);\n if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);\n if (issue.received) consola.error(` └─ Received: ${issue.received}`);\n });\n }\n\n consola.error('Response data:', response);\n\n // Dispatch browser CustomEvent (only if window is defined)\n if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {\n try {\n const event = new CustomEvent('zod-validation-error', {\n detail: {\n operation: 'createCentrifugoServerPresenceCreate',\n path: '/cfg/centrifugo/server/presence/',\n method: 'POST',\n error: error,\n response: response,\n timestamp: new Date(),\n },\n bubbles: true,\n cancelable: false,\n });\n window.dispatchEvent(event);\n } catch (eventError) {\n // Silently fail - event dispatch should never crash the app\n consola.warn('Failed to dispatch validation error event:', eventError);\n }\n }\n\n // Re-throw the error\n throw error;\n }\n}\n\n\n/**\n * Get channel presence statistics\n *\n * @method POST\n * @path /cfg/centrifugo/server/presence-stats/\n */\nexport async function createCentrifugoServerPresenceStatsCreate( data: CentrifugoPresenceStatsRequestRequest, client?: any\n): Promise<CentrifugoPresenceStatsResponse> {\n const api = client || getAPIInstance()\n const response = await api.centrifugo_admin_api.centrifugoServerPresenceStatsCreate(data)\n try {\n return CentrifugoPresenceStatsResponseSchema.parse(response)\n } catch (error) {\n // Zod validation error - log detailed information\n consola.error('❌ Zod Validation Failed');\n consola.box(`createCentrifugoServerPresenceStatsCreate\\nPath: /cfg/centrifugo/server/presence-stats/\\nMethod: POST`);\n\n if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {\n consola.error('Validation Issues:');\n (error as any).issues.forEach((issue: any, index: number) => {\n consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);\n consola.error(` ├─ Message: ${issue.message}`);\n if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);\n if (issue.received) consola.error(` └─ Received: ${issue.received}`);\n });\n }\n\n consola.error('Response data:', response);\n\n // Dispatch browser CustomEvent (only if window is defined)\n if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {\n try {\n const event = new CustomEvent('zod-validation-error', {\n detail: {\n operation: 'createCentrifugoServerPresenceStatsCreate',\n path: '/cfg/centrifugo/server/presence-stats/',\n method: 'POST',\n error: error,\n response: response,\n timestamp: new Date(),\n },\n bubbles: true,\n cancelable: false,\n });\n window.dispatchEvent(event);\n } catch (eventError) {\n // Silently fail - event dispatch should never crash the app\n consola.warn('Failed to dispatch validation error event:', eventError);\n }\n }\n\n // Re-throw the error\n throw error;\n }\n}\n\n\n","// Auto-generated by DjangoCFG - see CLAUDE.md\n/**\n * Typed fetchers for Centrifugo Auth\n *\n * Universal functions that work in any environment:\n * - Next.js (App Router / Pages Router / Server Components)\n * - React Native\n * - Node.js backend\n *\n * These fetchers use Zod schemas for runtime validation.\n *\n * Usage:\n * ```typescript\n * // Configure API once (in your app entry point)\n * import { configureAPI } from '../../api-instance'\n * configureAPI({ baseUrl: 'https://api.example.com' })\n *\n * // Then use fetchers anywhere\n * const users = await getUsers({ page: 1 })\n *\n * // With SWR\n * const { data } = useSWR(['users', params], () => getUsers(params))\n *\n * // With React Query\n * const { data } = useQuery(['users', params], () => getUsers(params))\n *\n * // In Server Component or SSR (pass custom client)\n * import { API } from '../../index'\n * const api = new API('https://api.example.com')\n * const users = await getUsers({ page: 1 }, api)\n * ```\n */\nimport { consola } from 'consola'\nimport { ConnectionTokenResponseSchema, type ConnectionTokenResponse } from '../schemas/ConnectionTokenResponse.schema'\nimport { getAPIInstance } from '../../api-instance'\n\n/**\n * Get Centrifugo connection token\n *\n * @method GET\n * @path /cfg/centrifugo/auth/token/\n */\nexport async function getCentrifugoAuthTokenRetrieve( client?: any\n): Promise<ConnectionTokenResponse> {\n const api = client || getAPIInstance()\n const response = await api.centrifugo_auth.tokenRetrieve()\n try {\n return ConnectionTokenResponseSchema.parse(response)\n } catch (error) {\n // Zod validation error - log detailed information\n consola.error('❌ Zod Validation Failed');\n consola.box(`getCentrifugoAuthTokenRetrieve\\nPath: /cfg/centrifugo/auth/token/\\nMethod: GET`);\n\n if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {\n consola.error('Validation Issues:');\n (error as any).issues.forEach((issue: any, index: number) => {\n consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);\n consola.error(` ├─ Message: ${issue.message}`);\n if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);\n if (issue.received) consola.error(` └─ Received: ${issue.received}`);\n });\n }\n\n consola.error('Response data:', response);\n\n // Dispatch browser CustomEvent (only if window is defined)\n if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {\n try {\n const event = new CustomEvent('zod-validation-error', {\n detail: {\n operation: 'getCentrifugoAuthTokenRetrieve',\n path: '/cfg/centrifugo/auth/token/',\n method: 'GET',\n error: error,\n response: response,\n timestamp: new Date(),\n },\n bubbles: true,\n cancelable: false,\n });\n window.dispatchEvent(event);\n } catch (eventError) {\n // Silently fail - event dispatch should never crash the app\n consola.warn('Failed to dispatch validation error event:', eventError);\n }\n }\n\n // Re-throw the error\n throw error;\n }\n}\n\n\n","// Auto-generated by DjangoCFG - see CLAUDE.md\n/**\n * Typed fetchers for Centrifugo Monitoring\n *\n * Universal functions that work in any environment:\n * - Next.js (App Router / Pages Router / Server Components)\n * - React Native\n * - Node.js backend\n *\n * These fetchers use Zod schemas for runtime validation.\n *\n * Usage:\n * ```typescript\n * // Configure API once (in your app entry point)\n * import { configureAPI } from '../../api-instance'\n * configureAPI({ baseUrl: 'https://api.example.com' })\n *\n * // Then use fetchers anywhere\n * const users = await getUsers({ page: 1 })\n *\n * // With SWR\n * const { data } = useSWR(['users', params], () => getUsers(params))\n *\n * // With React Query\n * const { data } = useQuery(['users', params], () => getUsers(params))\n *\n * // In Server Component or SSR (pass custom client)\n * import { API } from '../../index'\n * const api = new API('https://api.example.com')\n * const users = await getUsers({ page: 1 }, api)\n * ```\n */\nimport { consola } from 'consola'\nimport { CentrifugoHealthCheckSchema, type CentrifugoHealthCheck } from '../schemas/CentrifugoHealthCheck.schema'\nimport { CentrifugoOverviewStatsSchema, type CentrifugoOverviewStats } from '../schemas/CentrifugoOverviewStats.schema'\nimport { ChannelListSchema, type ChannelList } from '../schemas/ChannelList.schema'\nimport { PaginatedPublishListSchema, type PaginatedPublishList } from '../schemas/PaginatedPublishList.schema'\nimport { TimelineResponseSchema, type TimelineResponse } from '../schemas/TimelineResponse.schema'\nimport { getAPIInstance } from '../../api-instance'\n\n/**\n * Get channel statistics\n *\n * @method GET\n * @path /cfg/centrifugo/monitor/channels/\n */\nexport async function getCentrifugoMonitorChannelsRetrieve( params?: { hours?: number }, client?: any\n): Promise<ChannelList> {\n const api = client || getAPIInstance()\n const response = await api.centrifugo_monitoring.centrifugoMonitorChannelsRetrieve(params?.hours)\n try {\n return ChannelListSchema.parse(response)\n } catch (error) {\n // Zod validation error - log detailed information\n consola.error('❌ Zod Validation Failed');\n consola.box(`getCentrifugoMonitorChannelsRetrieve\\nPath: /cfg/centrifugo/monitor/channels/\\nMethod: GET`);\n\n if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {\n consola.error('Validation Issues:');\n (error as any).issues.forEach((issue: any, index: number) => {\n consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);\n consola.error(` ├─ Message: ${issue.message}`);\n if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);\n if (issue.received) consola.error(` └─ Received: ${issue.received}`);\n });\n }\n\n consola.error('Response data:', response);\n\n // Dispatch browser CustomEvent (only if window is defined)\n if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {\n try {\n const event = new CustomEvent('zod-validation-error', {\n detail: {\n operation: 'getCentrifugoMonitorChannelsRetrieve',\n path: '/cfg/centrifugo/monitor/channels/',\n method: 'GET',\n error: error,\n response: response,\n timestamp: new Date(),\n },\n bubbles: true,\n cancelable: false,\n });\n window.dispatchEvent(event);\n } catch (eventError) {\n // Silently fail - event dispatch should never crash the app\n consola.warn('Failed to dispatch validation error event:', eventError);\n }\n }\n\n // Re-throw the error\n throw error;\n }\n}\n\n\n/**\n * Get Centrifugo health status\n *\n * @method GET\n * @path /cfg/centrifugo/monitor/health/\n */\nexport async function getCentrifugoMonitorHealthRetrieve( client?: any\n): Promise<CentrifugoHealthCheck> {\n const api = client || getAPIInstance()\n const response = await api.centrifugo_monitoring.centrifugoMonitorHealthRetrieve()\n try {\n return CentrifugoHealthCheckSchema.parse(response)\n } catch (error) {\n // Zod validation error - log detailed information\n consola.error('❌ Zod Validation Failed');\n consola.box(`getCentrifugoMonitorHealthRetrieve\\nPath: /cfg/centrifugo/monitor/health/\\nMethod: GET`);\n\n if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {\n consola.error('Validation Issues:');\n (error as any).issues.forEach((issue: any, index: number) => {\n consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);\n consola.error(` ├─ Message: ${issue.message}`);\n if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);\n if (issue.received) consola.error(` └─ Received: ${issue.received}`);\n });\n }\n\n consola.error('Response data:', response);\n\n // Dispatch browser CustomEvent (only if window is defined)\n if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {\n try {\n const event = new CustomEvent('zod-validation-error', {\n detail: {\n operation: 'getCentrifugoMonitorHealthRetrieve',\n path: '/cfg/centrifugo/monitor/health/',\n method: 'GET',\n error: error,\n response: response,\n timestamp: new Date(),\n },\n bubbles: true,\n cancelable: false,\n });\n window.dispatchEvent(event);\n } catch (eventError) {\n // Silently fail - event dispatch should never crash the app\n consola.warn('Failed to dispatch validation error event:', eventError);\n }\n }\n\n // Re-throw the error\n throw error;\n }\n}\n\n\n/**\n * Get overview statistics\n *\n * @method GET\n * @path /cfg/centrifugo/monitor/overview/\n */\nexport async function getCentrifugoMonitorOverviewRetrieve( params?: { hours?: number }, client?: any\n): Promise<CentrifugoOverviewStats> {\n const api = client || getAPIInstance()\n const response = await api.centrifugo_monitoring.centrifugoMonitorOverviewRetrieve(params?.hours)\n try {\n return CentrifugoOverviewStatsSchema.parse(response)\n } catch (error) {\n // Zod validation error - log detailed information\n consola.error('❌ Zod Validation Failed');\n consola.box(`getCentrifugoMonitorOverviewRetrieve\\nPath: /cfg/centrifugo/monitor/overview/\\nMethod: GET`);\n\n if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {\n consola.error('Validation Issues:');\n (error as any).issues.forEach((issue: any, index: number) => {\n consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);\n consola.error(` ├─ Message: ${issue.message}`);\n if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);\n if (issue.received) consola.error(` └─ Received: ${issue.received}`);\n });\n }\n\n consola.error('Response data:', response);\n\n // Dispatch browser CustomEvent (only if window is defined)\n if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {\n try {\n const event = new CustomEvent('zod-validation-error', {\n detail: {\n operation: 'getCentrifugoMonitorOverviewRetrieve',\n path: '/cfg/centrifugo/monitor/overview/',\n method: 'GET',\n error: error,\n response: response,\n timestamp: new Date(),\n },\n bubbles: true,\n cancelable: false,\n });\n window.dispatchEvent(event);\n } catch (eventError) {\n // Silently fail - event dispatch should never crash the app\n consola.warn('Failed to dispatch validation error event:', eventError);\n }\n }\n\n // Re-throw the error\n throw error;\n }\n}\n\n\n/**\n * Get recent publishes\n *\n * @method GET\n * @path /cfg/centrifugo/monitor/publishes/\n */\nexport async function getCentrifugoMonitorPublishesList( params?: { channel?: string; page?: number; page_size?: number; status?: string }, client?: any\n): Promise<PaginatedPublishList> {\n const api = client || getAPIInstance()\n const response = await api.centrifugo_monitoring.centrifugoMonitorPublishesList(params?.channel, params?.page, params?.page_size, params?.status)\n try {\n return PaginatedPublishListSchema.parse(response)\n } catch (error) {\n // Zod validation error - log detailed information\n consola.error('❌ Zod Validation Failed');\n consola.box(`getCentrifugoMonitorPublishesList\\nPath: /cfg/centrifugo/monitor/publishes/\\nMethod: GET`);\n\n if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {\n consola.error('Validation Issues:');\n (error as any).issues.forEach((issue: any, index: number) => {\n consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);\n consola.error(` ├─ Message: ${issue.message}`);\n if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);\n if (issue.received) consola.error(` └─ Received: ${issue.received}`);\n });\n }\n\n consola.error('Response data:', response);\n\n // Dispatch browser CustomEvent (only if window is defined)\n if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {\n try {\n const event = new CustomEvent('zod-validation-error', {\n detail: {\n operation: 'getCentrifugoMonitorPublishesList',\n path: '/cfg/centrifugo/monitor/publishes/',\n method: 'GET',\n error: error,\n response: response,\n timestamp: new Date(),\n },\n bubbles: true,\n cancelable: false,\n });\n window.dispatchEvent(event);\n } catch (eventError) {\n // Silently fail - event dispatch should never crash the app\n consola.warn('Failed to dispatch validation error event:', eventError);\n }\n }\n\n // Re-throw the error\n throw error;\n }\n}\n\n\n/**\n * Get publish timeline\n *\n * @method GET\n * @path /cfg/centrifugo/monitor/timeline/\n */\nexport async function getCentrifugoMonitorTimelineRetrieve( params?: { hours?: number; interval?: string }, client?: any\n): Promise<TimelineResponse> {\n const api = client || getAPIInstance()\n const response = await api.centrifugo_monitoring.centrifugoMonitorTimelineRetrieve(params?.hours, params?.interval)\n try {\n return TimelineResponseSchema.parse(response)\n } catch (error) {\n // Zod validation error - log detailed information\n consola.error('❌ Zod Validation Failed');\n consola.box(`getCentrifugoMonitorTimelineRetrieve\\nPath: /cfg/centrifugo/monitor/timeline/\\nMethod: GET`);\n\n if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {\n consola.error('Validation Issues:');\n (error as any).issues.forEach((issue: any, index: number) => {\n consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);\n consola.error(` ├─ Message: ${issue.message}`);\n if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);\n if (issue.received) consola.error(` └─ Received: ${issue.received}`);\n });\n }\n\n consola.error('Response data:', response);\n\n // Dispatch browser CustomEvent (only if window is defined)\n if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {\n try {\n const event = new CustomEvent('zod-validation-error', {\n detail: {\n operation: 'getCentrifugoMonitorTimelineRetrieve',\n path: '/cfg/centrifugo/monitor/timeline/',\n method: 'GET',\n error: error,\n response: response,\n timestamp: new Date(),\n },\n bubbles: true,\n cancelable: false,\n });\n window.dispatchEvent(event);\n } catch (eventError) {\n // Silently fail - event dispatch should never crash the app\n consola.warn('Failed to dispatch validation error event:', eventError);\n }\n }\n\n // Re-throw the error\n throw error;\n }\n}\n\n\n","// Auto-generated by DjangoCFG - see CLAUDE.md\n/**\n * Typed fetchers for Centrifugo Testing\n *\n * Universal functions that work in any environment:\n * - Next.js (App Router / Pages Router / Server Components)\n * - React Native\n * - Node.js backend\n *\n * These fetchers use Zod schemas for runtime validation.\n *\n * Usage:\n * ```typescript\n * // Configure API once (in your app entry point)\n * import { configureAPI } from '../../api-instance'\n * configureAPI({ baseUrl: 'https://api.example.com' })\n *\n * // Then use fetchers anywhere\n * const users = await getUsers({ page: 1 })\n *\n * // With SWR\n * const { data } = useSWR(['users', params], () => getUsers(params))\n *\n * // With React Query\n * const { data } = useQuery(['users', params], () => getUsers(params))\n *\n * // In Server Component or SSR (pass custom client)\n * import { API } from '../../index'\n * const api = new API('https://api.example.com')\n * const users = await getUsers({ page: 1 }, api)\n * ```\n */\nimport { consola } from 'consola'\nimport { ManualAckRequestRequestSchema, type ManualAckRequestRequest } from '../schemas/ManualAckRequestRequest.schema'\nimport { ManualAckResponseSchema, type ManualAckResponse } from '../schemas/ManualAckResponse.schema'\nimport { PublishTestRequestRequestSchema, type PublishTestRequestRequest } from '../schemas/PublishTestRequestRequest.schema'\nimport { PublishTestResponseSchema, type PublishTestResponse } from '../schemas/PublishTestResponse.schema'\nimport { getAPIInstance } from '../../api-instance'\n\n/**\n * Publish test message\n *\n * @method POST\n * @path /cfg/centrifugo/testing/publish-test/\n */\nexport async function createCentrifugoTestingPublishTestCreate( data: PublishTestRequestRequest, client?: any\n): Promise<PublishTestResponse> {\n const api = client || getAPIInstance()\n const response = await api.centrifugo_testing.publishTestCreate(data)\n try {\n return PublishTestResponseSchema.parse(response)\n } catch (error) {\n // Zod validation error - log detailed information\n consola.error('❌ Zod Validation Failed');\n consola.box(`createCentrifugoTestingPublishTestCreate\\nPath: /cfg/centrifugo/testing/publish-test/\\nMethod: POST`);\n\n if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {\n consola.error('Validation Issues:');\n (error as any).issues.forEach((issue: any, index: number) => {\n consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);\n consola.error(` ├─ Message: ${issue.message}`);\n if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);\n if (issue.received) consola.error(` └─ Received: ${issue.received}`);\n });\n }\n\n consola.error('Response data:', response);\n\n // Dispatch browser CustomEvent (only if window is defined)\n if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {\n try {\n const event = new CustomEvent('zod-validation-error', {\n detail: {\n operation: 'createCentrifugoTestingPublishTestCreate',\n path: '/cfg/centrifugo/testing/publish-test/',\n method: 'POST',\n error: error,\n response: response,\n timestamp: new Date(),\n },\n bubbles: true,\n cancelable: false,\n });\n window.dispatchEvent(event);\n } catch (eventError) {\n // Silently fail - event dispatch should never crash the app\n consola.warn('Failed to dispatch validation error event:', eventError);\n }\n }\n\n // Re-throw the error\n throw error;\n }\n}\n\n\n/**\n * Publish with database logging\n *\n * @method POST\n * @path /cfg/centrifugo/testing/publish-with-logging/\n */\nexport async function createCentrifugoTestingPublishWithLoggingCreate( data: PublishTestRequestRequest, client?: any\n): Promise<PublishTestResponse> {\n const api = client || getAPIInstance()\n const response = await api.centrifugo_testing.publishWithLoggingCreate(data)\n try {\n return PublishTestResponseSchema.parse(response)\n } catch (error) {\n // Zod validation error - log detailed information\n consola.error('❌ Zod Validation Failed');\n consola.box(`createCentrifugoTestingPublishWithLoggingCreate\\nPath: /cfg/centrifugo/testing/publish-with-logging/\\nMethod: POST`);\n\n if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {\n consola.error('Validation Issues:');\n (error as any).issues.forEach((issue: any, index: number) => {\n consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);\n consola.error(` ├─ Message: ${issue.message}`);\n if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);\n if (issue.received) consola.error(` └─ Received: ${issue.received}`);\n });\n }\n\n consola.error('Response data:', response);\n\n // Dispatch browser CustomEvent (only if window is defined)\n if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {\n try {\n const event = new CustomEvent('zod-validation-error', {\n detail: {\n operation: 'createCentrifugoTestingPublishWithLoggingCreate',\n path: '/cfg/centrifugo/testing/publish-with-logging/',\n method: 'POST',\n error: error,\n response: response,\n timestamp: new Date(),\n },\n bubbles: true,\n cancelable: false,\n });\n window.dispatchEvent(event);\n } catch (eventError) {\n // Silently fail - event dispatch should never crash the app\n consola.warn('Failed to dispatch validation error event:', eventError);\n }\n }\n\n // Re-throw the error\n throw error;\n }\n}\n\n\n/**\n * Send manual ACK\n *\n * @method POST\n * @path /cfg/centrifugo/testing/send-ack/\n */\nexport async function createCentrifugoTestingSendAckCreate( data: ManualAckRequestRequest, client?: any\n): Promise<ManualAckResponse> {\n const api = client || getAPIInstance()\n const response = await api.centrifugo_testing.sendAckCreate(data)\n try {\n return ManualAckResponseSchema.parse(response)\n } catch (error) {\n // Zod validation error - log detailed information\n consola.error('❌ Zod Validation Failed');\n consola.box(`createCentrifugoTestingSendAckCreate\\nPath: /cfg/centrifugo/testing/send-ack/\\nMethod: POST`);\n\n if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {\n consola.error('Validation Issues:');\n (error as any).issues.forEach((issue: any, index: number) => {\n consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);\n consola.error(` ├─ Message: ${issue.message}`);\n if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);\n if (issue.received) consola.error(` └─ Received: ${issue.received}`);\n });\n }\n\n consola.error('Response data:', response);\n\n // Dispatch browser CustomEvent (only if window is defined)\n if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {\n try {\n const event = new CustomEvent('zod-validation-error', {\n detail: {\n operation: 'createCentrifugoTestingSendAckCreate',\n path: '/cfg/centrifugo/testing/send-ack/',\n method: 'POST',\n error: error,\n response: response,\n timestamp: new Date(),\n },\n bubbles: true,\n cancelable: false,\n });\n window.dispatchEvent(event);\n } catch (eventError) {\n // Silently fail - event dispatch should never crash the app\n consola.warn('Failed to dispatch validation error event:', eventError);\n }\n }\n\n // Re-throw the error\n throw error;\n }\n}\n\n\n","// Auto-generated by DjangoCFG - see CLAUDE.md\n/**\n * Django CFG API - API Client with JWT Management\n *\n * Usage:\n * ```typescript\n * import { API } from './api';\n *\n * const api = new API('https://api.example.com');\n *\n * // Set JWT token\n * api.setToken('your-jwt-token', 'refresh-token');\n *\n * // Use API\n * const posts = await api.posts.list();\n * const user = await api.users.retrieve(1);\n *\n * // Check authentication\n * if (api.isAuthenticated()) {\n * // ...\n * }\n *\n * // Custom storage with logging (for Electron/Node.js)\n * import { MemoryStorageAdapter, APILogger } from './storage';\n * const logger = new APILogger({ enabled: true, logLevel: 'debug' });\n * const api = new API('https://api.example.com', {\n * storage: new MemoryStorageAdapter(logger),\n * loggerConfig: { enabled: true, logLevel: 'debug' }\n * });\n *\n * // Get OpenAPI schema\n * const schema = api.getSchema();\n * ```\n */\n\nimport { APIClient } from \"./client\";\nimport {\n StorageAdapter,\n LocalStorageAdapter,\n CookieStorageAdapter,\n MemoryStorageAdapter\n} from \"./storage\";\nimport type { RetryConfig } from \"./retry\";\nimport type { LoggerConfig } from \"./logger\";\nimport { APILogger } from \"./logger\";\nimport { CentrifugoAdminApi } from \"./centrifugo__centrifugo_admin_api/client\";\nimport { CentrifugoAuth } from \"./centrifugo__centrifugo_auth/client\";\nimport { CentrifugoMonitoring } from \"./centrifugo__centrifugo_monitoring/client\";\nimport { CentrifugoTesting } from \"./centrifugo__centrifugo_testing/client\";\nexport * as CentrifugoAdminApiTypes from \"./centrifugo__centrifugo_admin_api/models\";\n// Note: Direct exports (export * from) are removed to avoid duplicate type conflicts\n// Use namespace exports like CfgAccountsTypes.User or import from specific modules\nexport * as CentrifugoAuthTypes from \"./centrifugo__centrifugo_auth/models\";\n// Note: Direct exports (export * from) are removed to avoid duplicate type conflicts\n// Use namespace exports like CfgAccountsTypes.User or import from specific modules\nexport * as CentrifugoMonitoringTypes from \"./centrifugo__centrifugo_monitoring/models\";\n// Note: Direct exports (export * from) are removed to avoid duplicate type conflicts\n// Use namespace exports like CfgAccountsTypes.User or import from specific modules\nexport * as CentrifugoTestingTypes from \"./centrifugo__centrifugo_testing/models\";\n// Note: Direct exports (export * from) are removed to avoid duplicate type conflicts\n// Use namespace exports like CfgAccountsTypes.User or import from specific modules\n\n// Re-export Zod schemas for runtime validation\nexport * as Schemas from \"./_utils/schemas\";\n// Also export all schemas directly for convenience\nexport * from \"./_utils/schemas\";\n\n// Re-export Zod validation events for browser integration\nexport type { ValidationErrorDetail, ValidationErrorEvent } from \"./validation-events\";\nexport { dispatchValidationError, onValidationError, formatZodError } from \"./validation-events\";\n\n// Re-export typed fetchers for universal usage\nexport * as Fetchers from \"./_utils/fetchers\";\nexport * from \"./_utils/fetchers\";\n\n// Re-export API instance configuration functions\nexport {\n configureAPI,\n getAPIInstance,\n reconfigureAPI,\n clearAPITokens,\n resetAPI,\n isAPIConfigured\n} from \"./api-instance\";\n// NOTE: SWR hooks are generated in ./_utils/hooks/ but NOT exported here to keep\n// the main bundle server-safe. Import hooks directly from the hooks directory:\n// import { useUsers } from './_utils/hooks';\n// Or use a separate entry point like '@djangocfg/api/hooks' for client components.\n\n// Re-export core client\nexport { APIClient };\n\n// Re-export storage adapters for convenience\nexport type { StorageAdapter };\nexport { LocalStorageAdapter, CookieStorageAdapter, MemoryStorageAdapter };\n\n// Re-export error classes for convenience\nexport { APIError, NetworkError } from \"./errors\";\n\n// Re-export HTTP adapters for custom implementations\nexport type { HttpClientAdapter, HttpRequest, HttpResponse } from \"./http\";\nexport { FetchAdapter } from \"./http\";\n\n// Re-export logger types and classes\nexport type { LoggerConfig, RequestLog, ResponseLog, ErrorLog } from \"./logger\";\nexport { APILogger } from \"./logger\";\n\n// Re-export retry configuration and utilities\nexport type { RetryConfig, FailedAttemptInfo } from \"./retry\";\nexport { withRetry, shouldRetry, DEFAULT_RETRY_CONFIG } from \"./retry\";\n\nexport const TOKEN_KEY = \"auth_token\";\nexport const REFRESH_TOKEN_KEY = \"refresh_token\";\n\nexport interface APIOptions {\n /** Custom storage adapter (defaults to LocalStorageAdapter) */\n storage?: StorageAdapter;\n /** Retry configuration for failed requests */\n retryConfig?: RetryConfig;\n /** Logger configuration */\n loggerConfig?: Partial<LoggerConfig>;\n}\n\nexport class API {\n private baseUrl: string;\n private _client: APIClient;\n private _token: string | null = null;\n private _refreshToken: string | null = null;\n private storage: StorageAdapter;\n private options?: APIOptions;\n\n // Sub-clients\n public centrifugo_admin_api!: CentrifugoAdminApi;\n public centrifugo_auth!: CentrifugoAuth;\n public centrifugo_monitoring!: CentrifugoMonitoring;\n public centrifugo_testing!: CentrifugoTesting;\n\n constructor(baseUrl: string, options?: APIOptions) {\n this.baseUrl = baseUrl;\n this.options = options;\n\n // Create logger if config provided\n const logger = options?.loggerConfig ? new APILogger(options.loggerConfig) : undefined;\n\n // Initialize storage with logger\n this.storage = options?.storage || new LocalStorageAdapter(logger);\n\n this._loadTokensFromStorage();\n\n // Initialize APIClient\n this._client = new APIClient(this.baseUrl, {\n retryConfig: this.options?.retryConfig,\n loggerConfig: this.options?.loggerConfig,\n });\n\n // Always inject auth header wrapper (reads token dynamically from storage)\n this._injectAuthHeader();\n\n // Initialize sub-clients from APIClient\n this.centrifugo_admin_api = this._client.centrifugo_admin_api;\n this.centrifugo_auth = this._client.centrifugo_auth;\n this.centrifugo_monitoring = this._client.centrifugo_monitoring;\n this.centrifugo_testing = this._client.centrifugo_testing;\n }\n\n private _loadTokensFromStorage(): void {\n this._token = this.storage.getItem(TOKEN_KEY);\n this._refreshToken = this.storage.getItem(REFRESH_TOKEN_KEY);\n }\n\n private _reinitClients(): void {\n this._client = new APIClient(this.baseUrl, {\n retryConfig: this.options?.retryConfig,\n loggerConfig: this.options?.loggerConfig,\n });\n\n // Always inject auth header wrapper (reads token dynamically from storage)\n this._injectAuthHeader();\n\n // Reinitialize sub-clients\n this.centrifugo_admin_api = this._client.centrifugo_admin_api;\n this.centrifugo_auth = this._client.centrifugo_auth;\n this.centrifugo_monitoring = this._client.centrifugo_monitoring;\n this.centrifugo_testing = this._client.centrifugo_testing;\n }\n\n private _injectAuthHeader(): void {\n // Override request method to inject auth header\n const originalRequest = this._client.request.bind(this._client);\n this._client.request = async <T>(\n method: string,\n path: string,\n options?: { params?: Record<string, any>; body?: any; formData?: FormData; headers?: Record<string, string> }\n ): Promise<T> => {\n // Read token from storage dynamically (supports JWT injection after instantiation)\n const token = this.getToken();\n const mergedOptions = {\n ...options,\n headers: {\n ...(options?.headers || {}),\n ...(token ? { 'Authorization': `Bearer ${token}` } : {}),\n },\n };\n\n return originalRequest(method, path, mergedOptions);\n };\n }\n\n /**\n * Get current JWT token\n */\n getToken(): string | null {\n return this.storage.getItem(TOKEN_KEY);\n }\n\n /**\n * Get current refresh token\n */\n getRefreshToken(): string | null {\n return this.storage.getItem(REFRESH_TOKEN_KEY);\n }\n\n /**\n * Set JWT token and refresh token\n * @param token - JWT access token\n * @param refreshToken - JWT refresh token (optional)\n */\n setToken(token: string, refreshToken?: string): void {\n this._token = token;\n this.storage.setItem(TOKEN_KEY, token);\n\n if (refreshToken) {\n this._refreshToken = refreshToken;\n this.storage.setItem(REFRESH_TOKEN_KEY, refreshToken);\n }\n\n // Reinitialize clients with new token\n this._reinitClients();\n }\n\n /**\n * Clear all tokens\n */\n clearTokens(): void {\n this._token = null;\n this._refreshToken = null;\n this.storage.removeItem(TOKEN_KEY);\n this.storage.removeItem(REFRESH_TOKEN_KEY);\n\n // Reinitialize clients without token\n this._reinitClients();\n }\n\n /**\n * Check if user is authenticated\n */\n isAuthenticated(): boolean {\n return !!this.getToken();\n }\n\n /**\n * Update base URL and reinitialize clients\n * @param url - New base URL\n */\n setBaseUrl(url: string): void {\n this.baseUrl = url;\n this._reinitClients();\n }\n\n /**\n * Get current base URL\n */\n getBaseUrl(): string {\n return this.baseUrl;\n }\n\n /**\n * Get OpenAPI schema path\n * @returns Path to the OpenAPI schema JSON file\n *\n * Note: The OpenAPI schema is available in the schema.json file.\n * You can load it dynamically using:\n * ```typescript\n * const schema = await fetch('./schema.json').then(r => r.json());\n * // or using fs in Node.js:\n * // const schema = JSON.parse(fs.readFileSync('./schema.json', 'utf-8'));\n * ```\n */\n getSchemaPath(): string {\n return './schema.json';\n }\n}\n\nexport default API;","import * as Models from \"./models\";\n\n\n/**\n * API endpoints for Web Push.\n */\nexport class WebPush {\n private client: any;\n\n constructor(client: any) {\n this.client = client;\n }\n\n /**\n * Send push notification\n * \n * Send push notification to all active subscriptions for the authenticated\n * user.\n */\n async webpushSendCreate(data: Models.SendPushRequestRequest): Promise<Models.SendPushResponse> {\n const response = await this.client.request('POST', \"/cfg/webpush/send/\", { body: data });\n return response;\n }\n\n /**\n * Subscribe to push notifications\n * \n * Save push subscription from browser for the authenticated user.\n */\n async webpushSubscribeCreate(data: Models.SubscribeRequestRequest): Promise<Models.SubscribeResponse> {\n const response = await this.client.request('POST', \"/cfg/webpush/subscribe/\", { body: data });\n return response;\n }\n\n /**\n * Get VAPID public key\n * \n * Get VAPID public key for client subscription.\n */\n async webpushVapidRetrieve(): Promise<Models.VapidPublicKeyResponse> {\n const response = await this.client.request('GET', \"/cfg/webpush/vapid/\");\n return response;\n }\n\n}","// Auto-generated by DjangoCFG - see CLAUDE.md\n/**\n * HTTP Client Adapter Pattern\n *\n * Allows switching between fetch/axios/httpx without changing generated code.\n * Provides unified interface for making HTTP requests.\n */\n\nexport interface HttpRequest {\n method: string;\n url: string;\n headers?: Record<string, string>;\n body?: any;\n params?: Record<string, any>;\n /** FormData for file uploads (multipart/form-data) */\n formData?: FormData;\n}\n\nexport interface HttpResponse<T = any> {\n data: T;\n status: number;\n statusText: string;\n headers: Record<string, string>;\n}\n\n/**\n * HTTP Client Adapter Interface.\n * Implement this to use custom HTTP clients (axios, httpx, etc.)\n */\nexport interface HttpClientAdapter {\n request<T = any>(request: HttpRequest): Promise<HttpResponse<T>>;\n}\n\n/**\n * Default Fetch API adapter.\n * Uses native browser fetch() with proper error handling.\n */\nexport class FetchAdapter implements HttpClientAdapter {\n async request<T = any>(request: HttpRequest): Promise<HttpResponse<T>> {\n const { method, url, headers, body, params, formData } = request;\n\n // Build URL with query params\n let finalUrl = url;\n if (params) {\n const searchParams = new URLSearchParams();\n Object.entries(params).forEach(([key, value]) => {\n if (value !== null && value !== undefined) {\n searchParams.append(key, String(value));\n }\n });\n const queryString = searchParams.toString();\n if (queryString) {\n finalUrl = url.includes('?') ? `${url}&${queryString}` : `${url}?${queryString}`;\n }\n }\n\n // Build headers\n const finalHeaders: Record<string, string> = { ...headers };\n\n // Determine body and content-type\n let requestBody: string | FormData | undefined;\n\n if (formData) {\n // For multipart/form-data, let browser set Content-Type with boundary\n requestBody = formData;\n // Don't set Content-Type - browser will set it with boundary\n } else if (body) {\n // JSON request\n finalHeaders['Content-Type'] = 'application/json';\n requestBody = JSON.stringify(body);\n }\n\n // Make request\n const response = await fetch(finalUrl, {\n method,\n headers: finalHeaders,\n body: requestBody,\n credentials: 'include', // Include Django session cookies\n });\n\n // Parse response\n let data: any = null;\n const contentType = response.headers.get('content-type');\n\n if (response.status !== 204 && contentType?.includes('application/json')) {\n data = await response.json();\n } else if (response.status !== 204) {\n data = await response.text();\n }\n\n // Convert Headers to plain object\n const responseHeaders: Record<string, string> = {};\n response.headers.forEach((value, key) => {\n responseHeaders[key] = value;\n });\n\n return {\n data,\n status: response.status,\n statusText: response.statusText,\n headers: responseHeaders,\n };\n }\n}","// Auto-generated by DjangoCFG - see CLAUDE.md\n/**\n * API Error Classes\n *\n * Typed error classes with Django REST Framework support.\n */\n\n/**\n * HTTP API Error with DRF field-specific validation errors.\n *\n * Usage:\n * ```typescript\n * try {\n * await api.users.create(userData);\n * } catch (error) {\n * if (error instanceof APIError) {\n * if (error.isValidationError) {\n * console.log('Field errors:', error.fieldErrors);\n * // { \"email\": [\"Email already exists\"], \"username\": [\"Required\"] }\n * }\n * }\n * }\n * ```\n */\nexport class APIError extends Error {\n constructor(\n public statusCode: number,\n public statusText: string,\n public response: any,\n public url: string,\n message?: string\n ) {\n super(message || `HTTP ${statusCode}: ${statusText}`);\n this.name = 'APIError';\n }\n\n /**\n * Get error details from response.\n * DRF typically returns: { \"detail\": \"Error message\" } or { \"field\": [\"error1\", \"error2\"] }\n */\n get details(): Record<string, any> | null {\n if (typeof this.response === 'object' && this.response !== null) {\n return this.response;\n }\n return null;\n }\n\n /**\n * Get field-specific validation errors from DRF.\n * Returns: { \"field_name\": [\"error1\", \"error2\"], ... }\n */\n get fieldErrors(): Record<string, string[]> | null {\n const details = this.details;\n if (!details) return null;\n\n // DRF typically returns: { \"field\": [\"error1\", \"error2\"] }\n const fieldErrors: Record<string, string[]> = {};\n for (const [key, value] of Object.entries(details)) {\n if (Array.isArray(value)) {\n fieldErrors[key] = value;\n }\n }\n\n return Object.keys(fieldErrors).length > 0 ? fieldErrors : null;\n }\n\n /**\n * Get single error message from DRF.\n * Checks for \"detail\", \"message\", or first field error.\n */\n get errorMessage(): string {\n const details = this.details;\n if (!details) return this.message;\n\n // Check for \"detail\" field (common in DRF)\n if (details.detail) {\n return Array.isArray(details.detail) ? details.detail.join(', ') : String(details.detail);\n }\n\n // Check for \"message\" field\n if (details.message) {\n return String(details.message);\n }\n\n // Return first field error\n const fieldErrors = this.fieldErrors;\n if (fieldErrors) {\n const firstField = Object.keys(fieldErrors)[0];\n if (firstField) {\n return `${firstField}: ${fieldErrors[firstField]?.join(', ')}`;\n }\n }\n\n return this.message;\n }\n\n // Helper methods for common HTTP status codes\n get isValidationError(): boolean { return this.statusCode === 400; }\n get isAuthError(): boolean { return this.statusCode === 401; }\n get isPermissionError(): boolean { return this.statusCode === 403; }\n get isNotFoundError(): boolean { return this.statusCode === 404; }\n get isServerError(): boolean { return this.statusCode >= 500 && this.statusCode < 600; }\n}\n\n/**\n * Network Error (connection failed, timeout, etc.)\n */\nexport class NetworkError extends Error {\n constructor(\n message: string,\n public url: string,\n public originalError?: Error\n ) {\n super(message);\n this.name = 'NetworkError';\n }\n}","// Auto-generated by DjangoCFG - see CLAUDE.md\n/**\n * API Logger with Consola\n * Beautiful console logging for API requests and responses\n *\n * Installation:\n * npm install consola\n */\n\nimport { type ConsolaInstance, createConsola } from 'consola';\n\n/**\n * Request log data\n */\nexport interface RequestLog {\n method: string;\n url: string;\n headers?: Record<string, string>;\n body?: any;\n timestamp: number;\n}\n\n/**\n * Response log data\n */\nexport interface ResponseLog {\n status: number;\n statusText: string;\n data?: any;\n duration: number;\n timestamp: number;\n}\n\n/**\n * Error log data\n */\nexport interface ErrorLog {\n message: string;\n statusCode?: number;\n fieldErrors?: Record<string, string[]>;\n duration: number;\n timestamp: number;\n}\n\n/**\n * Logger configuration\n */\nexport interface LoggerConfig {\n /** Enable logging */\n enabled: boolean;\n /** Log requests */\n logRequests: boolean;\n /** Log responses */\n logResponses: boolean;\n /** Log errors */\n logErrors: boolean;\n /** Log request/response bodies */\n logBodies: boolean;\n /** Log headers (excluding sensitive ones) */\n logHeaders: boolean;\n /** Custom consola instance */\n consola?: ConsolaInstance;\n}\n\n/**\n * Default logger configuration\n */\nconst DEFAULT_CONFIG: LoggerConfig = {\n enabled: process.env.NODE_ENV !== 'production',\n logRequests: true,\n logResponses: true,\n logErrors: true,\n logBodies: true,\n logHeaders: false,\n};\n\n/**\n * Sensitive header names to filter out\n */\nconst SENSITIVE_HEADERS = [\n 'authorization',\n 'cookie',\n 'set-cookie',\n 'x-api-key',\n 'x-csrf-token',\n];\n\n/**\n * API Logger class\n */\nexport class APILogger {\n private config: LoggerConfig;\n private consola: ConsolaInstance;\n\n constructor(config: Partial<LoggerConfig> = {}) {\n this.config = { ...DEFAULT_CONFIG, ...config };\n this.consola = config.consola || createConsola({\n level: this.config.enabled ? 4 : 0,\n });\n }\n\n /**\n * Enable logging\n */\n enable(): void {\n this.config.enabled = true;\n }\n\n /**\n * Disable logging\n */\n disable(): void {\n this.config.enabled = false;\n }\n\n /**\n * Update configuration\n */\n setConfig(config: Partial<LoggerConfig>): void {\n this.config = { ...this.config, ...config };\n }\n\n /**\n * Filter sensitive headers\n */\n private filterHeaders(headers?: Record<string, string>): Record<string, string> {\n if (!headers) return {};\n\n const filtered: Record<string, string> = {};\n Object.keys(headers).forEach((key) => {\n const lowerKey = key.toLowerCase();\n if (SENSITIVE_HEADERS.includes(lowerKey)) {\n filtered[key] = '***';\n } else {\n filtered[key] = headers[key] || '';\n }\n });\n\n return filtered;\n }\n\n /**\n * Log request\n */\n logRequest(request: RequestLog): void {\n if (!this.config.enabled || !this.config.logRequests) return;\n\n const { method, url, headers, body } = request;\n\n this.consola.start(`${method} ${url}`);\n\n if (this.config.logHeaders && headers) {\n this.consola.debug('Headers:', this.filterHeaders(headers));\n }\n\n if (this.config.logBodies && body) {\n this.consola.debug('Body:', body);\n }\n }\n\n /**\n * Log response\n */\n logResponse(request: RequestLog, response: ResponseLog): void {\n if (!this.config.enabled || !this.config.logResponses) return;\n\n const { method, url } = request;\n const { status, statusText, data, duration } = response;\n\n const statusColor = status >= 500 ? 'red'\n : status >= 400 ? 'yellow'\n : status >= 300 ? 'cyan'\n : 'green';\n\n this.consola.success(\n `${method} ${url} ${status} ${statusText} (${duration}ms)`\n );\n\n if (this.config.logBodies && data) {\n this.consola.debug('Response:', data);\n }\n }\n\n /**\n * Log error\n */\n logError(request: RequestLog, error: ErrorLog): void {\n if (!this.config.enabled || !this.config.logErrors) return;\n\n const { method, url } = request;\n const { message, statusCode, fieldErrors, duration } = error;\n\n this.consola.error(\n `${method} ${url} ${statusCode || 'Network'} Error (${duration}ms)`\n );\n\n this.consola.error('Message:', message);\n\n if (fieldErrors && Object.keys(fieldErrors).length > 0) {\n this.consola.error('Field Errors:');\n Object.entries(fieldErrors).forEach(([field, errors]) => {\n errors.forEach((err) => {\n this.consola.error(` • ${field}: ${err}`);\n });\n });\n }\n }\n\n /**\n * Log general info\n */\n info(message: string, ...args: any[]): void {\n if (!this.config.enabled) return;\n this.consola.info(message, ...args);\n }\n\n /**\n * Log warning\n */\n warn(message: string, ...args: any[]): void {\n if (!this.config.enabled) return;\n this.consola.warn(message, ...args);\n }\n\n /**\n * Log error\n */\n error(message: string, ...args: any[]): void {\n if (!this.config.enabled) return;\n this.consola.error(message, ...args);\n }\n\n /**\n * Log debug\n */\n debug(message: string, ...args: any[]): void {\n if (!this.config.enabled) return;\n this.consola.debug(message, ...args);\n }\n\n /**\n * Log success\n */\n success(message: string, ...args: any[]): void {\n if (!this.config.enabled) return;\n this.consola.success(message, ...args);\n }\n\n /**\n * Create a sub-logger with prefix\n */\n withTag(tag: string): ConsolaInstance {\n return this.consola.withTag(tag);\n }\n}\n\n/**\n * Default logger instance\n */\nexport const defaultLogger = new APILogger();","// Auto-generated by DjangoCFG - see CLAUDE.md\n/**\n * Retry Configuration and Utilities\n *\n * Provides automatic retry logic for failed HTTP requests using p-retry.\n * Retries only on network errors and server errors (5xx), not client errors (4xx).\n */\n\nimport pRetry, { AbortError } from 'p-retry';\nimport { APIError, NetworkError } from './errors';\n\n/**\n * Information about a failed retry attempt.\n */\nexport interface FailedAttemptInfo {\n /** The error that caused the failure */\n error: Error;\n /** The attempt number (1-indexed) */\n attemptNumber: number;\n /** Number of retries left */\n retriesLeft: number;\n}\n\n/**\n * Retry configuration options.\n *\n * Uses exponential backoff with jitter by default to avoid thundering herd.\n */\nexport interface RetryConfig {\n /**\n * Maximum number of retry attempts.\n * @default 3\n */\n retries?: number;\n\n /**\n * Exponential backoff factor.\n * @default 2\n */\n factor?: number;\n\n /**\n * Minimum wait time between retries (ms).\n * @default 1000\n */\n minTimeout?: number;\n\n /**\n * Maximum wait time between retries (ms).\n * @default 60000\n */\n maxTimeout?: number;\n\n /**\n * Add randomness to wait times (jitter).\n * Helps avoid thundering herd problem.\n * @default true\n */\n randomize?: boolean;\n\n /**\n * Callback called on each failed attempt.\n */\n onFailedAttempt?: (info: FailedAttemptInfo) => void;\n}\n\n/**\n * Default retry configuration.\n */\nexport const DEFAULT_RETRY_CONFIG: Required<RetryConfig> = {\n retries: 3,\n factor: 2,\n minTimeout: 1000,\n maxTimeout: 60000,\n randomize: true,\n onFailedAttempt: () => {},\n};\n\n/**\n * Determine if an error should trigger a retry.\n *\n * Retries on:\n * - Network errors (connection refused, timeout, etc.)\n * - Server errors (5xx status codes)\n * - Rate limiting (429 status code)\n *\n * Does NOT retry on:\n * - Client errors (4xx except 429)\n * - Authentication errors (401, 403)\n * - Not found (404)\n *\n * @param error - The error to check\n * @returns true if should retry, false otherwise\n */\nexport function shouldRetry(error: any): boolean {\n // Always retry network errors\n if (error instanceof NetworkError) {\n return true;\n }\n\n // For API errors, check status code\n if (error instanceof APIError) {\n const status = error.statusCode;\n\n // Retry on 5xx server errors\n if (status >= 500 && status < 600) {\n return true;\n }\n\n // Retry on 429 (rate limit)\n if (status === 429) {\n return true;\n }\n\n // Do NOT retry on 4xx client errors\n return false;\n }\n\n // Retry on unknown errors (might be network issues)\n return true;\n}\n\n/**\n * Wrap a function with retry logic.\n *\n * @param fn - Async function to retry\n * @param config - Retry configuration\n * @returns Result of the function\n *\n * @example\n * ```typescript\n * const result = await withRetry(\n * async () => fetch('https://api.example.com/users'),\n * { retries: 5, minTimeout: 2000 }\n * );\n * ```\n */\nexport async function withRetry<T>(\n fn: () => Promise<T>,\n config?: RetryConfig\n): Promise<T> {\n const finalConfig = { ...DEFAULT_RETRY_CONFIG, ...config };\n\n return pRetry(\n async () => {\n try {\n return await fn();\n } catch (error) {\n // Check if we should retry this error\n if (!shouldRetry(error)) {\n // Abort retry immediately for non-retryable errors\n throw new AbortError(error as Error);\n }\n\n // Re-throw error to trigger retry\n throw error;\n }\n },\n {\n retries: finalConfig.retries,\n factor: finalConfig.factor,\n minTimeout: finalConfig.minTimeout,\n maxTimeout: finalConfig.maxTimeout,\n randomize: finalConfig.randomize,\n onFailedAttempt: finalConfig.onFailedAttempt ? (error) => {\n // Adapt p-retry's FailedAttemptError to our FailedAttemptInfo\n const pRetryError = error as any; // p-retry's internal type\n finalConfig.onFailedAttempt!({\n error: pRetryError as Error,\n attemptNumber: pRetryError.attemptNumber,\n retriesLeft: pRetryError.retriesLeft,\n });\n } : undefined,\n }\n );\n}","import { WebPush } from \"./webpush__web_push\";\nimport { HttpClientAdapter, FetchAdapter } from \"./http\";\nimport { APIError, NetworkError } from \"./errors\";\nimport { APILogger, type LoggerConfig } from \"./logger\";\nimport { withRetry, type RetryConfig } from \"./retry\";\n\n\n/**\n * Async API client for Django CFG API.\n *\n * Usage:\n * ```typescript\n * const client = new APIClient('https://api.example.com');\n * const users = await client.users.list();\n * const post = await client.posts.create(newPost);\n *\n * // Custom HTTP adapter (e.g., Axios)\n * const client = new APIClient('https://api.example.com', {\n * httpClient: new AxiosAdapter()\n * });\n * ```\n */\nexport class APIClient {\n private baseUrl: string;\n private httpClient: HttpClientAdapter;\n private logger: APILogger | null = null;\n private retryConfig: RetryConfig | null = null;\n\n // Sub-clients\n public web_push: WebPush;\n\n constructor(\n baseUrl: string,\n options?: {\n httpClient?: HttpClientAdapter;\n loggerConfig?: Partial<LoggerConfig>;\n retryConfig?: RetryConfig;\n }\n ) {\n this.baseUrl = baseUrl.replace(/\\/$/, '');\n this.httpClient = options?.httpClient || new FetchAdapter();\n\n // Initialize logger if config provided\n if (options?.loggerConfig !== undefined) {\n this.logger = new APILogger(options.loggerConfig);\n }\n\n // Store retry configuration\n if (options?.retryConfig !== undefined) {\n this.retryConfig = options.retryConfig;\n }\n\n // Initialize sub-clients\n this.web_push = new WebPush(this);\n }\n\n /**\n * Get CSRF token from cookies (for SessionAuthentication).\n *\n * Returns null if cookie doesn't exist (JWT-only auth).\n */\n getCsrfToken(): string | null {\n const name = 'csrftoken';\n const value = `; ${document.cookie}`;\n const parts = value.split(`; ${name}=`);\n if (parts.length === 2) {\n return parts.pop()?.split(';').shift() || null;\n }\n return null;\n }\n\n /**\n * Make HTTP request with Django CSRF and session handling.\n * Automatically retries on network errors and 5xx server errors.\n */\n async request<T>(\n method: string,\n path: string,\n options?: {\n params?: Record<string, any>;\n body?: any;\n formData?: FormData;\n headers?: Record<string, string>;\n }\n ): Promise<T> {\n // Wrap request in retry logic if configured\n if (this.retryConfig) {\n return withRetry(() => this._makeRequest<T>(method, path, options), {\n ...this.retryConfig,\n onFailedAttempt: (info) => {\n // Log retry attempts\n if (this.logger) {\n this.logger.warn(\n `Retry attempt ${info.attemptNumber}/${info.retriesLeft + info.attemptNumber} ` +\n `for ${method} ${path}: ${info.error.message}`\n );\n }\n // Call user's onFailedAttempt if provided\n this.retryConfig?.onFailedAttempt?.(info);\n },\n });\n }\n\n // No retry configured, make request directly\n return this._makeRequest<T>(method, path, options);\n }\n\n /**\n * Internal request method (without retry wrapper).\n * Used by request() method with optional retry logic.\n */\n private async _makeRequest<T>(\n method: string,\n path: string,\n options?: {\n params?: Record<string, any>;\n body?: any;\n formData?: FormData;\n headers?: Record<string, string>;\n }\n ): Promise<T> {\n // Build URL - handle both absolute and relative paths\n // When baseUrl is empty (static builds), path is used as-is (relative to current origin)\n const url = this.baseUrl ? `${this.baseUrl}${path}` : path;\n const startTime = Date.now();\n\n // Build headers - start with custom headers from options\n const headers: Record<string, string> = {\n ...(options?.headers || {})\n };\n\n // Don't set Content-Type for FormData (browser will set it with boundary)\n if (!options?.formData && !headers['Content-Type']) {\n headers['Content-Type'] = 'application/json';\n }\n\n // CSRF not needed - SessionAuthentication not enabled in DRF config\n // Your API uses JWT/Token authentication (no CSRF required)\n\n // Log request\n if (this.logger) {\n this.logger.logRequest({\n method,\n url: url,\n headers,\n body: options?.formData || options?.body,\n timestamp: startTime,\n });\n }\n\n try {\n // Make request via HTTP adapter\n const response = await this.httpClient.request<T>({\n method,\n url: url,\n headers,\n params: options?.params,\n body: options?.body,\n formData: options?.formData,\n });\n\n const duration = Date.now() - startTime;\n\n // Check for HTTP errors\n if (response.status >= 400) {\n const error = new APIError(\n response.status,\n response.statusText,\n response.data,\n url\n );\n\n // Log error\n if (this.logger) {\n this.logger.logError(\n {\n method,\n url: url,\n headers,\n body: options?.formData || options?.body,\n timestamp: startTime,\n },\n {\n message: error.message,\n statusCode: response.status,\n duration,\n timestamp: Date.now(),\n }\n );\n }\n\n throw error;\n }\n\n // Log successful response\n if (this.logger) {\n this.logger.logResponse(\n {\n method,\n url: url,\n headers,\n body: options?.formData || options?.body,\n timestamp: startTime,\n },\n {\n status: response.status,\n statusText: response.statusText,\n data: response.data,\n duration,\n timestamp: Date.now(),\n }\n );\n }\n\n return response.data as T;\n } catch (error) {\n const duration = Date.now() - startTime;\n\n // Re-throw APIError as-is\n if (error instanceof APIError) {\n throw error;\n }\n\n // Detect CORS errors and dispatch event\n const isCORSError = error instanceof TypeError &&\n (error.message.toLowerCase().includes('cors') ||\n error.message.toLowerCase().includes('failed to fetch') ||\n error.message.toLowerCase().includes('network request failed'));\n\n // Log specific error type first\n if (this.logger) {\n if (isCORSError) {\n this.logger.error(`🚫 CORS Error: ${method} ${url}`);\n this.logger.error(` → ${error instanceof Error ? error.message : String(error)}`);\n this.logger.error(` → Configure security_domains parameter on the server`);\n } else {\n this.logger.error(`⚠️ Network Error: ${method} ${url}`);\n this.logger.error(` → ${error instanceof Error ? error.message : String(error)}`);\n }\n }\n\n // Dispatch browser events\n if (typeof window !== 'undefined') {\n try {\n if (isCORSError) {\n // Dispatch CORS-specific error event\n window.dispatchEvent(new CustomEvent('cors-error', {\n detail: {\n url: url,\n method: method,\n error: error instanceof Error ? error.message : String(error),\n timestamp: new Date(),\n },\n bubbles: true,\n cancelable: false,\n }));\n } else {\n // Dispatch generic network error event\n window.dispatchEvent(new CustomEvent('network-error', {\n detail: {\n url: url,\n method: method,\n error: error instanceof Error ? error.message : String(error),\n timestamp: new Date(),\n },\n bubbles: true,\n cancelable: false,\n }));\n }\n } catch (eventError) {\n // Silently fail - event dispatch should never crash the app\n }\n }\n\n // Wrap other errors as NetworkError\n const networkError = error instanceof Error\n ? new NetworkError(error.message, url, error)\n : new NetworkError('Unknown error', url);\n\n // Detailed logging via logger.logError\n if (this.logger) {\n this.logger.logError(\n {\n method,\n url: url,\n headers,\n body: options?.formData || options?.body,\n timestamp: startTime,\n },\n {\n message: networkError.message,\n duration,\n timestamp: Date.now(),\n }\n );\n }\n\n throw networkError;\n }\n }\n}\n","// Auto-generated by DjangoCFG - see CLAUDE.md\n/**\n * Storage adapters for cross-platform token storage.\n *\n * Supports:\n * - LocalStorage (browser)\n * - Cookies (SSR/browser)\n * - Memory (Node.js/Electron/testing)\n */\n\nimport type { APILogger } from './logger';\n\n/**\n * Storage adapter interface for cross-platform token storage.\n */\nexport interface StorageAdapter {\n getItem(key: string): string | null;\n setItem(key: string, value: string): void;\n removeItem(key: string): void;\n}\n\n/**\n * LocalStorage adapter with safe try-catch for browser environments.\n * Works in modern browsers with localStorage support.\n * \n * Note: This adapter uses window.localStorage and should only be used in browser/client environments.\n * For server-side usage, use MemoryStorageAdapter or CookieStorageAdapter instead.\n */\nexport class LocalStorageAdapter implements StorageAdapter {\n private logger?: APILogger;\n\n constructor(logger?: APILogger) {\n this.logger = logger;\n }\n\n getItem(key: string): string | null {\n try {\n if (typeof window !== 'undefined' && window.localStorage) {\n const value = localStorage.getItem(key);\n this.logger?.debug(`LocalStorage.getItem(\"${key}\"): ${value ? 'found' : 'not found'}`);\n return value;\n }\n this.logger?.warn('LocalStorage not available: window.localStorage is undefined');\n } catch (error) {\n this.logger?.error('LocalStorage.getItem failed:', error);\n }\n return null;\n }\n\n setItem(key: string, value: string): void {\n try {\n if (typeof window !== 'undefined' && window.localStorage) {\n localStorage.setItem(key, value);\n this.logger?.debug(`LocalStorage.setItem(\"${key}\"): success`);\n } else {\n this.logger?.warn('LocalStorage not available: window.localStorage is undefined');\n }\n } catch (error) {\n this.logger?.error('LocalStorage.setItem failed:', error);\n }\n }\n\n removeItem(key: string): void {\n try {\n if (typeof window !== 'undefined' && window.localStorage) {\n localStorage.removeItem(key);\n this.logger?.debug(`LocalStorage.removeItem(\"${key}\"): success`);\n } else {\n this.logger?.warn('LocalStorage not available: window.localStorage is undefined');\n }\n } catch (error) {\n this.logger?.error('LocalStorage.removeItem failed:', error);\n }\n }\n}\n\n/**\n * Cookie-based storage adapter for SSR and browser environments.\n * Useful for Next.js, Nuxt.js, and other SSR frameworks.\n */\nexport class CookieStorageAdapter implements StorageAdapter {\n private logger?: APILogger;\n\n constructor(logger?: APILogger) {\n this.logger = logger;\n }\n\n getItem(key: string): string | null {\n try {\n if (typeof document === 'undefined') {\n this.logger?.warn('Cookies not available: document is undefined (SSR context?)');\n return null;\n }\n const value = `; ${document.cookie}`;\n const parts = value.split(`; ${key}=`);\n if (parts.length === 2) {\n const result = parts.pop()?.split(';').shift() || null;\n this.logger?.debug(`CookieStorage.getItem(\"${key}\"): ${result ? 'found' : 'not found'}`);\n return result;\n }\n this.logger?.debug(`CookieStorage.getItem(\"${key}\"): not found`);\n } catch (error) {\n this.logger?.error('CookieStorage.getItem failed:', error);\n }\n return null;\n }\n\n setItem(key: string, value: string): void {\n try {\n if (typeof document !== 'undefined') {\n document.cookie = `${key}=${value}; path=/; max-age=31536000`;\n this.logger?.debug(`CookieStorage.setItem(\"${key}\"): success`);\n } else {\n this.logger?.warn('Cookies not available: document is undefined (SSR context?)');\n }\n } catch (error) {\n this.logger?.error('CookieStorage.setItem failed:', error);\n }\n }\n\n removeItem(key: string): void {\n try {\n if (typeof document !== 'undefined') {\n document.cookie = `${key}=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT`;\n this.logger?.debug(`CookieStorage.removeItem(\"${key}\"): success`);\n } else {\n this.logger?.warn('Cookies not available: document is undefined (SSR context?)');\n }\n } catch (error) {\n this.logger?.error('CookieStorage.removeItem failed:', error);\n }\n }\n}\n\n/**\n * In-memory storage adapter for Node.js, Electron, and testing environments.\n * Data is stored in RAM and cleared when process exits.\n */\nexport class MemoryStorageAdapter implements StorageAdapter {\n private storage: Map<string, string> = new Map();\n private logger?: APILogger;\n\n constructor(logger?: APILogger) {\n this.logger = logger;\n }\n\n getItem(key: string): string | null {\n const value = this.storage.get(key) || null;\n this.logger?.debug(`MemoryStorage.getItem(\"${key}\"): ${value ? 'found' : 'not found'}`);\n return value;\n }\n\n setItem(key: string, value: string): void {\n this.storage.set(key, value);\n this.logger?.debug(`MemoryStorage.setItem(\"${key}\"): success`);\n }\n\n removeItem(key: string): void {\n this.storage.delete(key);\n this.logger?.debug(`MemoryStorage.removeItem(\"${key}\"): success`);\n }\n}","/**\n * Zod schema for SendPushRequestRequest\n *\n * This schema provides runtime validation and type inference.\n * * Request serializer for sending push notifications.\n * */\nimport { z } from 'zod'\n\n/**\n * Request serializer for sending push notifications.\n */\nexport const SendPushRequestRequestSchema = z.object({\n title: z.string().min(1).max(255),\n body: z.string().min(1),\n icon: z.url().nullable().optional(),\n url: z.url().nullable().optional(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type SendPushRequestRequest = z.infer<typeof SendPushRequestRequestSchema>","/**\n * Zod schema for SendPushResponse\n *\n * This schema provides runtime validation and type inference.\n * * Response serializer for send push endpoint.\n * */\nimport { z } from 'zod'\n\n/**\n * Response serializer for send push endpoint.\n */\nexport const SendPushResponseSchema = z.object({\n success: z.boolean(),\n sent_to: z.int(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type SendPushResponse = z.infer<typeof SendPushResponseSchema>","/**\n * Zod schema for SubscribeRequestRequest\n *\n * This schema provides runtime validation and type inference.\n * * Request serializer for subscribing to push notifications.\n * */\nimport { z } from 'zod'\n\n/**\n * Request serializer for subscribing to push notifications.\n */\nexport const SubscribeRequestRequestSchema = z.object({\n endpoint: z.url(),\n keys: z.record(z.string(), z.string().min(1)),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type SubscribeRequestRequest = z.infer<typeof SubscribeRequestRequestSchema>","/**\n * Zod schema for SubscribeResponse\n *\n * This schema provides runtime validation and type inference.\n * * Response serializer for subscription endpoint.\n * */\nimport { z } from 'zod'\n\n/**\n * Response serializer for subscription endpoint.\n */\nexport const SubscribeResponseSchema = z.object({\n success: z.boolean(),\n subscription_id: z.int(),\n created: z.boolean(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type SubscribeResponse = z.infer<typeof SubscribeResponseSchema>","/**\n * Zod schema for VapidPublicKeyResponse\n *\n * This schema provides runtime validation and type inference.\n * * Response serializer for VAPID public key endpoint.\n * */\nimport { z } from 'zod'\n\n/**\n * Response serializer for VAPID public key endpoint.\n */\nexport const VapidPublicKeyResponseSchema = z.object({\n publicKey: z.string(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type VapidPublicKeyResponse = z.infer<typeof VapidPublicKeyResponseSchema>","// Auto-generated by DjangoCFG - see CLAUDE.md\n/**\n * Typed fetchers for Web Push\n *\n * Universal functions that work in any environment:\n * - Next.js (App Router / Pages Router / Server Components)\n * - React Native\n * - Node.js backend\n *\n * These fetchers use Zod schemas for runtime validation.\n *\n * Usage:\n * ```typescript\n * // Configure API once (in your app entry point)\n * import { configureAPI } from '../../api-instance'\n * configureAPI({ baseUrl: 'https://api.example.com' })\n *\n * // Then use fetchers anywhere\n * const users = await getUsers({ page: 1 })\n *\n * // With SWR\n * const { data } = useSWR(['users', params], () => getUsers(params))\n *\n * // With React Query\n * const { data } = useQuery(['users', params], () => getUsers(params))\n *\n * // In Server Component or SSR (pass custom client)\n * import { API } from '../../index'\n * const api = new API('https://api.example.com')\n * const users = await getUsers({ page: 1 }, api)\n * ```\n */\nimport { consola } from 'consola'\nimport { SendPushRequestRequestSchema, type SendPushRequestRequest } from '../schemas/SendPushRequestRequest.schema'\nimport { SendPushResponseSchema, type SendPushResponse } from '../schemas/SendPushResponse.schema'\nimport { SubscribeRequestRequestSchema, type SubscribeRequestRequest } from '../schemas/SubscribeRequestRequest.schema'\nimport { SubscribeResponseSchema, type SubscribeResponse } from '../schemas/SubscribeResponse.schema'\nimport { VapidPublicKeyResponseSchema, type VapidPublicKeyResponse } from '../schemas/VapidPublicKeyResponse.schema'\nimport { getAPIInstance } from '../../api-instance'\n\n/**\n * Send push notification\n *\n * @method POST\n * @path /cfg/webpush/send/\n */\nexport async function createWebpushSendCreate( data: SendPushRequestRequest, client?: any\n): Promise<SendPushResponse> {\n const api = client || getAPIInstance()\n const response = await api.web_push.webpushSendCreate(data)\n try {\n return SendPushResponseSchema.parse(response)\n } catch (error) {\n // Zod validation error - log detailed information\n consola.error('❌ Zod Validation Failed');\n consola.box(`createWebpushSendCreate\\nPath: /cfg/webpush/send/\\nMethod: POST`);\n\n if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {\n consola.error('Validation Issues:');\n (error as any).issues.forEach((issue: any, index: number) => {\n consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);\n consola.error(` ├─ Message: ${issue.message}`);\n if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);\n if (issue.received) consola.error(` └─ Received: ${issue.received}`);\n });\n }\n\n consola.error('Response data:', response);\n\n // Dispatch browser CustomEvent (only if window is defined)\n if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {\n try {\n const event = new CustomEvent('zod-validation-error', {\n detail: {\n operation: 'createWebpushSendCreate',\n path: '/cfg/webpush/send/',\n method: 'POST',\n error: error,\n response: response,\n timestamp: new Date(),\n },\n bubbles: true,\n cancelable: false,\n });\n window.dispatchEvent(event);\n } catch (eventError) {\n // Silently fail - event dispatch should never crash the app\n consola.warn('Failed to dispatch validation error event:', eventError);\n }\n }\n\n // Re-throw the error\n throw error;\n }\n}\n\n\n/**\n * Subscribe to push notifications\n *\n * @method POST\n * @path /cfg/webpush/subscribe/\n */\nexport async function createWebpushSubscribeCreate( data: SubscribeRequestRequest, client?: any\n): Promise<SubscribeResponse> {\n const api = client || getAPIInstance()\n const response = await api.web_push.webpushSubscribeCreate(data)\n try {\n return SubscribeResponseSchema.parse(response)\n } catch (error) {\n // Zod validation error - log detailed information\n consola.error('❌ Zod Validation Failed');\n consola.box(`createWebpushSubscribeCreate\\nPath: /cfg/webpush/subscribe/\\nMethod: POST`);\n\n if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {\n consola.error('Validation Issues:');\n (error as any).issues.forEach((issue: any, index: number) => {\n consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);\n consola.error(` ├─ Message: ${issue.message}`);\n if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);\n if (issue.received) consola.error(` └─ Received: ${issue.received}`);\n });\n }\n\n consola.error('Response data:', response);\n\n // Dispatch browser CustomEvent (only if window is defined)\n if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {\n try {\n const event = new CustomEvent('zod-validation-error', {\n detail: {\n operation: 'createWebpushSubscribeCreate',\n path: '/cfg/webpush/subscribe/',\n method: 'POST',\n error: error,\n response: response,\n timestamp: new Date(),\n },\n bubbles: true,\n cancelable: false,\n });\n window.dispatchEvent(event);\n } catch (eventError) {\n // Silently fail - event dispatch should never crash the app\n consola.warn('Failed to dispatch validation error event:', eventError);\n }\n }\n\n // Re-throw the error\n throw error;\n }\n}\n\n\n/**\n * Get VAPID public key\n *\n * @method GET\n * @path /cfg/webpush/vapid/\n */\nexport async function getWebpushVapidRetrieve( client?: any\n): Promise<VapidPublicKeyResponse> {\n const api = client || getAPIInstance()\n const response = await api.web_push.webpushVapidRetrieve()\n try {\n return VapidPublicKeyResponseSchema.parse(response)\n } catch (error) {\n // Zod validation error - log detailed information\n consola.error('❌ Zod Validation Failed');\n consola.box(`getWebpushVapidRetrieve\\nPath: /cfg/webpush/vapid/\\nMethod: GET`);\n\n if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {\n consola.error('Validation Issues:');\n (error as any).issues.forEach((issue: any, index: number) => {\n consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);\n consola.error(` ├─ Message: ${issue.message}`);\n if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);\n if (issue.received) consola.error(` └─ Received: ${issue.received}`);\n });\n }\n\n consola.error('Response data:', response);\n\n // Dispatch browser CustomEvent (only if window is defined)\n if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {\n try {\n const event = new CustomEvent('zod-validation-error', {\n detail: {\n operation: 'getWebpushVapidRetrieve',\n path: '/cfg/webpush/vapid/',\n method: 'GET',\n error: error,\n response: response,\n timestamp: new Date(),\n },\n bubbles: true,\n cancelable: false,\n });\n window.dispatchEvent(event);\n } catch (eventError) {\n // Silently fail - event dispatch should never crash the app\n consola.warn('Failed to dispatch validation error event:', eventError);\n }\n }\n\n // Re-throw the error\n throw error;\n }\n}\n\n\n","// Auto-generated by DjangoCFG - see CLAUDE.md\n/**\n * Django CFG API - API Client with JWT Management\n *\n * Usage:\n * ```typescript\n * import { API } from './api';\n *\n * const api = new API('https://api.example.com');\n *\n * // Set JWT token\n * api.setToken('your-jwt-token', 'refresh-token');\n *\n * // Use API\n * const posts = await api.posts.list();\n * const user = await api.users.retrieve(1);\n *\n * // Check authentication\n * if (api.isAuthenticated()) {\n * // ...\n * }\n *\n * // Custom storage with logging (for Electron/Node.js)\n * import { MemoryStorageAdapter, APILogger } from './storage';\n * const logger = new APILogger({ enabled: true, logLevel: 'debug' });\n * const api = new API('https://api.example.com', {\n * storage: new MemoryStorageAdapter(logger),\n * loggerConfig: { enabled: true, logLevel: 'debug' }\n * });\n *\n * // Get OpenAPI schema\n * const schema = api.getSchema();\n * ```\n */\n\nimport { APIClient } from \"./client\";\nimport {\n StorageAdapter,\n LocalStorageAdapter,\n CookieStorageAdapter,\n MemoryStorageAdapter\n} from \"./storage\";\nimport type { RetryConfig } from \"./retry\";\nimport type { LoggerConfig } from \"./logger\";\nimport { APILogger } from \"./logger\";\nimport { WebPush } from \"./webpush__web_push/client\";\nexport * as WebPushTypes from \"./webpush__web_push/models\";\n// Note: Direct exports (export * from) are removed to avoid duplicate type conflicts\n// Use namespace exports like CfgAccountsTypes.User or import from specific modules\n\n// Re-export Zod schemas for runtime validation\nexport * as Schemas from \"./_utils/schemas\";\n// Also export all schemas directly for convenience\nexport * from \"./_utils/schemas\";\n\n// Re-export Zod validation events for browser integration\nexport type { ValidationErrorDetail, ValidationErrorEvent } from \"./validation-events\";\nexport { dispatchValidationError, onValidationError, formatZodError } from \"./validation-events\";\n\n// Re-export typed fetchers for universal usage\nexport * as Fetchers from \"./_utils/fetchers\";\nexport * from \"./_utils/fetchers\";\n\n// Re-export API instance configuration functions\nexport {\n configureAPI,\n getAPIInstance,\n reconfigureAPI,\n clearAPITokens,\n resetAPI,\n isAPIConfigured\n} from \"./api-instance\";\n// NOTE: SWR hooks are generated in ./_utils/hooks/ but NOT exported here to keep\n// the main bundle server-safe. Import hooks directly from the hooks directory:\n// import { useUsers } from './_utils/hooks';\n// Or use a separate entry point like '@djangocfg/api/hooks' for client components.\n\n// Re-export core client\nexport { APIClient };\n\n// Re-export storage adapters for convenience\nexport type { StorageAdapter };\nexport { LocalStorageAdapter, CookieStorageAdapter, MemoryStorageAdapter };\n\n// Re-export error classes for convenience\nexport { APIError, NetworkError } from \"./errors\";\n\n// Re-export HTTP adapters for custom implementations\nexport type { HttpClientAdapter, HttpRequest, HttpResponse } from \"./http\";\nexport { FetchAdapter } from \"./http\";\n\n// Re-export logger types and classes\nexport type { LoggerConfig, RequestLog, ResponseLog, ErrorLog } from \"./logger\";\nexport { APILogger } from \"./logger\";\n\n// Re-export retry configuration and utilities\nexport type { RetryConfig, FailedAttemptInfo } from \"./retry\";\nexport { withRetry, shouldRetry, DEFAULT_RETRY_CONFIG } from \"./retry\";\n\nexport const TOKEN_KEY = \"auth_token\";\nexport const REFRESH_TOKEN_KEY = \"refresh_token\";\n\nexport interface APIOptions {\n /** Custom storage adapter (defaults to LocalStorageAdapter) */\n storage?: StorageAdapter;\n /** Retry configuration for failed requests */\n retryConfig?: RetryConfig;\n /** Logger configuration */\n loggerConfig?: Partial<LoggerConfig>;\n}\n\nexport class API {\n private baseUrl: string;\n private _client: APIClient;\n private _token: string | null = null;\n private _refreshToken: string | null = null;\n private storage: StorageAdapter;\n private options?: APIOptions;\n\n // Sub-clients\n public web_push!: WebPush;\n\n constructor(baseUrl: string, options?: APIOptions) {\n this.baseUrl = baseUrl;\n this.options = options;\n\n // Create logger if config provided\n const logger = options?.loggerConfig ? new APILogger(options.loggerConfig) : undefined;\n\n // Initialize storage with logger\n this.storage = options?.storage || new LocalStorageAdapter(logger);\n\n this._loadTokensFromStorage();\n\n // Initialize APIClient\n this._client = new APIClient(this.baseUrl, {\n retryConfig: this.options?.retryConfig,\n loggerConfig: this.options?.loggerConfig,\n });\n\n // Always inject auth header wrapper (reads token dynamically from storage)\n this._injectAuthHeader();\n\n // Initialize sub-clients from APIClient\n this.web_push = this._client.web_push;\n }\n\n private _loadTokensFromStorage(): void {\n this._token = this.storage.getItem(TOKEN_KEY);\n this._refreshToken = this.storage.getItem(REFRESH_TOKEN_KEY);\n }\n\n private _reinitClients(): void {\n this._client = new APIClient(this.baseUrl, {\n retryConfig: this.options?.retryConfig,\n loggerConfig: this.options?.loggerConfig,\n });\n\n // Always inject auth header wrapper (reads token dynamically from storage)\n this._injectAuthHeader();\n\n // Reinitialize sub-clients\n this.web_push = this._client.web_push;\n }\n\n private _injectAuthHeader(): void {\n // Override request method to inject auth header\n const originalRequest = this._client.request.bind(this._client);\n this._client.request = async <T>(\n method: string,\n path: string,\n options?: { params?: Record<string, any>; body?: any; formData?: FormData; headers?: Record<string, string> }\n ): Promise<T> => {\n // Read token from storage dynamically (supports JWT injection after instantiation)\n const token = this.getToken();\n const mergedOptions = {\n ...options,\n headers: {\n ...(options?.headers || {}),\n ...(token ? { 'Authorization': `Bearer ${token}` } : {}),\n },\n };\n\n return originalRequest(method, path, mergedOptions);\n };\n }\n\n /**\n * Get current JWT token\n */\n getToken(): string | null {\n return this.storage.getItem(TOKEN_KEY);\n }\n\n /**\n * Get current refresh token\n */\n getRefreshToken(): string | null {\n return this.storage.getItem(REFRESH_TOKEN_KEY);\n }\n\n /**\n * Set JWT token and refresh token\n * @param token - JWT access token\n * @param refreshToken - JWT refresh token (optional)\n */\n setToken(token: string, refreshToken?: string): void {\n this._token = token;\n this.storage.setItem(TOKEN_KEY, token);\n\n if (refreshToken) {\n this._refreshToken = refreshToken;\n this.storage.setItem(REFRESH_TOKEN_KEY, refreshToken);\n }\n\n // Reinitialize clients with new token\n this._reinitClients();\n }\n\n /**\n * Clear all tokens\n */\n clearTokens(): void {\n this._token = null;\n this._refreshToken = null;\n this.storage.removeItem(TOKEN_KEY);\n this.storage.removeItem(REFRESH_TOKEN_KEY);\n\n // Reinitialize clients without token\n this._reinitClients();\n }\n\n /**\n * Check if user is authenticated\n */\n isAuthenticated(): boolean {\n return !!this.getToken();\n }\n\n /**\n * Update base URL and reinitialize clients\n * @param url - New base URL\n */\n setBaseUrl(url: string): void {\n this.baseUrl = url;\n this._reinitClients();\n }\n\n /**\n * Get current base URL\n */\n getBaseUrl(): string {\n return this.baseUrl;\n }\n\n /**\n * Get OpenAPI schema path\n * @returns Path to the OpenAPI schema JSON file\n *\n * Note: The OpenAPI schema is available in the schema.json file.\n * You can load it dynamically using:\n * ```typescript\n * const schema = await fetch('./schema.json').then(r => r.json());\n * // or using fs in Node.js:\n * // const schema = JSON.parse(fs.readFileSync('./schema.json', 'utf-8'));\n * ```\n */\n getSchemaPath(): string {\n return './schema.json';\n }\n}\n\nexport default API;","/**\n * @djangocfg/api - Shared API Package\n *\n * Core authentication API (cfg_accounts only).\n * Extensions are now in separate packages:\n * - @djangocfg/ext-support\n * - @djangocfg/ext-payments\n * - etc.\n */\n\n// ============================================================================\n// Main API from cfg_accounts (authentication)\n// ============================================================================\nexport * from './generated/cfg_accounts';\nexport { API, LocalStorageAdapter, MemoryStorageAdapter } from './generated/cfg_accounts';\nexport { Schemas, Fetchers, Enums } from './generated/cfg_accounts';\n\n// ============================================================================\n// CFG Accounts Type Namespace\n// ============================================================================\nexport * as CfgAccountsTypes from './generated/cfg_accounts';\n\n// ============================================================================\n// Centrifugo Fetchers (for WebSocket token refresh)\n// ============================================================================\nexport { getCentrifugoAuthTokenRetrieve } from './generated/cfg_centrifugo';\n\n// ============================================================================\n// WebPush API (for push notifications)\n// ============================================================================\nexport { API as WebPushAPI } from './generated/cfg_webpush';\nexport * as WebPushTypes from './generated/cfg_webpush';\n\n/**\n * Base Client for all API services\n *\n * Provides:\n * - Centralized API instance with JWT token management\n * - LocalStorage adapter for browser environments\n * - Singleton pattern for API client\n */\n\nimport { API, LocalStorageAdapter } from './generated/cfg_accounts';\n\n/**\n * Singleton API instance with JWT token management\n * Uses LocalStorage for token persistence\n */\nconst isStaticBuild = process.env.NEXT_PUBLIC_STATIC_BUILD === 'true';\nconst apiUrl = isStaticBuild ? '' : process.env.NEXT_PUBLIC_API_URL || '';\n\nconst api = new API(\n apiUrl,\n {\n storage: new LocalStorageAdapter()\n }\n);\n\n/**\n * Base Client Class\n *\n * Service classes can extend this to access api instance\n */\nexport class BaseClient {\n protected static api = api;\n}\n\n/**\n * Export API instance for direct access\n */\nexport { api };\n","import { createConsola } from 'consola';\n\n/**\n * Universal logger for @djangocfg/api/auth\n * Uses consola for beautiful console logging\n *\n * Log levels:\n * - 0: silent\n * - 1: fatal, error\n * - 2: warn\n * - 3: log, info\n * - 4: debug\n * - 5: trace, verbose\n */\nconst isDevelopment = process.env.NODE_ENV === 'development';\nconst isStaticBuild = process.env.NEXT_PUBLIC_STATIC_BUILD === 'true';\nconst showLogs = isDevelopment || isStaticBuild;\n\nexport const logger = createConsola({\n level: showLogs ? 4 : 1, // dev: debug, production: errors only\n}).withTag('api');\n\n/**\n * Auth-specific logger\n */\nexport const authLogger = logger.withTag('auth');\n\nexport default logger;\n","\"use client\"\n\n/**\n * Base64 Encoding/Decoding Hook\n *\n * Provides base64 encoding/decoding with dev mode detection:\n * - In production: encodes data to base64\n * - In development: returns data as-is (no encoding)\n */\n\nconst isDev = process.env.NODE_ENV === 'development';\n\n/**\n * Encode string to base64\n * @param data - String data to encode\n * @returns Base64 encoded string (or original in dev mode)\n */\nexport function encodeBase64(data: string): string {\n if (isDev) {\n return data;\n }\n\n try {\n // Browser-safe base64 encoding\n if (typeof window !== 'undefined') {\n return btoa(encodeURIComponent(data).replace(/%([0-9A-F]{2})/g, (_, p1) => {\n return String.fromCharCode(parseInt(p1, 16));\n }));\n }\n // Node.js fallback\n return Buffer.from(data, 'utf-8').toString('base64');\n } catch (error) {\n console.error('Base64 encoding error:', error);\n return data; // Return original on error\n }\n}\n\n/**\n * Decode base64 to string\n * @param encoded - Base64 encoded string\n * @returns Decoded string (or original in dev mode)\n */\nexport function decodeBase64(encoded: string): string {\n if (isDev) {\n return encoded;\n }\n\n try {\n // Browser-safe base64 decoding\n if (typeof window !== 'undefined') {\n const binary = atob(encoded);\n const bytes = new Uint8Array(binary.length);\n for (let i = 0; i < binary.length; i++) {\n bytes[i] = binary.charCodeAt(i);\n }\n return decodeURIComponent(\n Array.from(bytes)\n .map(byte => '%' + ('00' + byte.toString(16)).slice(-2))\n .join('')\n );\n }\n // Node.js fallback\n return Buffer.from(encoded, 'base64').toString('utf-8');\n } catch (error) {\n console.error('Base64 decoding error:', error);\n return encoded; // Return original on error\n }\n}\n\n/**\n * Hook for base64 encoding/decoding\n * @returns Object with encode and decode functions\n */\nexport function useBase64() {\n return {\n encode: encodeBase64,\n decode: decodeBase64,\n isDev,\n };\n}\n","\"use client\"\n\n/**\n * Profile Cache Hook\n *\n * Provides localStorage-based caching for user profile with:\n * - TTL (Time To Live) - default 1 hour\n * - Version control for migrations\n * - Automatic invalidation on expiry\n */\n\nimport type { User } from '../../';\nimport { authLogger as profileLogger } from '../utils/logger';\nimport { decodeBase64, encodeBase64 } from './useBase64';\n\n// Cache configuration\nconst CACHE_KEY = 'user_profile_cache';\nconst CACHE_VERSION = 1;\nconst DEFAULT_TTL = 3600000; // 1 hour in milliseconds\n\nexport interface ProfileCacheOptions {\n /** Time to live in milliseconds (default: 1 hour) */\n ttl?: number;\n}\n\ninterface CachedProfile {\n version: number;\n data: User;\n timestamp: number;\n ttl: number;\n}\n\n/**\n * Get cached profile from localStorage\n * @returns User profile if valid cache exists, null otherwise\n */\nexport function getCachedProfile(): User | null {\n try {\n if (typeof window === 'undefined') return null;\n\n const cached = localStorage.getItem(CACHE_KEY);\n if (!cached) {\n profileLogger.debug('No cached profile found');\n return null;\n }\n\n // Decode from base64\n const decoded = decodeBase64(cached);\n const cachedData: CachedProfile = JSON.parse(decoded);\n\n // Version check\n if (cachedData.version !== CACHE_VERSION) {\n profileLogger.warn('Cache version mismatch, clearing cache');\n clearProfileCache();\n return null;\n }\n\n // TTL check\n const now = Date.now();\n const age = now - cachedData.timestamp;\n if (age > cachedData.ttl) {\n profileLogger.info('Cache expired, clearing');\n clearProfileCache();\n return null;\n }\n\n profileLogger.debug('Cache hit, age:', Math.round(age / 1000), 'seconds');\n return cachedData.data;\n } catch (error) {\n profileLogger.error('Error reading cache:', error);\n clearProfileCache();\n return null;\n }\n}\n\n/**\n * Save profile to localStorage cache\n * @param profile - User profile to cache\n * @param options - Cache options (TTL)\n */\nexport function setCachedProfile(profile: User, options?: ProfileCacheOptions): void {\n try {\n if (typeof window === 'undefined') return;\n\n const cachedData: CachedProfile = {\n version: CACHE_VERSION,\n data: profile,\n timestamp: Date.now(),\n ttl: options?.ttl || DEFAULT_TTL,\n };\n\n // Encode to base64\n const encoded = encodeBase64(JSON.stringify(cachedData));\n localStorage.setItem(CACHE_KEY, encoded);\n profileLogger.debug('Profile cached, TTL:', cachedData.ttl / 1000, 'seconds');\n } catch (error) {\n profileLogger.error('Error writing cache:', error);\n }\n}\n\n/**\n * Clear profile cache from localStorage\n */\nexport function clearProfileCache(): void {\n try {\n if (typeof window === 'undefined') return;\n localStorage.removeItem(CACHE_KEY);\n profileLogger.debug('Cache cleared');\n } catch (error) {\n profileLogger.error('Error clearing cache:', error);\n }\n}\n\n/**\n * Check if cached profile is valid (exists and not expired)\n */\nexport function hasValidCache(): boolean {\n return getCachedProfile() !== null;\n}\n\n/**\n * Get cache metadata (age, TTL, etc.)\n */\nexport function getCacheMetadata(): {\n exists: boolean;\n age?: number;\n ttl?: number;\n expiresIn?: number;\n} | null {\n try {\n if (typeof window === 'undefined') return null;\n\n const cached = localStorage.getItem(CACHE_KEY);\n if (!cached) return { exists: false };\n\n // Decode from base64\n const decoded = decodeBase64(cached);\n const cachedData: CachedProfile = JSON.parse(decoded);\n const now = Date.now();\n const age = now - cachedData.timestamp;\n const expiresIn = cachedData.ttl - age;\n\n return {\n exists: true,\n age,\n ttl: cachedData.ttl,\n expiresIn: Math.max(0, expiresIn),\n };\n } catch (error) {\n profileLogger.error('Error reading metadata:', error);\n return null;\n }\n}\n","'use client';\n\nimport { useState } from 'react';\n\nimport { authLogger } from '../utils/logger';\n\n/**\n * Simple sessionStorage hook with better error handling\n * @param key - Storage key\n * @param initialValue - Default value if key doesn't exist\n * @returns [value, setValue, removeValue] - Current value, setter function, and remove function\n */\nexport function useSessionStorage<T>(key: string, initialValue: T) {\n // Get initial value from sessionStorage or use provided initialValue\n const [storedValue, setStoredValue] = useState<T>(() => {\n if (typeof window === 'undefined') {\n return initialValue;\n }\n\n try {\n const item = window.sessionStorage.getItem(key);\n return item ? JSON.parse(item) : initialValue;\n } catch (error) {\n authLogger.error(`Error reading sessionStorage key \"${key}\":`, error);\n return initialValue;\n }\n });\n\n // Check data size and limit\n const checkDataSize = (data: any): boolean => {\n try {\n const jsonString = JSON.stringify(data);\n const sizeInBytes = new Blob([jsonString]).size;\n const sizeInKB = sizeInBytes / 1024;\n \n // Limit to 1MB per item\n if (sizeInKB > 1024) {\n authLogger.warn(`Data size (${sizeInKB.toFixed(2)}KB) exceeds 1MB limit for key \"${key}\"`);\n return false;\n }\n\n return true;\n } catch (error) {\n authLogger.error(`Error checking data size for key \"${key}\":`, error);\n return false;\n }\n };\n\n // Clear old data when sessionStorage is full\n const clearOldData = () => {\n try {\n const keys = Object.keys(sessionStorage).filter(key => key && typeof key === 'string');\n // Remove oldest items if we have more than 50 items\n if (keys.length > 50) {\n const itemsToRemove = Math.ceil(keys.length * 0.2);\n for (let i = 0; i < itemsToRemove; i++) {\n try {\n const key = keys[i];\n if (key) {\n sessionStorage.removeItem(key);\n sessionStorage.removeItem(`${key}_timestamp`);\n }\n } catch {\n // Ignore errors when removing items\n }\n }\n }\n } catch (error) {\n authLogger.error('Error clearing old sessionStorage data:', error);\n }\n };\n\n // Force clear all data if quota is exceeded\n const forceClearAll = () => {\n try {\n const keys = Object.keys(sessionStorage);\n for (const key of keys) {\n try {\n sessionStorage.removeItem(key);\n } catch {\n // Ignore errors when removing items\n }\n }\n } catch (error) {\n authLogger.error('Error force clearing sessionStorage:', error);\n }\n };\n\n // Update sessionStorage when value changes\n const setValue = (value: T | ((val: T) => T)) => {\n try {\n const valueToStore = value instanceof Function ? value(storedValue) : value;\n \n // Check data size before attempting to save\n if (!checkDataSize(valueToStore)) {\n authLogger.warn(`Data size too large for key \"${key}\", removing key`);\n // Remove the key if data is too large\n try {\n window.sessionStorage.removeItem(key);\n window.sessionStorage.removeItem(`${key}_timestamp`);\n } catch {\n // Ignore errors when removing\n }\n // Still update the state\n setStoredValue(valueToStore);\n return;\n }\n \n setStoredValue(valueToStore);\n\n if (typeof window !== 'undefined') {\n // Try to set the value\n try {\n window.sessionStorage.setItem(key, JSON.stringify(valueToStore));\n // Add timestamp for cleanup\n window.sessionStorage.setItem(`${key}_timestamp`, Date.now().toString());\n } catch (storageError: any) {\n // If quota exceeded, clear old data and try again\n if (storageError.name === 'QuotaExceededError' ||\n storageError.code === 22 ||\n storageError.message?.includes('quota')) {\n authLogger.warn('sessionStorage quota exceeded, clearing old data...');\n clearOldData();\n \n // Try again after clearing\n try {\n window.sessionStorage.setItem(key, JSON.stringify(valueToStore));\n window.sessionStorage.setItem(`${key}_timestamp`, Date.now().toString());\n } catch (retryError) {\n authLogger.error(`Failed to set sessionStorage key \"${key}\" after clearing old data:`, retryError);\n // If still fails, force clear all and try one more time\n try {\n forceClearAll();\n window.sessionStorage.setItem(key, JSON.stringify(valueToStore));\n window.sessionStorage.setItem(`${key}_timestamp`, Date.now().toString());\n } catch (finalError) {\n authLogger.error(`Failed to set sessionStorage key \"${key}\" after force clearing:`, finalError);\n // If still fails, just update the state without sessionStorage\n setStoredValue(valueToStore);\n }\n }\n } else {\n throw storageError;\n }\n }\n }\n } catch (error) {\n authLogger.error(`Error setting sessionStorage key \"${key}\":`, error);\n // Still update the state even if sessionStorage fails\n const valueToStore = value instanceof Function ? value(storedValue) : value;\n setStoredValue(valueToStore);\n }\n };\n\n // Remove value from sessionStorage\n const removeValue = () => {\n try {\n setStoredValue(initialValue);\n if (typeof window !== 'undefined') {\n try {\n window.sessionStorage.removeItem(key);\n window.sessionStorage.removeItem(`${key}_timestamp`);\n } catch (removeError: any) {\n // If removal fails due to quota, try to clear some data first\n if (removeError.name === 'QuotaExceededError' ||\n removeError.code === 22 ||\n removeError.message?.includes('quota')) {\n authLogger.warn('sessionStorage quota exceeded during removal, clearing old data...');\n clearOldData();\n \n try {\n window.sessionStorage.removeItem(key);\n window.sessionStorage.removeItem(`${key}_timestamp`);\n } catch (retryError) {\n authLogger.error(`Failed to remove sessionStorage key \"${key}\" after clearing:`, retryError);\n // If still fails, force clear all\n forceClearAll();\n }\n } else {\n throw removeError;\n }\n }\n }\n } catch (error) {\n authLogger.error(`Error removing sessionStorage key \"${key}\":`, error);\n }\n };\n\n return [storedValue, setValue, removeValue] as const;\n}\n","import { useSessionStorage } from './useSessionStorage';\n\nconst AUTH_REDIRECT_KEY = 'auth_redirect_url';\n\nexport interface AuthRedirectOptions {\n fallbackUrl?: string;\n clearOnUse?: boolean;\n}\n\n/**\n * Read redirect URL directly from sessionStorage (bypasses React state)\n * This is needed because different component instances have different React states\n */\nconst getRedirectFromStorage = (): string => {\n if (typeof window === 'undefined') return '';\n try {\n const item = window.sessionStorage.getItem(AUTH_REDIRECT_KEY);\n return item ? JSON.parse(item) : '';\n } catch {\n return '';\n }\n};\n\n/**\n * Clear redirect URL directly from sessionStorage\n */\nconst clearRedirectFromStorage = (): void => {\n if (typeof window === 'undefined') return;\n try {\n window.sessionStorage.removeItem(AUTH_REDIRECT_KEY);\n window.sessionStorage.removeItem(`${AUTH_REDIRECT_KEY}_timestamp`);\n } catch {\n // Ignore errors\n }\n};\n\nexport const useAuthRedirectManager = (options: AuthRedirectOptions = {}) => {\n const { fallbackUrl = '/dashboard', clearOnUse = true } = options;\n const [redirectUrl, setRedirectUrl, removeRedirectUrl] = useSessionStorage<string>(AUTH_REDIRECT_KEY, '');\n\n const setRedirect = (url: string) => {\n setRedirectUrl(url);\n };\n\n const getRedirect = () => {\n // Read directly from storage to get latest value across components\n return getRedirectFromStorage() || redirectUrl;\n };\n\n const clearRedirect = () => {\n removeRedirectUrl();\n clearRedirectFromStorage();\n };\n\n const hasRedirect = () => {\n const stored = getRedirectFromStorage();\n return stored.length > 0 || redirectUrl.length > 0;\n };\n\n const getFinalRedirectUrl = () => {\n // Read directly from storage to get latest value across components\n const stored = getRedirectFromStorage();\n return stored || redirectUrl || fallbackUrl;\n };\n\n const useAndClearRedirect = () => {\n // Read directly from storage to ensure we get the latest saved URL\n // even if it was saved by a different component instance\n const stored = getRedirectFromStorage();\n const finalUrl = stored || redirectUrl || fallbackUrl;\n\n if (clearOnUse) {\n clearRedirect();\n }\n return finalUrl;\n };\n\n return {\n redirectUrl,\n setRedirect,\n getRedirect,\n clearRedirect,\n hasRedirect,\n getFinalRedirectUrl,\n useAndClearRedirect\n };\n}; ","/**\n * Analytics stub for @djangocfg/api/auth\n * Provides minimal analytics interface without external dependencies\n *\n * If you need full analytics, install @djangocfg/layouts and use its Analytics module\n */\n\nexport enum AnalyticsEvent {\n AUTH_OTP_REQUEST = 'auth_otp_request',\n AUTH_LOGIN_SUCCESS = 'auth_login_success',\n AUTH_OTP_VERIFY_FAIL = 'auth_otp_verify_fail',\n AUTH_SESSION_EXPIRED = 'auth_session_expired',\n AUTH_TOKEN_REFRESH = 'auth_token_refresh',\n AUTH_TOKEN_REFRESH_FAIL = 'auth_token_refresh_fail',\n AUTH_LOGOUT = 'auth_logout',\n AUTH_OAUTH_START = 'auth_oauth_start',\n AUTH_OAUTH_FAIL = 'auth_oauth_fail',\n}\n\nexport enum AnalyticsCategory {\n AUTH = 'auth',\n}\n\nexport type AnalyticsEventType = `${AnalyticsEvent}`;\nexport type AnalyticsCategoryType = `${AnalyticsCategory}`;\n\ninterface AnalyticsEventParams {\n category?: AnalyticsCategoryType;\n label?: string;\n value?: number;\n [key: string]: any;\n}\n\n/**\n * Minimal analytics implementation\n * Logs to console in development, silent in production\n */\nexport const Analytics = {\n /**\n * Track an analytics event\n */\n event(eventName: AnalyticsEventType, params?: AnalyticsEventParams) {\n if (process.env.NODE_ENV === 'development') {\n console.log('[Analytics]', eventName, params);\n }\n\n // You can extend this to send to your analytics service\n // Example: window.gtag?.('event', eventName, params);\n },\n\n /**\n * Set user ID for tracking\n */\n setUser(userId: string) {\n if (process.env.NODE_ENV === 'development') {\n console.log('[Analytics] Set user:', userId);\n }\n\n // You can extend this to send to your analytics service\n // Example: window.gtag?.('set', { user_id: userId });\n },\n};\n","/**\n * Accounts Context\n *\n * Manages user authentication and profile operations using generated SWR hooks\n *\n * Features:\n * - OTP-based authentication\n * - User profile management\n * - Avatar upload\n * - Profile updates\n * - localStorage cache with TTL (1 hour)\n */\n\n\"use client\";\n\nimport {\n createContext, ReactNode, useCallback, useContext, useEffect, useRef, useState\n} from 'react';\n\n// Import API instance and fetcher\nimport { api as apiAccounts, getAccountsProfileRetrieve } from '../../';\n// Import schema\nimport { PatchedUserProfileUpdateRequestSchema } from '../../generated/cfg_accounts';\n// Import hooks from generated API hooks\nimport {\n useCreateAccountsOtpRequestCreate, useCreateAccountsOtpVerifyCreate,\n useCreateAccountsProfileAvatarCreate, useCreateAccountsTokenRefreshCreate,\n usePartialUpdateAccountsProfilePartialUpdate, useUpdateAccountsProfileUpdateUpdate\n} from '../../generated/cfg_accounts/_utils/hooks';\nimport { clearProfileCache, getCachedProfile, setCachedProfile } from '../hooks/useProfileCache';\nimport { authLogger } from '../utils/logger';\n\n// Import types from generated API\nimport type {\n User,\n UserProfileUpdateRequest,\n PatchedUserProfileUpdateRequest,\n OTPRequestRequest,\n OTPVerifyRequest,\n OTPRequestResponse,\n OTPVerifyResponse,\n TokenRefresh,\n API,\n} from '../../generated/cfg_accounts';\n// Re-export schemas for external use\nexport { PatchedUserProfileUpdateRequestSchema };\nexport type { PatchedUserProfileUpdateRequest };\n\n// ─────────────────────────────────────────────────────────────────────────\n// Context Type\n// ─────────────────────────────────────────────────────────────────────────\n\nexport interface AccountsContextValue {\n // Current user profile\n profile?: User;\n isLoadingProfile: boolean;\n profileError: Error | null;\n\n // Profile operations\n updateProfile: (data: UserProfileUpdateRequest) => Promise<User>;\n partialUpdateProfile: (data: PatchedUserProfileUpdateRequest) => Promise<User>;\n uploadAvatar: (formData: FormData) => Promise<User>;\n refreshProfile: (callerId?: string) => Promise<User | undefined>;\n\n // Authentication\n requestOTP: (data: OTPRequestRequest) => Promise<OTPRequestResponse>;\n verifyOTP: (data: OTPVerifyRequest) => Promise<OTPVerifyResponse>;\n refreshToken: (refresh: string) => Promise<TokenRefresh>;\n logout: () => void;\n}\n\n// ─────────────────────────────────────────────────────────────────────────\n// Context\n// ─────────────────────────────────────────────────────────────────────────\n\nconst AccountsContext = createContext<AccountsContextValue | undefined>(undefined);\n\n// ─────────────────────────────────────────────────────────────────────────\n// Provider Component\n// ─────────────────────────────────────────────────────────────────────────\n\ninterface AccountsProviderProps {\n children: ReactNode;\n}\n\nexport function AccountsProvider({ children }: AccountsProviderProps) {\n // State management with localStorage cache\n const [profile, setProfile] = useState<User | undefined>(() => {\n // Initialize from cache on mount\n const cached = getCachedProfile();\n return cached || undefined;\n });\n const [isLoadingProfile, setIsLoadingProfile] = useState(false);\n const [profileError, setProfileError] = useState<Error | null>(null);\n\n // Use refs to access current state without adding to dependencies\n const profileRef = useRef<User | undefined>(profile);\n const isLoadingRef = useRef(false);\n\n // Keep refs in sync with state\n useEffect(() => {\n profileRef.current = profile;\n }, [profile]);\n\n useEffect(() => {\n isLoadingRef.current = isLoadingProfile;\n }, [isLoadingProfile]);\n\n // Mutation hooks\n const updateMutation = useUpdateAccountsProfileUpdateUpdate();\n const partialUpdateMutation = usePartialUpdateAccountsProfilePartialUpdate();\n const avatarMutation = useCreateAccountsProfileAvatarCreate();\n const otpRequestMutation = useCreateAccountsOtpRequestCreate();\n const otpVerifyMutation = useCreateAccountsOtpVerifyCreate();\n const tokenRefreshMutation = useCreateAccountsTokenRefreshCreate();\n\n // Refresh profile - fetch and cache with stable callback\n const refreshProfile = useCallback(async (callerId?: string): Promise<User | undefined> => {\n // Use refs to check current state without creating dependency\n const currentProfile = profileRef.current;\n const currentLoading = isLoadingRef.current;\n\n // Prevent duplicate calls if profile is already loaded and not loading\n if (currentProfile && !currentLoading) {\n authLogger.debug(`Profile already loaded, returning cached (caller: ${callerId})`);\n return currentProfile;\n }\n\n setIsLoadingProfile(true);\n isLoadingRef.current = true;\n setProfileError(null);\n try {\n // Log caller for debugging excessive API calls using consola logger\n if (callerId) {\n authLogger.debug(`Profile refresh called by: ${callerId}`);\n }\n const result = await getAccountsProfileRetrieve(apiAccounts);\n setProfile(result);\n profileRef.current = result;\n // Save to cache with 1 hour TTL\n setCachedProfile(result);\n return result;\n } catch (error) {\n const err = error instanceof Error ? error : new Error('Failed to fetch profile');\n setProfileError(err);\n throw err;\n } finally {\n setIsLoadingProfile(false);\n isLoadingRef.current = false;\n }\n }, []); // Empty dependencies - callback is stable\n\n // Update profile (full)\n const updateProfile = async (data: UserProfileUpdateRequest): Promise<User> => {\n const result = await updateMutation(data, apiAccounts);\n await refreshProfile('AccountsContext.updateProfile');\n return result as User;\n };\n\n // Partial update profile\n const partialUpdateProfile = async (data: PatchedUserProfileUpdateRequest): Promise<User> => {\n const result = await partialUpdateMutation(data, apiAccounts);\n await refreshProfile('AccountsContext.partialUpdateProfile');\n return result as User;\n };\n\n // Upload avatar\n const uploadAvatar = async (formData: FormData): Promise<User> => {\n const result = await avatarMutation(formData, apiAccounts);\n await refreshProfile('AccountsContext.uploadAvatar');\n return result as User;\n };\n\n // Request OTP\n const requestOTP = async (data: OTPRequestRequest): Promise<OTPRequestResponse> => {\n const result = await otpRequestMutation(data, apiAccounts);\n return result as OTPRequestResponse;\n };\n\n // Verify OTP\n const verifyOTP = async (data: OTPVerifyRequest): Promise<OTPVerifyResponse> => {\n const result = await otpVerifyMutation(data, apiAccounts);\n\n // Automatically save tokens after successful verification\n if (result.access && result.refresh) {\n apiAccounts.setToken(result.access, result.refresh);\n // Refresh profile to load user data with new token\n await refreshProfile('AccountsContext.verifyOTP');\n }\n\n return result as OTPVerifyResponse;\n };\n\n // Refresh token\n const refreshToken = async (refresh: string): Promise<TokenRefresh> => {\n const result = await tokenRefreshMutation({ refresh }, apiAccounts);\n\n // Automatically save new access token\n if (result.access) {\n apiAccounts.setToken(result.access, refresh);\n }\n\n return result as TokenRefresh;\n };\n\n // Logout - clear tokens, profile state, and cache\n const logout = useCallback(() => {\n apiAccounts.clearTokens();\n setProfile(undefined);\n setProfileError(null);\n clearProfileCache();\n }, []);\n\n const value: AccountsContextValue = {\n profile,\n isLoadingProfile,\n profileError,\n updateProfile,\n partialUpdateProfile,\n uploadAvatar,\n refreshProfile,\n requestOTP,\n verifyOTP,\n refreshToken,\n logout,\n };\n\n return (\n <AccountsContext.Provider value={value}>\n {children}\n </AccountsContext.Provider>\n );\n}\n\n// ─────────────────────────────────────────────────────────────────────────\n// Hook\n// ─────────────────────────────────────────────────────────────────────────\n\nexport function useAccountsContext(): AccountsContextValue {\n const context = useContext(AccountsContext);\n if (!context) {\n throw new Error('useAccountsContext must be used within AccountsProvider');\n }\n return context;\n}\n","// Auto-generated by DjangoCFG - see CLAUDE.md\n'use client';\n\n/**\n * SWR Hooks for Auth\n *\n * React hooks powered by SWR for data fetching with automatic caching,\n * revalidation, and optimistic updates.\n *\n * Usage:\n * ```typescript\n * // Query hooks (GET)\n * const { data, error, isLoading } = useUsers({ page: 1 })\n *\n * // Mutation hooks (POST/PUT/PATCH/DELETE)\n * const createUser = useCreateUser()\n * await createUser({ name: 'John', email: 'john@example.com' })\n * ```\n */\nimport { useSWRConfig } from 'swr'\nimport * as Fetchers from '../fetchers/accounts__auth'\nimport type { API } from '../../index'\nimport type { TokenRefresh } from '../schemas/TokenRefresh.schema'\nimport type { TokenRefreshRequest } from '../schemas/TokenRefreshRequest.schema'\n\n/**\n * API operation\n *\n * @method POST\n * @path /cfg/accounts/token/refresh/\n */\nexport function useCreateAccountsTokenRefreshCreate() {\n const { mutate } = useSWRConfig()\n\n return async (data: TokenRefreshRequest, client?: API): Promise<TokenRefresh> => {\n const result = await Fetchers.createAccountsTokenRefreshCreate(data, client)\n // Revalidate related queries\n mutate('cfg-accounts-token-refresh')\n return result\n }\n}\n\n\n","// Auto-generated by DjangoCFG - see CLAUDE.md\n'use client';\n\n/**\n * SWR Hooks for Oauth\n *\n * React hooks powered by SWR for data fetching with automatic caching,\n * revalidation, and optimistic updates.\n *\n * Usage:\n * ```typescript\n * // Query hooks (GET)\n * const { data, error, isLoading } = useUsers({ page: 1 })\n *\n * // Mutation hooks (POST/PUT/PATCH/DELETE)\n * const createUser = useCreateUser()\n * await createUser({ name: 'John', email: 'john@example.com' })\n * ```\n */\nimport useSWR from 'swr'\nimport { useSWRConfig } from 'swr'\nimport * as Fetchers from '../fetchers/accounts__oauth'\nimport type { API } from '../../index'\nimport type { OAuthAuthorizeRequestRequest } from '../schemas/OAuthAuthorizeRequestRequest.schema'\nimport type { OAuthAuthorizeResponse } from '../schemas/OAuthAuthorizeResponse.schema'\nimport type { OAuthCallbackRequestRequest } from '../schemas/OAuthCallbackRequestRequest.schema'\nimport type { OAuthDisconnectRequestRequest } from '../schemas/OAuthDisconnectRequestRequest.schema'\nimport type { OAuthProvidersResponse } from '../schemas/OAuthProvidersResponse.schema'\nimport type { OAuthTokenResponse } from '../schemas/OAuthTokenResponse.schema'\n\n/**\n * List OAuth connections\n *\n * @method GET\n * @path /cfg/accounts/oauth/connections/\n */\nexport function useAccountsOauthConnectionsList(client?: API): ReturnType<typeof useSWR<any>> {\n return useSWR<any>(\n 'cfg-accounts-oauth-connections',\n () => Fetchers.getAccountsOauthConnectionsList(client)\n )\n}\n\n\n/**\n * Disconnect OAuth provider\n *\n * @method POST\n * @path /cfg/accounts/oauth/disconnect/\n */\nexport function useCreateAccountsOauthDisconnectCreate() {\n const { mutate } = useSWRConfig()\n\n return async (data: OAuthDisconnectRequestRequest, client?: API): Promise<any> => {\n const result = await Fetchers.createAccountsOauthDisconnectCreate(data, client)\n // Revalidate related queries\n mutate('cfg-accounts-oauth-disconnect')\n return result\n }\n}\n\n\n/**\n * Start GitHub OAuth\n *\n * @method POST\n * @path /cfg/accounts/oauth/github/authorize/\n */\nexport function useCreateAccountsOauthGithubAuthorizeCreate() {\n const { mutate } = useSWRConfig()\n\n return async (data: OAuthAuthorizeRequestRequest, client?: API): Promise<OAuthAuthorizeResponse> => {\n const result = await Fetchers.createAccountsOauthGithubAuthorizeCreate(data, client)\n // Revalidate related queries\n mutate('cfg-accounts-oauth-github-authorize')\n return result\n }\n}\n\n\n/**\n * Complete GitHub OAuth\n *\n * @method POST\n * @path /cfg/accounts/oauth/github/callback/\n */\nexport function useCreateAccountsOauthGithubCallbackCreate() {\n const { mutate } = useSWRConfig()\n\n return async (data: OAuthCallbackRequestRequest, client?: API): Promise<OAuthTokenResponse> => {\n const result = await Fetchers.createAccountsOauthGithubCallbackCreate(data, client)\n // Revalidate related queries\n mutate('cfg-accounts-oauth-github-callback')\n return result\n }\n}\n\n\n/**\n * List OAuth providers\n *\n * @method GET\n * @path /cfg/accounts/oauth/providers/\n */\nexport function useAccountsOauthProvidersRetrieve(client?: API): ReturnType<typeof useSWR<OAuthProvidersResponse>> {\n return useSWR<OAuthProvidersResponse>(\n 'cfg-accounts-oauth-provider',\n () => Fetchers.getAccountsOauthProvidersRetrieve(client)\n )\n}\n\n\n","// Auto-generated by DjangoCFG - see CLAUDE.md\n'use client';\n\n/**\n * SWR Hooks for User Profile\n *\n * React hooks powered by SWR for data fetching with automatic caching,\n * revalidation, and optimistic updates.\n *\n * Usage:\n * ```typescript\n * // Query hooks (GET)\n * const { data, error, isLoading } = useUsers({ page: 1 })\n *\n * // Mutation hooks (POST/PUT/PATCH/DELETE)\n * const createUser = useCreateUser()\n * await createUser({ name: 'John', email: 'john@example.com' })\n * ```\n */\nimport useSWR from 'swr'\nimport { useSWRConfig } from 'swr'\nimport * as Fetchers from '../fetchers/accounts__user_profile'\nimport type { API } from '../../index'\nimport type { PatchedUserProfileUpdateRequest } from '../schemas/PatchedUserProfileUpdateRequest.schema'\nimport type { User } from '../schemas/User.schema'\nimport type { UserProfileUpdateRequest } from '../schemas/UserProfileUpdateRequest.schema'\n\n/**\n * Get current user profile\n *\n * @method GET\n * @path /cfg/accounts/profile/\n */\nexport function useAccountsProfileRetrieve(client?: API): ReturnType<typeof useSWR<User>> {\n return useSWR<User>(\n 'cfg-accounts-profile',\n () => Fetchers.getAccountsProfileRetrieve(client)\n )\n}\n\n\n/**\n * Upload user avatar\n *\n * @method POST\n * @path /cfg/accounts/profile/avatar/\n */\nexport function useCreateAccountsProfileAvatarCreate() {\n const { mutate } = useSWRConfig()\n\n return async (data: any, client?: API): Promise<User> => {\n const result = await Fetchers.createAccountsProfileAvatarCreate(data, client)\n // Revalidate related queries\n mutate('cfg-accounts-profile-avatar')\n return result\n }\n}\n\n\n/**\n * Partial update user profile\n *\n * @method PUT\n * @path /cfg/accounts/profile/partial/\n */\nexport function usePartialUpdateAccountsProfilePartialUpdate() {\n const { mutate } = useSWRConfig()\n\n return async (data: UserProfileUpdateRequest, client?: API): Promise<User> => {\n const result = await Fetchers.partialUpdateAccountsProfilePartialUpdate(data, client)\n // Revalidate related queries\n mutate('cfg-accounts-profile-partial')\n return result\n }\n}\n\n\n/**\n * Partial update user profile\n *\n * @method PATCH\n * @path /cfg/accounts/profile/partial/\n */\nexport function usePartialUpdateAccountsProfilePartialPartialUpdate() {\n const { mutate } = useSWRConfig()\n\n return async (data?: PatchedUserProfileUpdateRequest, client?: API): Promise<User> => {\n const result = await Fetchers.partialUpdateAccountsProfilePartialPartialUpdate(data, client)\n // Revalidate related queries\n mutate('cfg-accounts-profile-partial-partial')\n return result\n }\n}\n\n\n/**\n * Update user profile\n *\n * @method PUT\n * @path /cfg/accounts/profile/update/\n */\nexport function useUpdateAccountsProfileUpdateUpdate() {\n const { mutate } = useSWRConfig()\n\n return async (data: UserProfileUpdateRequest, client?: API): Promise<User> => {\n const result = await Fetchers.updateAccountsProfileUpdateUpdate(data, client)\n // Revalidate related queries\n mutate('cfg-accounts-profile')\n return result\n }\n}\n\n\n/**\n * Update user profile\n *\n * @method PATCH\n * @path /cfg/accounts/profile/update/\n */\nexport function usePartialUpdateAccountsProfileUpdatePartialUpdate() {\n const { mutate } = useSWRConfig()\n\n return async (data?: PatchedUserProfileUpdateRequest, client?: API): Promise<User> => {\n const result = await Fetchers.partialUpdateAccountsProfileUpdatePartialUpdate(data, client)\n // Revalidate related queries\n mutate('cfg-accounts-profile-partial')\n return result\n }\n}\n\n\n","// Auto-generated by DjangoCFG - see CLAUDE.md\n'use client';\n\n/**\n * SWR Hooks for Accounts\n *\n * React hooks powered by SWR for data fetching with automatic caching,\n * revalidation, and optimistic updates.\n *\n * Usage:\n * ```typescript\n * // Query hooks (GET)\n * const { data, error, isLoading } = useUsers({ page: 1 })\n *\n * // Mutation hooks (POST/PUT/PATCH/DELETE)\n * const createUser = useCreateUser()\n * await createUser({ name: 'John', email: 'john@example.com' })\n * ```\n */\nimport { useSWRConfig } from 'swr'\nimport * as Fetchers from '../fetchers/accounts'\nimport type { API } from '../../index'\nimport type { OTPRequestRequest } from '../schemas/OTPRequestRequest.schema'\nimport type { OTPRequestResponse } from '../schemas/OTPRequestResponse.schema'\nimport type { OTPVerifyRequest } from '../schemas/OTPVerifyRequest.schema'\nimport type { OTPVerifyResponse } from '../schemas/OTPVerifyResponse.schema'\n\n/**\n * API operation\n *\n * @method POST\n * @path /cfg/accounts/otp/request/\n */\nexport function useCreateAccountsOtpRequestCreate() {\n const { mutate } = useSWRConfig()\n\n return async (data: OTPRequestRequest, client?: API): Promise<OTPRequestResponse> => {\n const result = await Fetchers.createAccountsOtpRequestCreate(data, client)\n // Revalidate related queries\n mutate('cfg-accounts-otp-request')\n return result\n }\n}\n\n\n/**\n * API operation\n *\n * @method POST\n * @path /cfg/accounts/otp/verify/\n */\nexport function useCreateAccountsOtpVerifyCreate() {\n const { mutate } = useSWRConfig()\n\n return async (data: OTPVerifyRequest, client?: API): Promise<OTPVerifyResponse> => {\n const result = await Fetchers.createAccountsOtpVerifyCreate(data, client)\n // Revalidate related queries\n mutate('cfg-accounts-otp-verify')\n return result\n }\n}\n\n\n","\"use client\"\n\nimport { useEffect, useState } from 'react';\n\nimport { useCfgRouter } from '@djangocfg/ui-nextjs/hooks';\n\nimport { useAuth } from '../context';\n\ninterface UseAuthGuardOptions {\n redirectTo?: string;\n requireAuth?: boolean;\n /** Whether to save current URL for redirect after auth (default: true) */\n saveRedirectUrl?: boolean;\n}\n\nexport const useAuthGuard = (options: UseAuthGuardOptions = {}) => {\n const { redirectTo = '/auth', requireAuth = true, saveRedirectUrl: shouldSaveUrl = true } = options;\n const { isAuthenticated, isLoading, saveRedirectUrl } = useAuth();\n const router = useCfgRouter();\n const [isRedirecting, setIsRedirecting] = useState(false);\n\n useEffect(() => {\n if (!isLoading && requireAuth && !isAuthenticated && !isRedirecting) {\n // Save current URL before redirecting\n if (shouldSaveUrl && typeof window !== 'undefined') {\n const currentUrl = window.location.pathname + window.location.search;\n saveRedirectUrl(currentUrl);\n }\n\n setIsRedirecting(true);\n router.push(redirectTo);\n }\n }, [isAuthenticated, isLoading, router, redirectTo, requireAuth, isRedirecting, shouldSaveUrl, saveRedirectUrl]);\n\n return { isAuthenticated, isLoading, isRedirecting };\n}; ","'use client';\n\nimport { useEffect, useState } from 'react';\n\nimport { authLogger } from '../utils/logger';\n\n/**\n * Simple localStorage hook with better error handling\n * @param key - Storage key\n * @param initialValue - Default value if key doesn't exist\n * @returns [value, setValue, removeValue] - Current value, setter function, and remove function\n */\nexport function useLocalStorage<T>(key: string, initialValue: T) {\n // Get initial value from localStorage or use provided initialValue\n const [storedValue, setStoredValue] = useState<T>(() => {\n if (typeof window === 'undefined') {\n return initialValue;\n }\n\n try {\n const item = window.localStorage.getItem(key);\n if (item === null) {\n return initialValue;\n }\n \n // Try to parse as JSON first, fallback to string\n try {\n return JSON.parse(item);\n } catch {\n // If JSON.parse fails, return as string\n return item as T;\n }\n } catch (error) {\n authLogger.error(`Error reading localStorage key \"${key}\":`, error);\n return initialValue;\n }\n });\n\n // Check data size and limit\n const checkDataSize = (data: any): boolean => {\n try {\n const jsonString = JSON.stringify(data);\n const sizeInBytes = new Blob([jsonString]).size;\n const sizeInKB = sizeInBytes / 1024;\n \n // Limit to 1MB per item\n if (sizeInKB > 1024) {\n authLogger.warn(`Data size (${sizeInKB.toFixed(2)}KB) exceeds 1MB limit for key \"${key}\"`);\n return false;\n }\n\n return true;\n } catch (error) {\n authLogger.error(`Error checking data size for key \"${key}\":`, error);\n return false;\n }\n };\n\n // Clear old data when localStorage is full\n const clearOldData = () => {\n try {\n const keys = Object.keys(localStorage).filter(key => key && typeof key === 'string');\n // Remove oldest items if we have more than 50 items\n if (keys.length > 50) {\n const itemsToRemove = Math.ceil(keys.length * 0.2);\n for (let i = 0; i < itemsToRemove; i++) {\n try {\n const key = keys[i];\n if (key) {\n localStorage.removeItem(key);\n localStorage.removeItem(`${key}_timestamp`);\n }\n } catch {\n // Ignore errors when removing items\n }\n }\n }\n } catch (error) {\n authLogger.error('Error clearing old localStorage data:', error);\n }\n };\n\n // Force clear all data if quota is exceeded\n const forceClearAll = () => {\n try {\n const keys = Object.keys(localStorage);\n for (const key of keys) {\n try {\n localStorage.removeItem(key);\n } catch {\n // Ignore errors when removing items\n }\n }\n } catch (error) {\n authLogger.error('Error force clearing localStorage:', error);\n }\n };\n\n // Update localStorage when value changes\n const setValue = (value: T | ((val: T) => T)) => {\n try {\n const valueToStore = value instanceof Function ? value(storedValue) : value;\n \n // Check data size before attempting to save\n if (!checkDataSize(valueToStore)) {\n authLogger.warn(`Data size too large for key \"${key}\", removing key`);\n // Remove the key if data is too large\n try {\n window.localStorage.removeItem(key);\n window.localStorage.removeItem(`${key}_timestamp`);\n } catch {\n // Ignore errors when removing\n }\n // Still update the state\n setStoredValue(valueToStore);\n return;\n }\n \n setStoredValue(valueToStore);\n\n if (typeof window !== 'undefined') {\n // Try to set the value\n try {\n // For strings, store directly without JSON.stringify\n if (typeof valueToStore === 'string') {\n window.localStorage.setItem(key, valueToStore);\n } else {\n window.localStorage.setItem(key, JSON.stringify(valueToStore));\n }\n // Add timestamp for cleanup\n window.localStorage.setItem(`${key}_timestamp`, Date.now().toString());\n } catch (storageError: any) {\n // If quota exceeded, clear old data and try again\n if (storageError.name === 'QuotaExceededError' ||\n storageError.code === 22 ||\n storageError.message?.includes('quota')) {\n authLogger.warn('localStorage quota exceeded, clearing old data...');\n clearOldData();\n \n // Try again after clearing\n try {\n // For strings, store directly without JSON.stringify\n if (typeof valueToStore === 'string') {\n window.localStorage.setItem(key, valueToStore);\n } else {\n window.localStorage.setItem(key, JSON.stringify(valueToStore));\n }\n window.localStorage.setItem(`${key}_timestamp`, Date.now().toString());\n } catch (retryError) {\n authLogger.error(`Failed to set localStorage key \"${key}\" after clearing old data:`, retryError);\n // If still fails, force clear all and try one more time\n try {\n forceClearAll();\n // For strings, store directly without JSON.stringify\n if (typeof valueToStore === 'string') {\n window.localStorage.setItem(key, valueToStore);\n } else {\n window.localStorage.setItem(key, JSON.stringify(valueToStore));\n }\n window.localStorage.setItem(`${key}_timestamp`, Date.now().toString());\n } catch (finalError) {\n authLogger.error(`Failed to set localStorage key \"${key}\" after force clearing:`, finalError);\n // If still fails, just update the state without localStorage\n setStoredValue(valueToStore);\n }\n }\n } else {\n throw storageError;\n }\n }\n }\n } catch (error) {\n authLogger.error(`Error setting localStorage key \"${key}\":`, error);\n // Still update the state even if localStorage fails\n const valueToStore = value instanceof Function ? value(storedValue) : value;\n setStoredValue(valueToStore);\n }\n };\n\n // Remove value from localStorage\n const removeValue = () => {\n try {\n setStoredValue(initialValue);\n if (typeof window !== 'undefined') {\n try {\n window.localStorage.removeItem(key);\n window.localStorage.removeItem(`${key}_timestamp`);\n } catch (removeError: any) {\n // If removal fails due to quota, try to clear some data first\n if (removeError.name === 'QuotaExceededError' ||\n removeError.code === 22 ||\n removeError.message?.includes('quota')) {\n authLogger.warn('localStorage quota exceeded during removal, clearing old data...');\n clearOldData();\n \n try {\n window.localStorage.removeItem(key);\n window.localStorage.removeItem(`${key}_timestamp`);\n } catch (retryError) {\n authLogger.error(`Failed to remove localStorage key \"${key}\" after clearing:`, retryError);\n // If still fails, force clear all\n forceClearAll();\n }\n } else {\n throw removeError;\n }\n }\n }\n } catch (error) {\n authLogger.error(`Error removing localStorage key \"${key}\":`, error);\n }\n };\n\n return [storedValue, setValue, removeValue] as const;\n}\n","\"use client\"\n\nimport { useCallback, useEffect, useState } from 'react';\n\nimport { useAuth } from '../context';\nimport { authLogger } from '../utils/logger';\nimport { useAutoAuth } from './useAutoAuth';\nimport { useLocalStorage } from './useLocalStorage';\n\nexport interface AuthFormState {\n identifier: string; // Email or phone number\n channel: 'email' | 'phone';\n otp: string;\n isLoading: boolean;\n acceptedTerms: boolean;\n step: 'identifier' | 'otp';\n error: string;\n}\n\nexport interface AuthFormHandlers {\n setIdentifier: (identifier: string) => void;\n setChannel: (channel: 'email' | 'phone') => void;\n setOtp: (otp: string) => void;\n setAcceptedTerms: (accepted: boolean) => void;\n setError: (error: string) => void;\n clearError: () => void;\n handleIdentifierSubmit: (e: React.FormEvent) => Promise<void>;\n handleOTPSubmit: (e: React.FormEvent) => Promise<void>;\n handleResendOTP: () => Promise<void>;\n handleBackToIdentifier: () => void;\n forceOTPStep: () => void;\n // Utility methods\n detectChannelFromIdentifier: (identifier: string) => 'email' | 'phone' | null;\n validateIdentifier: (identifier: string, channel?: 'email' | 'phone') => boolean;\n}\n\nexport interface UseAuthFormOptions {\n onIdentifierSuccess?: (identifier: string, channel: 'email' | 'phone') => void;\n onOTPSuccess?: () => void;\n onError?: (message: string) => void;\n sourceUrl: string;\n /** URL to redirect after successful OTP verification */\n redirectUrl?: string;\n /** If true, user must accept terms before submitting. Default: false */\n requireTermsAcceptance?: boolean;\n /** Path to auth page for auto-OTP detection. Default: '/auth' */\n authPath?: string;\n}\n\nexport const useAuthForm = (options: UseAuthFormOptions): AuthFormState & AuthFormHandlers => {\n const { onIdentifierSuccess, onOTPSuccess, onError, sourceUrl, redirectUrl, requireTermsAcceptance = false, authPath = '/auth' } = options;\n \n // Form state\n const [identifier, setIdentifier] = useState('');\n const [channel, setChannel] = useState<'email' | 'phone'>('email');\n const [otp, setOtp] = useState('');\n const [isLoading, setIsLoading] = useState(false);\n const [acceptedTerms, setAcceptedTerms] = useState(false);\n const [step, setStep] = useState<'identifier' | 'otp'>('identifier');\n const [error, setError] = useState('');\n \n\n \n // Auth hooks\n const { requestOTP, verifyOTP, getSavedEmail, saveEmail, getSavedPhone, savePhone } = useAuth();\n const [savedTermsAccepted, setSavedTermsAccepted] = useLocalStorage('auth_terms_accepted', false);\n const [savedEmail, setSavedEmail] = useLocalStorage('auth_email', '');\n const [savedPhone, setSavedPhone] = useLocalStorage('auth_phone', '');\n\n // Utility functions\n const detectChannelFromIdentifier = useCallback((identifier: string): 'email' | 'phone' | null => {\n if (!identifier) return null;\n \n // Email detection\n if (identifier.includes('@')) {\n return 'email';\n }\n \n // Phone detection (starts with + and contains digits)\n if (identifier.startsWith('+') && /^\\+[1-9]\\d{6,14}$/.test(identifier)) {\n return 'phone';\n }\n \n return null;\n }, []);\n\n const validateIdentifier = useCallback((identifier: string, channelType?: 'email' | 'phone'): boolean => {\n if (!identifier) return false;\n \n const detectedChannel = channelType || detectChannelFromIdentifier(identifier);\n \n if (detectedChannel === 'email') {\n // Basic email validation\n return /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(identifier);\n } else if (detectedChannel === 'phone') {\n // E.164 phone validation\n return /^\\+[1-9]\\d{6,14}$/.test(identifier);\n }\n \n return false;\n }, [detectChannelFromIdentifier]);\n\n // Load saved data on mount\n useEffect(() => {\n const authSavedEmail = getSavedEmail();\n const authSavedPhone = getSavedPhone();\n \n // Prioritize phone over email if both exist\n if (authSavedPhone) {\n setIdentifier(authSavedPhone);\n setChannel('phone');\n } else if (authSavedEmail) {\n setIdentifier(authSavedEmail);\n setChannel('email');\n }\n \n if (savedTermsAccepted) {\n setAcceptedTerms(savedTermsAccepted);\n }\n }, [getSavedEmail, getSavedPhone, savedTermsAccepted]);\n\n // Auto-detect channel when identifier changes\n useEffect(() => {\n if (identifier) {\n const detectedChannel = detectChannelFromIdentifier(identifier);\n if (detectedChannel && detectedChannel !== channel) {\n setChannel(detectedChannel);\n }\n }\n }, [identifier, channel, detectChannelFromIdentifier]);\n\n\n\n const clearError = useCallback(() => setError(''), []);\n\n const handleIdentifierSubmit = useCallback(async (e: React.FormEvent) => {\n e.preventDefault();\n \n if (!identifier) {\n const message = channel === 'phone' ? 'Please enter your phone number' : 'Please enter your email address';\n setError(message);\n onError?.(message);\n return;\n }\n\n // Validate identifier format\n if (!validateIdentifier(identifier, channel)) {\n const message = channel === 'phone' \n ? 'Please enter a valid phone number (e.g., +1234567890)' \n : 'Please enter a valid email address';\n setError(message);\n onError?.(message);\n return;\n }\n\n if (requireTermsAcceptance && !acceptedTerms) {\n const message = 'Please accept the Terms of Service and Privacy Policy';\n setError(message);\n onError?.(message);\n return;\n }\n\n setIsLoading(true);\n clearError();\n \n try {\n const result = await requestOTP(identifier, channel, sourceUrl);\n \n if (result.success) {\n // Save identifier and terms acceptance on successful request, clear opposite channel\n if (channel === 'email') {\n saveEmail(identifier);\n setSavedPhone(''); // Clear phone storage\n } else if (channel === 'phone') {\n savePhone(identifier);\n setSavedEmail(''); // Clear email storage\n }\n setSavedTermsAccepted(true);\n setStep('otp');\n onIdentifierSuccess?.(identifier, channel);\n } else {\n setError(result.message);\n onError?.(result.message);\n }\n } catch (error) {\n const message = 'An unexpected error occurred';\n setError(message);\n onError?.(message);\n } finally {\n setIsLoading(false);\n }\n }, [identifier, channel, acceptedTerms, validateIdentifier, requestOTP, saveEmail, clearError, setSavedTermsAccepted, onIdentifierSuccess, onError, sourceUrl]);\n\n const handleOTPSubmit = useCallback(async (e: React.FormEvent) => {\n e.preventDefault();\n\n if (!otp || otp.length < 6) {\n const message = 'Please enter the 6-digit verification code';\n setError(message);\n onError?.(message);\n return;\n }\n\n setIsLoading(true);\n clearError();\n\n try {\n const result = await verifyOTP(identifier, otp, channel, sourceUrl, redirectUrl);\n\n if (result.success) {\n // Save identifier on successful login, clear opposite channel\n if (channel === 'email') {\n setSavedEmail(identifier);\n setSavedPhone(''); // Clear phone storage\n } else if (channel === 'phone') {\n setSavedPhone(identifier);\n setSavedEmail(''); // Clear email storage\n }\n onOTPSuccess?.();\n } else {\n setError(result.message);\n onError?.(result.message);\n }\n } catch (error) {\n const message = 'An unexpected error occurred';\n setError(message);\n onError?.(message);\n } finally {\n setIsLoading(false);\n }\n }, [identifier, otp, channel, verifyOTP, clearError, setSavedEmail, onOTPSuccess, onError, sourceUrl, redirectUrl]);\n\n const handleResendOTP = useCallback(async () => {\n setIsLoading(true);\n clearError();\n \n try {\n const result = await requestOTP(identifier, channel, sourceUrl);\n \n if (result.success) {\n // Save identifier and clear OTP input, clear opposite channel\n if (channel === 'email') {\n saveEmail(identifier);\n setSavedPhone(''); // Clear phone storage\n } else if (channel === 'phone') {\n savePhone(identifier);\n setSavedEmail(''); // Clear email storage\n }\n setOtp('');\n } else {\n setError(result.message);\n onError?.(result.message);\n }\n } catch (error) {\n const message = 'Failed to resend verification code';\n setError(message);\n onError?.(message);\n } finally {\n setIsLoading(false);\n }\n }, [identifier, channel, requestOTP, saveEmail, clearError, setOtp, onError, sourceUrl]);\n\n const handleBackToIdentifier = useCallback(() => {\n setStep('identifier');\n clearError();\n }, [clearError]);\n\n const forceOTPStep = useCallback(() => {\n setStep('otp');\n clearError();\n }, [clearError]);\n\n const handleAcceptedTermsChange = useCallback((checked: boolean) => {\n setAcceptedTerms(checked);\n setSavedTermsAccepted(checked);\n }, [setSavedTermsAccepted]);\n\n // Auto-detect OTP from URL query parameters (only on auth page)\n useAutoAuth({\n allowedPaths: [authPath],\n onOTPDetected: (otp: string) => {\n authLogger.info('OTP detected, auto-submitting');\n\n // Get saved identifier from auth context\n const savedEmail = getSavedEmail();\n const savedPhone = getSavedPhone();\n\n // Prioritize phone over email if both exist\n if (savedPhone) {\n setIdentifier(savedPhone);\n setChannel('phone');\n } else if (savedEmail) {\n setIdentifier(savedEmail);\n setChannel('email');\n }\n\n // Set OTP and force OTP step\n setOtp(otp);\n setStep('otp');\n\n // Auto-submit after a short delay to ensure state is updated\n setTimeout(() => {\n const fakeEvent = { preventDefault: () => {} } as React.FormEvent;\n handleOTPSubmit(fakeEvent);\n }, 200);\n },\n cleanupUrl: true,\n });\n\n return {\n // Form state\n identifier,\n channel,\n otp,\n isLoading,\n acceptedTerms,\n step,\n error,\n \n // Form handlers\n setIdentifier,\n setChannel,\n setOtp,\n setAcceptedTerms: handleAcceptedTermsChange,\n setError,\n clearError,\n \n // Auth handlers\n handleIdentifierSubmit,\n handleOTPSubmit,\n handleResendOTP,\n handleBackToIdentifier,\n forceOTPStep,\n \n // Utility methods\n detectChannelFromIdentifier,\n validateIdentifier,\n };\n}; ","'use client';\n\nimport { usePathname } from 'next/navigation';\nimport { useEffect } from 'react';\n\nimport { useCfgRouter, useQueryParams } from '@djangocfg/ui-nextjs/hooks';\n\nimport { authLogger } from '../utils/logger';\n\nexport interface UseAutoAuthOptions {\n onOTPDetected?: (otp: string) => void;\n cleanupUrl?: boolean;\n /** Paths where auto-auth should be active. Default: ['/auth'] */\n allowedPaths?: string[];\n}\n\n/**\n * Hook for automatic authentication from URL query parameters\n * Detects OTP from URL and triggers callback\n */\nexport const useAutoAuth = (options: UseAutoAuthOptions = {}) => {\n const { onOTPDetected, cleanupUrl = true, allowedPaths = ['/auth'] } = options;\n const queryParams = useQueryParams();\n const pathname = usePathname();\n const router = useCfgRouter();\n\n // Check if current path is in allowed paths\n const isAllowedPath = allowedPaths.some(path => pathname === path || pathname?.startsWith(path + '/'));\n\n const hasOTP = !!(queryParams.get('otp'));\n const isReady = !!pathname && hasOTP && isAllowedPath;\n\n useEffect(() => {\n if (!isReady) return;\n\n const queryOtp = queryParams.get('otp') as string;\n\n // Handle OTP detection - only on allowed paths to avoid conflicts with other pages\n // (e.g., /dashboard/device uses ?otp= for device authorization, not user auth)\n if (queryOtp && typeof queryOtp === 'string' && queryOtp.length === 6) {\n authLogger.info('OTP detected in URL on auth page:', queryOtp);\n onOTPDetected?.(queryOtp);\n }\n\n // Clean up URL to remove sensitive params for security\n if (cleanupUrl && queryOtp) {\n const cleanQuery = Object.fromEntries(queryParams.entries());\n delete cleanQuery.otp;\n const queryString = new URLSearchParams(cleanQuery).toString();\n router.push(queryString ? `${pathname}?${queryString}` : pathname);\n }\n }, [pathname, queryParams, onOTPDetected, cleanupUrl, router, isReady]);\n\n return {\n isReady,\n hasOTP,\n isAllowedPath,\n };\n};\n","'use client';\n\nimport { useCallback, useState } from 'react';\n\nimport { useCfgRouter } from '@djangocfg/ui-nextjs/hooks';\n\nimport { apiAccounts } from '../../clients';\nimport { Analytics, AnalyticsCategory, AnalyticsEvent } from '../utils/analytics';\nimport { authLogger } from '../utils/logger';\n\nexport interface UseGithubAuthOptions {\n sourceUrl?: string;\n onSuccess?: (user: any, isNewUser: boolean) => void;\n onError?: (error: string) => void;\n redirectUrl?: string;\n}\n\nexport interface UseGithubAuthReturn {\n isLoading: boolean;\n error: string | null;\n startGithubAuth: () => Promise<void>;\n handleGithubCallback: (code: string, state: string) => Promise<void>;\n}\n\n/**\n * Hook for GitHub OAuth authentication flow.\n *\n * Usage:\n * 1. Call startGithubAuth() to redirect user to GitHub\n * 2. After GitHub redirects back, call handleGithubCallback(code, state)\n *\n * @example\n * ```tsx\n * const { isLoading, error, startGithubAuth } = useGithubAuth({\n * onSuccess: (user) => router.push('/dashboard'),\n * onError: (error) => console.error(error),\n * });\n *\n * <Button onClick={startGithubAuth} disabled={isLoading}>\n * Continue with GitHub\n * </Button>\n * ```\n */\nexport const useGithubAuth = (options: UseGithubAuthOptions = {}): UseGithubAuthReturn => {\n const { sourceUrl, onSuccess, onError, redirectUrl } = options;\n const router = useCfgRouter();\n\n const [isLoading, setIsLoading] = useState(false);\n const [error, setError] = useState<string | null>(null);\n\n /**\n * Start GitHub OAuth flow - redirects user to GitHub authorization page.\n */\n const startGithubAuth = useCallback(async () => {\n setIsLoading(true);\n setError(null);\n\n try {\n authLogger.info('Starting GitHub OAuth flow...');\n\n // Track OAuth start\n Analytics.event(AnalyticsEvent.AUTH_OAUTH_START, {\n category: AnalyticsCategory.AUTH,\n label: 'github',\n });\n\n // Call API to get authorization URL\n // The API will auto-generate redirect_uri from config if not provided\n const response = await apiAccounts.oauth.accountsOauthGithubAuthorizeCreate({\n source_url: sourceUrl || (typeof window !== 'undefined' ? window.location.href : ''),\n });\n\n if (!response.authorization_url) {\n throw new Error('Failed to get authorization URL');\n }\n\n authLogger.info('Redirecting to GitHub...', response.authorization_url);\n\n // Store state in sessionStorage for verification on callback\n if (typeof window !== 'undefined') {\n sessionStorage.setItem('oauth_state', response.state);\n sessionStorage.setItem('oauth_provider', 'github');\n }\n\n // Redirect to GitHub\n window.location.href = response.authorization_url;\n\n } catch (err) {\n const errorMessage = err instanceof Error ? err.message : 'Failed to start GitHub authentication';\n authLogger.error('GitHub OAuth start error:', err);\n setError(errorMessage);\n onError?.(errorMessage);\n\n // Track OAuth error\n Analytics.event(AnalyticsEvent.AUTH_OAUTH_FAIL, {\n category: AnalyticsCategory.AUTH,\n label: 'github',\n });\n } finally {\n setIsLoading(false);\n }\n }, [sourceUrl, onError]);\n\n /**\n * Handle GitHub OAuth callback - exchanges code for JWT tokens.\n *\n * @param code - Authorization code from GitHub callback\n * @param state - State token for CSRF verification\n */\n const handleGithubCallback = useCallback(async (code: string, state: string) => {\n setIsLoading(true);\n setError(null);\n\n try {\n authLogger.info('Processing GitHub OAuth callback...');\n\n // Verify state matches what we stored\n if (typeof window !== 'undefined') {\n const storedState = sessionStorage.getItem('oauth_state');\n if (storedState && storedState !== state) {\n throw new Error('Invalid OAuth state - possible CSRF attack');\n }\n // Clear stored state\n sessionStorage.removeItem('oauth_state');\n sessionStorage.removeItem('oauth_provider');\n }\n\n // Exchange code for tokens\n // The API will auto-generate redirect_uri from config if not provided\n const response = await apiAccounts.oauth.accountsOauthGithubCallbackCreate({\n code,\n state,\n });\n\n if (!response.access || !response.refresh) {\n throw new Error('Invalid response from OAuth callback');\n }\n\n authLogger.info('GitHub OAuth successful, user:', response.user);\n\n // Save tokens using API client\n apiAccounts.setToken(response.access, response.refresh);\n\n // Track successful OAuth\n Analytics.event(AnalyticsEvent.AUTH_LOGIN_SUCCESS, {\n category: AnalyticsCategory.AUTH,\n label: 'github',\n });\n\n // Set user ID for future tracking\n if (response.user?.id) {\n Analytics.setUser(String(response.user.id));\n }\n\n // Call success callback\n onSuccess?.(response.user, response.is_new_user || false);\n\n // Redirect to dashboard or specified URL\n // Use hardPush for full page reload - ensures all React contexts reinitialize\n const finalRedirectUrl = redirectUrl || '/dashboard';\n router.hardPush(finalRedirectUrl);\n\n } catch (err) {\n const errorMessage = err instanceof Error ? err.message : 'GitHub authentication failed';\n authLogger.error('GitHub OAuth callback error:', err);\n setError(errorMessage);\n onError?.(errorMessage);\n\n // Track OAuth error\n Analytics.event(AnalyticsEvent.AUTH_OAUTH_FAIL, {\n category: AnalyticsCategory.AUTH,\n label: 'github',\n });\n } finally {\n setIsLoading(false);\n }\n }, [onSuccess, onError, redirectUrl, router]);\n\n return {\n isLoading,\n error,\n startGithubAuth,\n handleGithubCallback,\n };\n};\n","// Auto-generated by DjangoCFG - see CLAUDE.md\n'use client';\n\n/**\n * SWR Hooks for Web Push\n *\n * React hooks powered by SWR for data fetching with automatic caching,\n * revalidation, and optimistic updates.\n *\n * Usage:\n * ```typescript\n * // Query hooks (GET)\n * const { data, error, isLoading } = useUsers({ page: 1 })\n *\n * // Mutation hooks (POST/PUT/PATCH/DELETE)\n * const createUser = useCreateUser()\n * await createUser({ name: 'John', email: 'john@example.com' })\n * ```\n */\nimport useSWR from 'swr'\nimport { useSWRConfig } from 'swr'\nimport * as Fetchers from '../fetchers/webpush__web_push'\nimport type { API } from '../../index'\nimport type { SendPushRequestRequest } from '../schemas/SendPushRequestRequest.schema'\nimport type { SendPushResponse } from '../schemas/SendPushResponse.schema'\nimport type { SubscribeRequestRequest } from '../schemas/SubscribeRequestRequest.schema'\nimport type { SubscribeResponse } from '../schemas/SubscribeResponse.schema'\nimport type { VapidPublicKeyResponse } from '../schemas/VapidPublicKeyResponse.schema'\n\n/**\n * Send push notification\n *\n * @method POST\n * @path /cfg/webpush/send/\n */\nexport function useCreateWebpushSendCreate() {\n const { mutate } = useSWRConfig()\n\n return async (data: SendPushRequestRequest, client?: API): Promise<SendPushResponse> => {\n const result = await Fetchers.createWebpushSendCreate(data, client)\n // Revalidate related queries\n mutate('cfg-webpush-send')\n return result\n }\n}\n\n\n/**\n * Subscribe to push notifications\n *\n * @method POST\n * @path /cfg/webpush/subscribe/\n */\nexport function useCreateWebpushSubscribeCreate() {\n const { mutate } = useSWRConfig()\n\n return async (data: SubscribeRequestRequest, client?: API): Promise<SubscribeResponse> => {\n const result = await Fetchers.createWebpushSubscribeCreate(data, client)\n // Revalidate related queries\n mutate('cfg-webpush-subscribe')\n return result\n }\n}\n\n\n/**\n * Get VAPID public key\n *\n * @method GET\n * @path /cfg/webpush/vapid/\n */\nexport function useWebpushVapidRetrieve(client?: API): ReturnType<typeof useSWR<VapidPublicKeyResponse>> {\n return useSWR<VapidPublicKeyResponse>(\n 'cfg-webpush-vapid',\n () => Fetchers.getWebpushVapidRetrieve(client)\n )\n}\n\n\n","// Auto-generated by DjangoCFG - see CLAUDE.md\n'use client';\n\n/**\n * SWR Hooks for Centrifugo Admin API\n *\n * React hooks powered by SWR for data fetching with automatic caching,\n * revalidation, and optimistic updates.\n *\n * Usage:\n * ```typescript\n * // Query hooks (GET)\n * const { data, error, isLoading } = useUsers({ page: 1 })\n *\n * // Mutation hooks (POST/PUT/PATCH/DELETE)\n * const createUser = useCreateUser()\n * await createUser({ name: 'John', email: 'john@example.com' })\n * ```\n */\nimport { useSWRConfig } from 'swr'\nimport * as Fetchers from '../fetchers/centrifugo__centrifugo_admin_api'\nimport type { API } from '../../index'\nimport type { CentrifugoChannelsRequestRequest } from '../schemas/CentrifugoChannelsRequestRequest.schema'\nimport type { CentrifugoChannelsResponse } from '../schemas/CentrifugoChannelsResponse.schema'\nimport type { CentrifugoHistoryRequestRequest } from '../schemas/CentrifugoHistoryRequestRequest.schema'\nimport type { CentrifugoHistoryResponse } from '../schemas/CentrifugoHistoryResponse.schema'\nimport type { CentrifugoInfoResponse } from '../schemas/CentrifugoInfoResponse.schema'\nimport type { CentrifugoPresenceRequestRequest } from '../schemas/CentrifugoPresenceRequestRequest.schema'\nimport type { CentrifugoPresenceResponse } from '../schemas/CentrifugoPresenceResponse.schema'\nimport type { CentrifugoPresenceStatsRequestRequest } from '../schemas/CentrifugoPresenceStatsRequestRequest.schema'\nimport type { CentrifugoPresenceStatsResponse } from '../schemas/CentrifugoPresenceStatsResponse.schema'\n\n/**\n * Get connection token for dashboard\n *\n * @method POST\n * @path /cfg/centrifugo/server/auth/token/\n */\nexport function useCreateCentrifugoServerAuthTokenCreate() {\n const { mutate } = useSWRConfig()\n\n return async (client?: API): Promise<any> => {\n const result = await Fetchers.createCentrifugoServerAuthTokenCreate(client)\n // Revalidate related queries\n mutate('cfg-centrifugo-server-auth-token')\n return result\n }\n}\n\n\n/**\n * List active channels\n *\n * @method POST\n * @path /cfg/centrifugo/server/channels/\n */\nexport function useCreateCentrifugoServerChannelsCreate() {\n const { mutate } = useSWRConfig()\n\n return async (data: CentrifugoChannelsRequestRequest, client?: API): Promise<CentrifugoChannelsResponse> => {\n const result = await Fetchers.createCentrifugoServerChannelsCreate(data, client)\n // Revalidate related queries\n mutate('cfg-centrifugo-server-channels')\n return result\n }\n}\n\n\n/**\n * Get channel history\n *\n * @method POST\n * @path /cfg/centrifugo/server/history/\n */\nexport function useCreateCentrifugoServerHistoryCreate() {\n const { mutate } = useSWRConfig()\n\n return async (data: CentrifugoHistoryRequestRequest, client?: API): Promise<CentrifugoHistoryResponse> => {\n const result = await Fetchers.createCentrifugoServerHistoryCreate(data, client)\n // Revalidate related queries\n mutate('cfg-centrifugo-server-history')\n return result\n }\n}\n\n\n/**\n * Get Centrifugo server info\n *\n * @method POST\n * @path /cfg/centrifugo/server/info/\n */\nexport function useCreateCentrifugoServerInfoCreate() {\n const { mutate } = useSWRConfig()\n\n return async (client?: API): Promise<CentrifugoInfoResponse> => {\n const result = await Fetchers.createCentrifugoServerInfoCreate(client)\n // Revalidate related queries\n mutate('cfg-centrifugo-server-info')\n return result\n }\n}\n\n\n/**\n * Get channel presence\n *\n * @method POST\n * @path /cfg/centrifugo/server/presence/\n */\nexport function useCreateCentrifugoServerPresenceCreate() {\n const { mutate } = useSWRConfig()\n\n return async (data: CentrifugoPresenceRequestRequest, client?: API): Promise<CentrifugoPresenceResponse> => {\n const result = await Fetchers.createCentrifugoServerPresenceCreate(data, client)\n // Revalidate related queries\n mutate('cfg-centrifugo-server-presence')\n return result\n }\n}\n\n\n/**\n * Get channel presence statistics\n *\n * @method POST\n * @path /cfg/centrifugo/server/presence-stats/\n */\nexport function useCreateCentrifugoServerPresenceStatsCreate() {\n const { mutate } = useSWRConfig()\n\n return async (data: CentrifugoPresenceStatsRequestRequest, client?: API): Promise<CentrifugoPresenceStatsResponse> => {\n const result = await Fetchers.createCentrifugoServerPresenceStatsCreate(data, client)\n // Revalidate related queries\n mutate('cfg-centrifugo-server-presence-stats')\n return result\n }\n}\n\n\n","// Auto-generated by DjangoCFG - see CLAUDE.md\n'use client';\n\n/**\n * SWR Hooks for Centrifugo Auth\n *\n * React hooks powered by SWR for data fetching with automatic caching,\n * revalidation, and optimistic updates.\n *\n * Usage:\n * ```typescript\n * // Query hooks (GET)\n * const { data, error, isLoading } = useUsers({ page: 1 })\n *\n * // Mutation hooks (POST/PUT/PATCH/DELETE)\n * const createUser = useCreateUser()\n * await createUser({ name: 'John', email: 'john@example.com' })\n * ```\n */\nimport useSWR from 'swr'\nimport * as Fetchers from '../fetchers/centrifugo__centrifugo_auth'\nimport type { API } from '../../index'\nimport type { ConnectionTokenResponse } from '../schemas/ConnectionTokenResponse.schema'\n\n/**\n * Get Centrifugo connection token\n *\n * @method GET\n * @path /cfg/centrifugo/auth/token/\n */\nexport function useCentrifugoAuthTokenRetrieve(client?: API): ReturnType<typeof useSWR<ConnectionTokenResponse>> {\n return useSWR<ConnectionTokenResponse>(\n 'cfg-centrifugo-auth-token',\n () => Fetchers.getCentrifugoAuthTokenRetrieve(client)\n )\n}\n\n\n","// Auto-generated by DjangoCFG - see CLAUDE.md\n'use client';\n\n/**\n * SWR Hooks for Centrifugo Monitoring\n *\n * React hooks powered by SWR for data fetching with automatic caching,\n * revalidation, and optimistic updates.\n *\n * Usage:\n * ```typescript\n * // Query hooks (GET)\n * const { data, error, isLoading } = useUsers({ page: 1 })\n *\n * // Mutation hooks (POST/PUT/PATCH/DELETE)\n * const createUser = useCreateUser()\n * await createUser({ name: 'John', email: 'john@example.com' })\n * ```\n */\nimport useSWR from 'swr'\nimport * as Fetchers from '../fetchers/centrifugo__centrifugo_monitoring'\nimport type { API } from '../../index'\nimport type { CentrifugoHealthCheck } from '../schemas/CentrifugoHealthCheck.schema'\nimport type { CentrifugoOverviewStats } from '../schemas/CentrifugoOverviewStats.schema'\nimport type { ChannelList } from '../schemas/ChannelList.schema'\nimport type { PaginatedPublishList } from '../schemas/PaginatedPublishList.schema'\nimport type { TimelineResponse } from '../schemas/TimelineResponse.schema'\n\n/**\n * Get channel statistics\n *\n * @method GET\n * @path /cfg/centrifugo/monitor/channels/\n */\nexport function useCentrifugoMonitorChannelsRetrieve(params?: { hours?: number }, client?: API): ReturnType<typeof useSWR<ChannelList>> {\n return useSWR<ChannelList>(\n params ? ['cfg-centrifugo-monitor-channel', params] : 'cfg-centrifugo-monitor-channel',\n () => Fetchers.getCentrifugoMonitorChannelsRetrieve(params, client)\n )\n}\n\n\n/**\n * Get Centrifugo health status\n *\n * @method GET\n * @path /cfg/centrifugo/monitor/health/\n */\nexport function useCentrifugoMonitorHealthRetrieve(client?: API): ReturnType<typeof useSWR<CentrifugoHealthCheck>> {\n return useSWR<CentrifugoHealthCheck>(\n 'cfg-centrifugo-monitor-health',\n () => Fetchers.getCentrifugoMonitorHealthRetrieve(client)\n )\n}\n\n\n/**\n * Get overview statistics\n *\n * @method GET\n * @path /cfg/centrifugo/monitor/overview/\n */\nexport function useCentrifugoMonitorOverviewRetrieve(params?: { hours?: number }, client?: API): ReturnType<typeof useSWR<CentrifugoOverviewStats>> {\n return useSWR<CentrifugoOverviewStats>(\n params ? ['cfg-centrifugo-monitor-overview', params] : 'cfg-centrifugo-monitor-overview',\n () => Fetchers.getCentrifugoMonitorOverviewRetrieve(params, client)\n )\n}\n\n\n/**\n * Get recent publishes\n *\n * @method GET\n * @path /cfg/centrifugo/monitor/publishes/\n */\nexport function useCentrifugoMonitorPublishesList(params?: { channel?: string; page?: number; page_size?: number; status?: string }, client?: API): ReturnType<typeof useSWR<PaginatedPublishList>> {\n return useSWR<PaginatedPublishList>(\n params ? ['cfg-centrifugo-monitor-publishes', params] : 'cfg-centrifugo-monitor-publishes',\n () => Fetchers.getCentrifugoMonitorPublishesList(params, client)\n )\n}\n\n\n/**\n * Get publish timeline\n *\n * @method GET\n * @path /cfg/centrifugo/monitor/timeline/\n */\nexport function useCentrifugoMonitorTimelineRetrieve(params?: { hours?: number; interval?: string }, client?: API): ReturnType<typeof useSWR<TimelineResponse>> {\n return useSWR<TimelineResponse>(\n params ? ['cfg-centrifugo-monitor-timeline', params] : 'cfg-centrifugo-monitor-timeline',\n () => Fetchers.getCentrifugoMonitorTimelineRetrieve(params, client)\n )\n}\n\n\n","// Auto-generated by DjangoCFG - see CLAUDE.md\n'use client';\n\n/**\n * SWR Hooks for Centrifugo Testing\n *\n * React hooks powered by SWR for data fetching with automatic caching,\n * revalidation, and optimistic updates.\n *\n * Usage:\n * ```typescript\n * // Query hooks (GET)\n * const { data, error, isLoading } = useUsers({ page: 1 })\n *\n * // Mutation hooks (POST/PUT/PATCH/DELETE)\n * const createUser = useCreateUser()\n * await createUser({ name: 'John', email: 'john@example.com' })\n * ```\n */\nimport { useSWRConfig } from 'swr'\nimport * as Fetchers from '../fetchers/centrifugo__centrifugo_testing'\nimport type { API } from '../../index'\nimport type { ManualAckRequestRequest } from '../schemas/ManualAckRequestRequest.schema'\nimport type { ManualAckResponse } from '../schemas/ManualAckResponse.schema'\nimport type { PublishTestRequestRequest } from '../schemas/PublishTestRequestRequest.schema'\nimport type { PublishTestResponse } from '../schemas/PublishTestResponse.schema'\n\n/**\n * Publish test message\n *\n * @method POST\n * @path /cfg/centrifugo/testing/publish-test/\n */\nexport function useCreateCentrifugoTestingPublishTestCreate() {\n const { mutate } = useSWRConfig()\n\n return async (data: PublishTestRequestRequest, client?: API): Promise<PublishTestResponse> => {\n const result = await Fetchers.createCentrifugoTestingPublishTestCreate(data, client)\n // Revalidate related queries\n mutate('cfg-centrifugo-testing-publish-test')\n return result\n }\n}\n\n\n/**\n * Publish with database logging\n *\n * @method POST\n * @path /cfg/centrifugo/testing/publish-with-logging/\n */\nexport function useCreateCentrifugoTestingPublishWithLoggingCreate() {\n const { mutate } = useSWRConfig()\n\n return async (data: PublishTestRequestRequest, client?: API): Promise<PublishTestResponse> => {\n const result = await Fetchers.createCentrifugoTestingPublishWithLoggingCreate(data, client)\n // Revalidate related queries\n mutate('cfg-centrifugo-testing-publish-with-logging')\n return result\n }\n}\n\n\n/**\n * Send manual ACK\n *\n * @method POST\n * @path /cfg/centrifugo/testing/send-ack/\n */\nexport function useCreateCentrifugoTestingSendAckCreate() {\n const { mutate } = useSWRConfig()\n\n return async (data: ManualAckRequestRequest, client?: API): Promise<ManualAckResponse> => {\n const result = await Fetchers.createCentrifugoTestingSendAckCreate(data, client)\n // Revalidate related queries\n mutate('cfg-centrifugo-testing-send-ack')\n return result\n }\n}\n\n\n","/**\n * @djangocfg/api - Pre-configured API Clients\n *\n * Ready-to-use API instances for accounts, webpush, and centrifugo.\n *\n * Usage:\n * import { apiAccounts, apiWebPush, apiCentrifugo } from '@djangocfg/api/clients';\n * import { useAccountsOauthGithubCallbackCreate } from '@djangocfg/api/clients';\n */\n\nimport { API as AccountsAPIClass, LocalStorageAdapter } from './generated/cfg_accounts';\nimport { API as CentrifugoAPIClass } from './generated/cfg_centrifugo';\nimport { API as WebPushAPIClass } from './generated/cfg_webpush';\n\n// ============================================================================\n// Pre-configured API instances (for hooks and direct usage)\n// ============================================================================\nconst isStaticBuild = process.env.NEXT_PUBLIC_STATIC_BUILD === 'true';\nconst apiUrl = isStaticBuild ? '' : process.env.NEXT_PUBLIC_API_URL || '';\nconst storage = new LocalStorageAdapter();\n\nexport const apiAccounts = new AccountsAPIClass(apiUrl, { storage });\nexport const apiWebPush = new WebPushAPIClass(apiUrl, { storage });\nexport const apiCentrifugo = new CentrifugoAPIClass(apiUrl, { storage });\n\n// ============================================================================\n// Enums (re-export from accounts)\n// ============================================================================\nexport * as Enums from './generated/cfg_accounts/enums';\n\n// ============================================================================\n// CFG Accounts (primary exports - includes shared types)\n// ============================================================================\nexport * from './generated/cfg_accounts/_utils/hooks';\nexport * from './generated/cfg_accounts/_utils/fetchers';\nexport * from './generated/cfg_accounts/_utils/schemas';\n\n// ============================================================================\n// CFG WebPush (namespaced to avoid conflicts)\n// ============================================================================\nexport * as WebPushHooks from './generated/cfg_webpush/_utils/hooks';\nexport * as WebPushFetchers from './generated/cfg_webpush/_utils/fetchers';\nexport * as WebPushTypes from './generated/cfg_webpush/_utils/schemas';\n\n// ============================================================================\n// CFG Centrifugo (namespaced to avoid conflicts)\n// ============================================================================\nexport * as CentrifugoHooks from './generated/cfg_centrifugo/_utils/hooks';\nexport * as CentrifugoFetchers from './generated/cfg_centrifugo/_utils/fetchers';\nexport * as CentrifugoTypes from './generated/cfg_centrifugo/_utils/schemas';\n\n// ============================================================================\n// API Classes (for creating custom instances)\n// ============================================================================\nexport { API as AccountsAPI } from './generated/cfg_accounts';\nexport { API as WebPushAPI } from './generated/cfg_webpush';\nexport { API as CentrifugoAPI } from './generated/cfg_centrifugo';\n","/**\n * Email validation utility\n */\nexport const validateEmail = (email: string): boolean => {\n const emailRegex = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/;\n return emailRegex.test(email);\n};\n","/**\n * Format authentication error for display\n */\nexport const formatAuthError = (error: any): string => {\n if (typeof error === 'string') {\n return error;\n }\n\n if (error?.message) {\n return error.message;\n }\n\n if (error?.detail) {\n return error.detail;\n }\n\n if (error?.response?.data?.detail) {\n return error.response.data.detail;\n }\n\n return 'An unexpected error occurred';\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;;;ACGA,wBAA4B;AAC5B,IAAAC,gBAEO;AAEP,IAAAC,gBAA8D;;;ACFvD,IAAM,OAAN,MAAW;AAAA,EANlB,OAMkB;AAAA;AAAA;AAAA,EAGhB,YAAY,QAAa;AACvB,SAAK,SAAS;AAAA,EAChB;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,2BAA2B,MAAgE;AAC/F,UAAM,WAAW,MAAM,KAAK,OAAO,QAAQ,QAAQ,gCAAgC,EAAE,MAAM,KAAK,CAAC;AACjG,WAAO;AAAA,EACT;AAEF;;;ACfO,IAAM,QAAN,MAAY;AAAA,EANnB,OAMmB;AAAA;AAAA;AAAA,EAGjB,YAAY,QAAa;AACvB,SAAK,SAAS;AAAA,EAChB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,+BAA6C;AACjD,UAAM,WAAW,MAAM,KAAK,OAAO,QAAQ,OAAO,kCAAkC;AACpF,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,8BAA8B,MAA0D;AAC5F,UAAM,WAAW,MAAM,KAAK,OAAO,QAAQ,QAAQ,mCAAmC,EAAE,MAAM,KAAK,CAAC;AACpG,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,mCAAmC,MAAmF;AAC1H,UAAM,WAAW,MAAM,KAAK,OAAO,QAAQ,QAAQ,yCAAyC,EAAE,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,OAAO,SAAS;AAClB,WAAO,MAAM;AAAA,EACf;AAEA,MAAI,OAAO,QAAQ;AACjB,WAAO,MAAM;AAAA,EACf;AAEA,MAAI,OAAO,UAAU,MAAM,QAAQ;AACjC,WAAO,MAAM,SAAS,KAAK;AAAA,EAC7B;AAEA,SAAO;AACT,GAlB+B;","names":["useLocalStorage","import_react","import_hooks","pRetry","logger","OAuthConnectionProvider","OAuthDisconnectRequestRequestProvider","OTPRequestRequestChannel","OTPVerifyRequestChannel","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_consola","api","import_consola","api","import_consola","import_consola","api","api","logger","FetchAdapter","APIError","NetworkError","import_consola","DEFAULT_CONFIG","SENSITIVE_HEADERS","APILogger","defaultLogger","import_p_retry","DEFAULT_RETRY_CONFIG","shouldRetry","NetworkError","APIError","withRetry","pRetry","APIClient","FetchAdapter","APILogger","withRetry","APIError","NetworkError","LocalStorageAdapter","logger","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_consola","import_consola","import_consola","import_consola","TOKEN_KEY","REFRESH_TOKEN_KEY","API","logger","APILogger","LocalStorageAdapter","APIClient","FetchAdapter","APIError","NetworkError","import_consola","DEFAULT_CONFIG","SENSITIVE_HEADERS","APILogger","defaultLogger","import_p_retry","DEFAULT_RETRY_CONFIG","shouldRetry","NetworkError","APIError","withRetry","pRetry","APIClient","FetchAdapter","APILogger","withRetry","APIError","NetworkError","LocalStorageAdapter","logger","import_zod","import_zod","import_zod","import_zod","import_zod","import_consola","TOKEN_KEY","REFRESH_TOKEN_KEY","API","logger","APILogger","LocalStorageAdapter","APIClient","import_consola","isStaticBuild","key","AnalyticsEvent","AnalyticsCategory","import_react","import_swr","import_swr","import_swr","import_jsx_runtime","refreshToken","import_react","import_hooks","import_react","useLocalStorage","key","import_react","import_navigation","import_react","import_hooks","useLocalStorage","identifier","error","otp","savedEmail","savedPhone","import_react","import_hooks","import_swr","import_swr","import_swr","import_swr","import_swr","isStaticBuild","apiUrl","API"]}
|
|
1
|
+
{"version":3,"sources":["../src/auth/index.ts","../src/auth/context/AuthContext.tsx","../src/generated/cfg_accounts/accounts__auth/client.ts","../src/generated/cfg_accounts/accounts__oauth/client.ts","../src/generated/cfg_accounts/accounts__user_profile/client.ts","../src/generated/cfg_accounts/accounts/client.ts","../src/generated/cfg_accounts/http.ts","../src/generated/cfg_accounts/errors.ts","../src/generated/cfg_accounts/logger.ts","../src/generated/cfg_accounts/retry.ts","../src/generated/cfg_accounts/client.ts","../src/generated/cfg_accounts/storage.ts","../src/generated/cfg_accounts/enums.ts","../src/generated/cfg_accounts/_utils/schemas/CentrifugoToken.schema.ts","../src/generated/cfg_accounts/_utils/schemas/OAuthAuthorizeRequestRequest.schema.ts","../src/generated/cfg_accounts/_utils/schemas/OAuthAuthorizeResponse.schema.ts","../src/generated/cfg_accounts/_utils/schemas/OAuthCallbackRequestRequest.schema.ts","../src/generated/cfg_accounts/_utils/schemas/OAuthConnection.schema.ts","../src/generated/cfg_accounts/_utils/schemas/OAuthDisconnectRequestRequest.schema.ts","../src/generated/cfg_accounts/_utils/schemas/OAuthError.schema.ts","../src/generated/cfg_accounts/_utils/schemas/OAuthProvidersResponse.schema.ts","../src/generated/cfg_accounts/_utils/schemas/OAuthTokenResponse.schema.ts","../src/generated/cfg_accounts/_utils/schemas/OTPErrorResponse.schema.ts","../src/generated/cfg_accounts/_utils/schemas/OTPRequestRequest.schema.ts","../src/generated/cfg_accounts/_utils/schemas/OTPRequestResponse.schema.ts","../src/generated/cfg_accounts/_utils/schemas/OTPVerifyRequest.schema.ts","../src/generated/cfg_accounts/_utils/schemas/OTPVerifyResponse.schema.ts","../src/generated/cfg_accounts/_utils/schemas/User.schema.ts","../src/generated/cfg_accounts/_utils/schemas/PatchedUserProfileUpdateRequest.schema.ts","../src/generated/cfg_accounts/_utils/schemas/TokenRefresh.schema.ts","../src/generated/cfg_accounts/_utils/schemas/TokenRefreshRequest.schema.ts","../src/generated/cfg_accounts/_utils/schemas/UserProfileUpdateRequest.schema.ts","../src/generated/cfg_accounts/_utils/fetchers/accounts.ts","../src/generated/cfg_accounts/api-instance.ts","../src/generated/cfg_accounts/_utils/fetchers/accounts__auth.ts","../src/generated/cfg_accounts/_utils/fetchers/accounts__oauth.ts","../src/generated/cfg_accounts/_utils/fetchers/accounts__user_profile.ts","../src/generated/cfg_accounts/index.ts","../src/generated/cfg_centrifugo/centrifugo__centrifugo_admin_api/client.ts","../src/generated/cfg_centrifugo/centrifugo__centrifugo_auth/client.ts","../src/generated/cfg_centrifugo/centrifugo__centrifugo_monitoring/client.ts","../src/generated/cfg_centrifugo/centrifugo__centrifugo_testing/client.ts","../src/generated/cfg_centrifugo/http.ts","../src/generated/cfg_centrifugo/errors.ts","../src/generated/cfg_centrifugo/logger.ts","../src/generated/cfg_centrifugo/retry.ts","../src/generated/cfg_centrifugo/client.ts","../src/generated/cfg_centrifugo/storage.ts","../src/generated/cfg_centrifugo/_utils/schemas/CentrifugoChannelInfo.schema.ts","../src/generated/cfg_centrifugo/_utils/schemas/CentrifugoChannelsRequestRequest.schema.ts","../src/generated/cfg_centrifugo/_utils/schemas/CentrifugoChannelsResponse.schema.ts","../src/generated/cfg_centrifugo/_utils/schemas/CentrifugoChannelsResult.schema.ts","../src/generated/cfg_centrifugo/_utils/schemas/CentrifugoError.schema.ts","../src/generated/cfg_centrifugo/_utils/schemas/CentrifugoClientInfo.schema.ts","../src/generated/cfg_centrifugo/_utils/schemas/CentrifugoHealthCheck.schema.ts","../src/generated/cfg_centrifugo/_utils/schemas/CentrifugoHistoryRequestRequest.schema.ts","../src/generated/cfg_centrifugo/_utils/schemas/CentrifugoStreamPosition.schema.ts","../src/generated/cfg_centrifugo/_utils/schemas/CentrifugoHistoryResponse.schema.ts","../src/generated/cfg_centrifugo/_utils/schemas/CentrifugoHistoryResult.schema.ts","../src/generated/cfg_centrifugo/_utils/schemas/CentrifugoPublication.schema.ts","../src/generated/cfg_centrifugo/_utils/schemas/CentrifugoInfoResponse.schema.ts","../src/generated/cfg_centrifugo/_utils/schemas/CentrifugoInfoResult.schema.ts","../src/generated/cfg_centrifugo/_utils/schemas/CentrifugoNodeInfo.schema.ts","../src/generated/cfg_centrifugo/_utils/schemas/CentrifugoMetrics.schema.ts","../src/generated/cfg_centrifugo/_utils/schemas/CentrifugoProcess.schema.ts","../src/generated/cfg_centrifugo/_utils/schemas/CentrifugoOverviewStats.schema.ts","../src/generated/cfg_centrifugo/_utils/schemas/CentrifugoPresenceRequestRequest.schema.ts","../src/generated/cfg_centrifugo/_utils/schemas/CentrifugoPresenceResponse.schema.ts","../src/generated/cfg_centrifugo/_utils/schemas/CentrifugoPresenceResult.schema.ts","../src/generated/cfg_centrifugo/_utils/schemas/CentrifugoPresenceStatsRequestRequest.schema.ts","../src/generated/cfg_centrifugo/_utils/schemas/CentrifugoPresenceStatsResponse.schema.ts","../src/generated/cfg_centrifugo/_utils/schemas/CentrifugoPresenceStatsResult.schema.ts","../src/generated/cfg_centrifugo/_utils/schemas/ChannelList.schema.ts","../src/generated/cfg_centrifugo/_utils/schemas/ChannelStats.schema.ts","../src/generated/cfg_centrifugo/_utils/schemas/ConnectionTokenResponse.schema.ts","../src/generated/cfg_centrifugo/_utils/schemas/ManualAckRequestRequest.schema.ts","../src/generated/cfg_centrifugo/_utils/schemas/ManualAckResponse.schema.ts","../src/generated/cfg_centrifugo/_utils/schemas/PaginatedPublishList.schema.ts","../src/generated/cfg_centrifugo/_utils/schemas/Publish.schema.ts","../src/generated/cfg_centrifugo/_utils/schemas/PublishTestRequestRequest.schema.ts","../src/generated/cfg_centrifugo/_utils/schemas/PublishTestResponse.schema.ts","../src/generated/cfg_centrifugo/_utils/schemas/TimelineItem.schema.ts","../src/generated/cfg_centrifugo/_utils/schemas/TimelineResponse.schema.ts","../src/generated/cfg_centrifugo/_utils/fetchers/centrifugo__centrifugo_admin_api.ts","../src/generated/cfg_centrifugo/_utils/fetchers/centrifugo__centrifugo_auth.ts","../src/generated/cfg_centrifugo/_utils/fetchers/centrifugo__centrifugo_monitoring.ts","../src/generated/cfg_centrifugo/_utils/fetchers/centrifugo__centrifugo_testing.ts","../src/generated/cfg_centrifugo/index.ts","../src/generated/cfg_webpush/webpush__web_push/client.ts","../src/generated/cfg_webpush/http.ts","../src/generated/cfg_webpush/errors.ts","../src/generated/cfg_webpush/logger.ts","../src/generated/cfg_webpush/retry.ts","../src/generated/cfg_webpush/client.ts","../src/generated/cfg_webpush/storage.ts","../src/generated/cfg_webpush/_utils/schemas/SendPushRequestRequest.schema.ts","../src/generated/cfg_webpush/_utils/schemas/SendPushResponse.schema.ts","../src/generated/cfg_webpush/_utils/schemas/SubscribeRequestRequest.schema.ts","../src/generated/cfg_webpush/_utils/schemas/SubscribeResponse.schema.ts","../src/generated/cfg_webpush/_utils/schemas/VapidPublicKeyResponse.schema.ts","../src/generated/cfg_webpush/_utils/fetchers/webpush__web_push.ts","../src/generated/cfg_webpush/index.ts","../src/index.ts","../src/auth/utils/logger.ts","../src/auth/hooks/useBase64.ts","../src/auth/hooks/useProfileCache.ts","../src/auth/hooks/useSessionStorage.ts","../src/auth/hooks/useAuthRedirect.ts","../src/auth/utils/analytics.ts","../src/auth/context/AccountsContext.tsx","../src/generated/cfg_accounts/_utils/hooks/accounts__auth.ts","../src/generated/cfg_accounts/_utils/hooks/accounts__oauth.ts","../src/generated/cfg_accounts/_utils/hooks/accounts__user_profile.ts","../src/generated/cfg_accounts/_utils/hooks/accounts.ts","../src/auth/hooks/useAuthGuard.ts","../src/auth/hooks/useLocalStorage.ts","../src/auth/hooks/useAuthForm.ts","../src/auth/hooks/useAutoAuth.ts","../src/auth/hooks/useGithubAuth.ts","../src/generated/cfg_webpush/_utils/hooks/webpush__web_push.ts","../src/generated/cfg_centrifugo/_utils/hooks/centrifugo__centrifugo_admin_api.ts","../src/generated/cfg_centrifugo/_utils/hooks/centrifugo__centrifugo_auth.ts","../src/generated/cfg_centrifugo/_utils/hooks/centrifugo__centrifugo_monitoring.ts","../src/generated/cfg_centrifugo/_utils/hooks/centrifugo__centrifugo_testing.ts","../src/clients.ts","../src/auth/utils/validation.ts","../src/auth/utils/errors.ts"],"sourcesContent":["/**\n * @djangocfg/api/auth\n *\n * Authentication module with contexts, hooks and utilities.\n * Use this entry point in client components.\n *\n * @example\n * ```tsx\n * 'use client';\n * import { AuthProvider, useAuth } from '@djangocfg/api/auth';\n *\n * export function MyApp({ children }) {\n * return (\n * <AuthProvider>\n * {children}\n * </AuthProvider>\n * );\n * }\n *\n * export function Profile() {\n * const { user, logout } = useAuth();\n * return <div>{user?.email}</div>;\n * }\n * ```\n */\n\n// Contexts\nexport * from './context';\n\n// Hooks\nexport * from './hooks';\n\n// Utils (validation, errors, analytics)\nexport * from './utils';\n","// @ts-nocheck\n'use client';\n\nimport { usePathname } from 'next/navigation';\nimport React, {\n createContext, ReactNode, useCallback, useContext, useEffect, useMemo, useRef, useState\n} from 'react';\n\nimport { useCfgRouter, useLocalStorage, useQueryParams } from '@djangocfg/ui-nextjs/hooks';\n\nimport { api as apiAccounts, Enums } from '../../';\nimport { clearProfileCache, getCachedProfile } from '../hooks/useProfileCache';\nimport { useAuthRedirectManager } from '../hooks/useAuthRedirect';\nimport { Analytics, AnalyticsCategory, AnalyticsEvent } from '../utils/analytics';\nimport { authLogger } from '../utils/logger';\nimport { AccountsProvider, useAccountsContext } from './AccountsContext';\n\nimport type { AuthConfig, AuthContextType, AuthProviderProps, UserProfile } from './types';\n\n// Default routes\nconst defaultRoutes = {\n auth: '/auth',\n defaultCallback: '/dashboard',\n defaultAuthCallback: '/auth',\n};\n\nconst AuthContext = createContext<AuthContextType | undefined>(undefined);\n\n// Constants\nconst EMAIL_STORAGE_KEY = 'auth_email';\nconst PHONE_STORAGE_KEY = 'auth_phone';\n\nconst hasValidTokens = (): boolean => {\n if (typeof window === 'undefined') return false;\n return apiAccounts.isAuthenticated();\n};\n\n// Internal provider that uses AccountsContext\nconst AuthProviderInternal: React.FC<AuthProviderProps> = ({ children, config }) => {\n const accounts = useAccountsContext();\n\n // Redirect URL manager for saving URL before auth redirect\n const redirectManager = useAuthRedirectManager({\n fallbackUrl: config?.routes?.defaultCallback || defaultRoutes.defaultCallback,\n clearOnUse: true,\n });\n\n // Smart initial loading state: only true if we don't have tokens yet\n const [isLoading, setIsLoading] = useState(() => {\n // If we already have tokens and profile, don't show loading\n if (typeof window !== 'undefined') {\n const hasTokens = hasValidTokens();\n // Only show loading on initial mount if no tokens\n return !hasTokens;\n }\n return true;\n });\n\n const [initialized, setInitialized] = useState(false);\n const router = useCfgRouter();\n const pathname = usePathname();\n const queryParams = useQueryParams();\n\n // Use localStorage hooks for email and phone\n const [storedEmail, setStoredEmail, clearStoredEmail] = useLocalStorage<string | null>(EMAIL_STORAGE_KEY, null);\n const [storedPhone, setStoredPhone, clearStoredPhone] = useLocalStorage<string | null>(PHONE_STORAGE_KEY, null);\n\n // Map AccountsContext profile to UserProfile\n const user = accounts.profile as UserProfile | null;\n\n // Use refs to avoid dependency issues\n const userRef = useRef(user);\n const configRef = useRef(config);\n const isLoadingProfileRef = useRef(false);\n\n // Update refs when values change\n useEffect(() => {\n userRef.current = user;\n }, [user]);\n\n useEffect(() => {\n configRef.current = config;\n }, [config]);\n\n // Note: API URL is configured in BaseClient, not at runtime\n\n // Common function to clear auth state\n const clearAuthState = useCallback((caller: string) => {\n authLogger.info('clearAuthState >> caller', caller);\n apiAccounts.clearTokens();\n clearProfileCache(); // Clear profile cache from localStorage\n // Note: user is now managed by AccountsContext, will auto-update\n setInitialized(true);\n setIsLoading(false);\n }, []);\n\n // Global error handler for auth-related errors\n const handleGlobalAuthError = useCallback((error: any, context: string = 'API Request') => {\n // Simple error check - if response has error flag, it's an error\n if (error?.success === false) {\n authLogger.warn(`Error detected in ${context}, clearing tokens`);\n clearAuthState(`globalAuthError:${context}`);\n return true;\n }\n\n return false;\n }, [clearAuthState]);\n\n // Simple profile loading without retry - now uses AccountsContext with memoization\n const loadCurrentProfile = useCallback(async (callerId?: string): Promise<void> => {\n const finalCallerId = callerId || 'AuthContext.loadCurrentProfile';\n\n // Check if profile loading is already in progress\n if (isLoadingProfileRef.current) {\n authLogger.debug(`Profile loading already in progress, skipping duplicate call from: ${finalCallerId}`);\n return;\n }\n\n authLogger.debug(`loadCurrentProfile called by: ${finalCallerId}`);\n\n try {\n isLoadingProfileRef.current = true;\n\n // Ensure API clients are properly initialized with current token\n const isAuth = apiAccounts.isAuthenticated();\n const token = apiAccounts.getToken();\n // authLogger.debug('isAuthenticated:', isAuth, 'token:', token ? token.substring(0, 20) + '...' : 'null');\n\n if (!isAuth) {\n authLogger.warn('No valid authentication token, throwing error');\n throw new Error('No valid authentication token');\n }\n\n // Check if profile is already loaded in AccountsContext to prevent duplicate API calls\n if (accounts.profile && !accounts.isLoadingProfile) {\n authLogger.debug('Profile already loaded in AccountsContext, skipping API call');\n setInitialized(true);\n return;\n }\n\n // Refresh profile from AccountsContext (now with memoization)\n const refreshedProfile = await accounts.refreshProfile(finalCallerId);\n\n if (refreshedProfile) {\n authLogger.info('Profile loaded successfully:', refreshedProfile.id);\n } else {\n authLogger.warn('Profile refresh returned undefined - but keeping tokens');\n }\n\n // Always mark as initialized if we have valid tokens\n // Don't clear tokens just because profile fetch failed\n setInitialized(true);\n } catch (error) {\n authLogger.error('Failed to load profile:', error);\n // Use global error handler first, fallback to clearing state\n if (!handleGlobalAuthError(error, 'loadCurrentProfile')) {\n clearAuthState('loadCurrentProfile:error');\n }\n } finally {\n isLoadingProfileRef.current = false;\n }\n }, [clearAuthState, handleGlobalAuthError, accounts]);\n\n // Initialize auth state once\n useEffect(() => {\n if (initialized) return;\n\n const initializeAuth = async () => {\n authLogger.info('Initializing auth...');\n\n // Check if running in iframe (AdminLayout will handle auth via postMessage)\n const isInIframe = typeof window !== 'undefined' && window.self !== window.top;\n authLogger.info('Is in iframe:', isInIframe);\n\n // Debug token state\n const token = apiAccounts.getToken();\n const refreshToken = apiAccounts.getRefreshToken();\n authLogger.info('Token from API:', token ? `${token.substring(0, 20)}...` : 'null');\n authLogger.info('Refresh token from API:', refreshToken ? `${refreshToken.substring(0, 20)}...` : 'null');\n authLogger.info('localStorage keys:', Object.keys(localStorage).filter(k => k.includes('token') || k.includes('auth')));\n\n const hasTokens = hasValidTokens();\n authLogger.info('Has tokens:', hasTokens);\n\n // Check if profile is already loaded from cache (AccountsContext initialization)\n if (userRef.current) {\n authLogger.info('Profile already loaded from AccountsContext cache, skipping API request');\n setInitialized(true);\n setIsLoading(false);\n return;\n }\n\n // Check if cache exists in localStorage (before userRef updates)\n const cachedProfile = getCachedProfile();\n if (cachedProfile) {\n authLogger.info('Profile found in localStorage cache, skipping API request');\n setInitialized(true);\n setIsLoading(false);\n return;\n }\n\n // In iframe mode WITHOUT tokens yet - wait for AdminLayout to receive them via postMessage\n // Don't initialize yet - AdminLayout.handleAuthToken will call loadCurrentProfile\n if (isInIframe && !hasTokens) {\n authLogger.info('Running in iframe without tokens - waiting for parent to send via postMessage');\n authLogger.info('AdminLayout will handle auth initialization, skipping AuthContext init');\n setInitialized(true); // Mark as initialized to prevent re-initialization\n setIsLoading(false);\n return;\n }\n\n if (hasTokens) {\n setIsLoading(true);\n try {\n authLogger.info('No cached profile found, loading from API...');\n await loadCurrentProfile('AuthContext.initializeAuth');\n } catch (error) {\n authLogger.error('Failed to load profile during initialization:', error);\n // If profile loading fails, clear auth state\n clearAuthState('initializeAuth:loadProfileFailed');\n }\n setIsLoading(false);\n } else {\n setInitialized(true);\n setIsLoading(false);\n }\n };\n\n initializeAuth();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [initialized]);\n\n // Redirect logic - only for unauthenticated users on protected pages\n useEffect(() => {\n if (!initialized) return;\n\n // Consider authenticated if we have valid tokens, even without profile\n const isAuthenticated = apiAccounts.isAuthenticated();\n const authRoute = config?.routes?.auth || defaultRoutes.auth;\n const isAuthPage = pathname === authRoute;\n const flowParam = queryParams.get('flow');\n\n // Only redirect authenticated users away from auth page if they're not in a flow\n // This prevents interference with OTP verification flow\n if (isAuthenticated && isAuthPage && !flowParam) {\n const callbackUrl = config?.routes?.defaultCallback || defaultRoutes.defaultCallback;\n router.push(callbackUrl);\n }\n }, [initialized, pathname, queryParams, config?.routes]);\n\n const pushToDefaultCallbackUrl = useCallback(() => {\n const callbackUrl = config?.routes?.defaultCallback || defaultRoutes.defaultCallback;\n router.push(callbackUrl);\n }, [config?.routes, router]);\n\n const pushToDefaultAuthCallbackUrl = useCallback(() => {\n const authCallbackUrl = config?.routes?.defaultAuthCallback || defaultRoutes.defaultAuthCallback;\n router.push(authCallbackUrl);\n }, [config?.routes, router]);\n\n // Memoized checkAuthAndRedirect function\n const checkAuthAndRedirect = useCallback(async () => {\n try {\n setIsLoading(true);\n const isAuthenticated = apiAccounts.isAuthenticated();\n\n if (isAuthenticated) {\n await loadCurrentProfile();\n if (userRef.current) {\n pushToDefaultCallbackUrl();\n }\n } else {\n pushToDefaultAuthCallbackUrl();\n }\n } catch (error) {\n authLogger.error('Failed to check authentication:', error);\n // Use global error handler first\n if (!handleGlobalAuthError(error, 'checkAuthAndRedirect')) {\n clearAuthState('checkAuthAndRedirect');\n }\n pushToDefaultAuthCallbackUrl();\n } finally {\n setIsLoading(false);\n }\n }, [loadCurrentProfile, clearAuthState, pushToDefaultCallbackUrl, pushToDefaultAuthCallbackUrl, handleGlobalAuthError]);\n\n // OTP methods - supports both email and phone - now uses AccountsContext\n const requestOTP = useCallback(\n async (identifier: string, channel?: 'email' | 'phone', sourceUrl?: string): Promise<{ success: boolean; message: string }> => {\n // Clear tokens before requesting OTP\n apiAccounts.clearTokens();\n\n try {\n const channelValue = channel === 'phone' \n ? Enums.OTPRequestRequestChannel.PHONE \n : Enums.OTPRequestRequestChannel.EMAIL;\n const result = await accounts.requestOTP({\n identifier,\n channel: channelValue,\n });\n\n const channelName = channel === 'phone' ? 'phone number' : 'email address';\n\n // Track OTP request\n Analytics.event(AnalyticsEvent.AUTH_OTP_REQUEST, {\n category: AnalyticsCategory.AUTH,\n label: channel || 'email',\n });\n\n return {\n success: true,\n message: result.message || `OTP code sent to your ${channelName}`,\n };\n } catch (error) {\n authLogger.error('Request OTP error:', error);\n return {\n success: false,\n message: 'Failed to send OTP',\n };\n }\n },\n [accounts],\n );\n\n const verifyOTP = useCallback(\n async (identifier: string, otpCode: string, channel?: 'email' | 'phone', sourceUrl?: string, redirectUrl?: string): Promise<{ success: boolean; message: string; user?: UserProfile }> => {\n try {\n const channelValue = channel === 'phone'\n ? Enums.OTPVerifyRequestChannel.PHONE\n : Enums.OTPVerifyRequestChannel.EMAIL;\n // AccountsContext automatically saves tokens and refreshes profile\n const result = await accounts.verifyOTP({\n identifier,\n otp: otpCode,\n channel: channelValue,\n });\n\n // Verify that we got valid tokens\n if (!result.access || !result.refresh) {\n authLogger.error('Verify OTP returned invalid response:', result);\n return {\n success: false,\n message: 'Invalid OTP verification response',\n };\n }\n\n // Save identifier based on channel and clear opposite channel\n if (channel === 'phone') {\n setStoredPhone(identifier);\n clearStoredEmail();\n } else if (identifier.includes('@')) {\n setStoredEmail(identifier);\n clearStoredPhone();\n }\n\n // Small delay to ensure profile state is updated\n await new Promise(resolve => setTimeout(resolve, 200));\n\n // Track successful login\n Analytics.event(AnalyticsEvent.AUTH_LOGIN_SUCCESS, {\n category: AnalyticsCategory.AUTH,\n label: channel || 'email',\n });\n\n // Set user ID for future tracking\n if (result.user?.id) {\n Analytics.setUser(String(result.user.id));\n }\n\n // Handle redirect logic - priority: provided redirectUrl > saved redirect > config default\n // Use hardPush for full page reload - ensures all React contexts reinitialize\n const savedRedirect = redirectManager.useAndClearRedirect();\n const finalRedirectUrl = redirectUrl || savedRedirect || config?.routes?.defaultCallback || defaultRoutes.defaultCallback;\n authLogger.info('Redirecting after auth to:', finalRedirectUrl);\n router.hardPush(finalRedirectUrl);\n\n return {\n success: true,\n message: 'Login successful',\n user: result.user as UserProfile,\n };\n } catch (error) {\n authLogger.error('Verify OTP error:', error);\n\n // Track failed verification\n Analytics.event(AnalyticsEvent.AUTH_OTP_VERIFY_FAIL, {\n category: AnalyticsCategory.AUTH,\n label: channel || 'email',\n });\n\n return {\n success: false,\n message: 'Failed to verify OTP',\n };\n }\n },\n [setStoredEmail, setStoredPhone, clearStoredEmail, clearStoredPhone, config?.routes?.defaultCallback, accounts, router],\n );\n\n const refreshToken = useCallback(async (): Promise<{ success: boolean; message: string }> => {\n try {\n const refreshTokenValue = apiAccounts.getRefreshToken();\n if (!refreshTokenValue) {\n clearAuthState('refreshToken:noToken');\n\n // Track session expired\n Analytics.event(AnalyticsEvent.AUTH_SESSION_EXPIRED, {\n category: AnalyticsCategory.AUTH,\n });\n\n return {\n success: false,\n message: 'No refresh token available',\n };\n }\n\n await accounts.refreshToken(refreshTokenValue);\n\n // Track successful refresh\n Analytics.event(AnalyticsEvent.AUTH_TOKEN_REFRESH, {\n category: AnalyticsCategory.AUTH,\n });\n\n return {\n success: true,\n message: 'Token refreshed',\n };\n } catch (error) {\n authLogger.error('Refresh token error:', error);\n clearAuthState('refreshToken:error');\n\n // Track refresh failure\n Analytics.event(AnalyticsEvent.AUTH_TOKEN_REFRESH_FAIL, {\n category: AnalyticsCategory.AUTH,\n });\n\n return {\n success: false,\n message: 'Error refreshing token',\n };\n }\n }, [clearAuthState, accounts]);\n\n const logout = useCallback(async (): Promise<void> => {\n const performLogout = () => {\n // Track logout\n Analytics.event(AnalyticsEvent.AUTH_LOGOUT, {\n category: AnalyticsCategory.AUTH,\n });\n\n accounts.logout(); // Clear tokens and profile\n setInitialized(true);\n setIsLoading(false);\n\n // Use hardReplace for full page reload + replace history\n // This ensures contexts reinitialize AND back button won't return to protected page\n const authCallbackUrl = config?.routes?.defaultAuthCallback || defaultRoutes.defaultAuthCallback;\n router.hardReplace(authCallbackUrl);\n };\n\n // Use config.onConfirm if provided, otherwise use a simple confirm\n if (configRef.current?.onConfirm) {\n const { confirmed } = await configRef.current.onConfirm({\n title: 'Logout',\n description: 'Are you sure you want to logout?',\n confirmationButtonText: 'Logout',\n cancellationButtonText: 'Cancel',\n color: 'error',\n });\n if (confirmed) {\n performLogout();\n }\n } else {\n // Fallback to browser confirm\n const confirmed = window.confirm('Are you sure you want to logout?');\n if (confirmed) {\n performLogout();\n }\n }\n }, [accounts, config?.routes?.defaultAuthCallback, router]);\n\n // Computed: Is admin user (staff or superuser)\n const isAdminUser = useMemo(() => {\n return Boolean(user?.is_staff || user?.is_superuser);\n }, [user]);\n\n // Memoized context value\n const value = useMemo<AuthContextType>(\n () => ({\n user,\n isLoading,\n // Consider authenticated if we have valid tokens, even without user profile\n isAuthenticated: apiAccounts.isAuthenticated(),\n isAdminUser,\n loadCurrentProfile,\n checkAuthAndRedirect,\n getToken: () => apiAccounts.getToken(),\n getRefreshToken: () => apiAccounts.getRefreshToken(),\n getSavedEmail: () => storedEmail,\n saveEmail: setStoredEmail,\n clearSavedEmail: clearStoredEmail,\n getSavedPhone: () => storedPhone,\n savePhone: setStoredPhone,\n clearSavedPhone: clearStoredPhone,\n requestOTP,\n verifyOTP,\n refreshToken,\n logout,\n // Redirect URL methods\n saveRedirectUrl: redirectManager.setRedirect,\n getRedirectUrl: redirectManager.getFinalRedirectUrl,\n clearRedirectUrl: redirectManager.clearRedirect,\n hasRedirectUrl: redirectManager.hasRedirect,\n }),\n [\n user,\n isLoading,\n isAdminUser,\n loadCurrentProfile,\n checkAuthAndRedirect,\n storedEmail,\n setStoredEmail,\n clearStoredEmail,\n storedPhone,\n setStoredPhone,\n clearStoredPhone,\n requestOTP,\n verifyOTP,\n refreshToken,\n logout,\n redirectManager,\n ],\n );\n\n return <AuthContext.Provider value={value}>{children}</AuthContext.Provider>;\n};\n\n// Wrapper that provides AccountsContext\nexport const AuthProvider: React.FC<AuthProviderProps> = ({ children, config }) => {\n return (\n <AccountsProvider>\n <AuthProviderInternal config={config}>\n {children}\n </AuthProviderInternal>\n </AccountsProvider>\n );\n};\n\nexport const useAuth = (): AuthContextType => {\n const context = useContext(AuthContext);\n if (context === undefined) {\n throw new Error('useAuth must be used within an AuthProvider');\n }\n return context;\n};\n\nexport default AuthContext; ","import * as Models from \"./models\";\n\n\n/**\n * API endpoints for Auth.\n */\nexport class Auth {\n private client: any;\n\n constructor(client: any) {\n this.client = client;\n }\n\n /**\n * Refresh JWT token.\n */\n async accountsTokenRefreshCreate(data: Models.TokenRefreshRequest): Promise<Models.TokenRefresh> {\n const response = await this.client.request('POST', \"/cfg/accounts/token/refresh/\", { body: data });\n return response;\n }\n\n}","import * as Models from \"./models\";\n\n\n/**\n * API endpoints for Oauth.\n */\nexport class Oauth {\n private client: any;\n\n constructor(client: any) {\n this.client = client;\n }\n\n /**\n * List OAuth connections\n * \n * Get all OAuth connections for the current user.\n */\n async accountsOauthConnectionsList(): Promise<any> {\n const response = await this.client.request('GET', \"/cfg/accounts/oauth/connections/\");\n return response;\n }\n\n /**\n * Disconnect OAuth provider\n * \n * Remove OAuth connection for the specified provider.\n */\n async accountsOauthDisconnectCreate(data: Models.OAuthDisconnectRequestRequest): Promise<any> {\n const response = await this.client.request('POST', \"/cfg/accounts/oauth/disconnect/\", { body: data });\n return response;\n }\n\n /**\n * Start GitHub OAuth\n * \n * Generate GitHub OAuth authorization URL. Redirect user to this URL to\n * start authentication.\n */\n async accountsOauthGithubAuthorizeCreate(data: Models.OAuthAuthorizeRequestRequest): Promise<Models.OAuthAuthorizeResponse> {\n const response = await this.client.request('POST', \"/cfg/accounts/oauth/github/authorize/\", { body: data });\n return response;\n }\n\n /**\n * Complete GitHub OAuth\n * \n * Exchange authorization code for JWT tokens. Call this after GitHub\n * redirects back with code.\n */\n async accountsOauthGithubCallbackCreate(data: Models.OAuthCallbackRequestRequest): Promise<Models.OAuthTokenResponse> {\n const response = await this.client.request('POST', \"/cfg/accounts/oauth/github/callback/\", { body: data });\n return response;\n }\n\n /**\n * List OAuth providers\n * \n * Get list of available OAuth providers for authentication.\n */\n async accountsOauthProvidersRetrieve(): Promise<Models.OAuthProvidersResponse> {\n const response = await this.client.request('GET', \"/cfg/accounts/oauth/providers/\");\n return response;\n }\n\n}","import * as Models from \"./models\";\n\n\n/**\n * API endpoints for User Profile.\n */\nexport class UserProfile {\n private client: any;\n\n constructor(client: any) {\n this.client = client;\n }\n\n /**\n * Get current user profile\n * \n * Retrieve the current authenticated user's profile information.\n */\n async accountsProfileRetrieve(): Promise<Models.User> {\n const response = await this.client.request('GET', \"/cfg/accounts/profile/\");\n return response;\n }\n\n /**\n * Upload user avatar\n * \n * Upload avatar image for the current authenticated user. Accepts\n * multipart/form-data with 'avatar' field.\n */\n async accountsProfileAvatarCreate(data: FormData): Promise<Models.User> {\n const response = await this.client.request('POST', \"/cfg/accounts/profile/avatar/\", { formData: data });\n return response;\n }\n\n /**\n * Partial update user profile\n * \n * Partially update the current authenticated user's profile information.\n * Supports avatar upload.\n */\n async accountsProfilePartialUpdate(data: Models.UserProfileUpdateRequest): Promise<Models.User> {\n const response = await this.client.request('PUT', \"/cfg/accounts/profile/partial/\", { body: data });\n return response;\n }\n\n /**\n * Partial update user profile\n * \n * Partially update the current authenticated user's profile information.\n * Supports avatar upload.\n */\n async accountsProfilePartialPartialUpdate(data?: Models.PatchedUserProfileUpdateRequest): Promise<Models.User> {\n const response = await this.client.request('PATCH', \"/cfg/accounts/profile/partial/\", { body: data });\n return response;\n }\n\n /**\n * Update user profile\n * \n * Update the current authenticated user's profile information.\n */\n async accountsProfileUpdateUpdate(data: Models.UserProfileUpdateRequest): Promise<Models.User> {\n const response = await this.client.request('PUT', \"/cfg/accounts/profile/update/\", { body: data });\n return response;\n }\n\n /**\n * Update user profile\n * \n * Update the current authenticated user's profile information.\n */\n async accountsProfileUpdatePartialUpdate(data?: Models.PatchedUserProfileUpdateRequest): Promise<Models.User> {\n const response = await this.client.request('PATCH', \"/cfg/accounts/profile/update/\", { body: data });\n return response;\n }\n\n}","import * as Models from \"./models\";\n\n\n/**\n * API endpoints for Accounts.\n */\nexport class Accounts {\n private client: any;\n\n constructor(client: any) {\n this.client = client;\n }\n\n /**\n * Request OTP code to email or phone.\n */\n async otpRequestCreate(data: Models.OTPRequestRequest): Promise<Models.OTPRequestResponse> {\n const response = await this.client.request('POST', \"/cfg/accounts/otp/request/\", { body: data });\n return response;\n }\n\n /**\n * Verify OTP code and return JWT tokens.\n */\n async otpVerifyCreate(data: Models.OTPVerifyRequest): Promise<Models.OTPVerifyResponse> {\n const response = await this.client.request('POST', \"/cfg/accounts/otp/verify/\", { body: data });\n return response;\n }\n\n}","// Auto-generated by DjangoCFG - see CLAUDE.md\n/**\n * HTTP Client Adapter Pattern\n *\n * Allows switching between fetch/axios/httpx without changing generated code.\n * Provides unified interface for making HTTP requests.\n */\n\nexport interface HttpRequest {\n method: string;\n url: string;\n headers?: Record<string, string>;\n body?: any;\n params?: Record<string, any>;\n /** FormData for file uploads (multipart/form-data) */\n formData?: FormData;\n}\n\nexport interface HttpResponse<T = any> {\n data: T;\n status: number;\n statusText: string;\n headers: Record<string, string>;\n}\n\n/**\n * HTTP Client Adapter Interface.\n * Implement this to use custom HTTP clients (axios, httpx, etc.)\n */\nexport interface HttpClientAdapter {\n request<T = any>(request: HttpRequest): Promise<HttpResponse<T>>;\n}\n\n/**\n * Default Fetch API adapter.\n * Uses native browser fetch() with proper error handling.\n */\nexport class FetchAdapter implements HttpClientAdapter {\n async request<T = any>(request: HttpRequest): Promise<HttpResponse<T>> {\n const { method, url, headers, body, params, formData } = request;\n\n // Build URL with query params\n let finalUrl = url;\n if (params) {\n const searchParams = new URLSearchParams();\n Object.entries(params).forEach(([key, value]) => {\n if (value !== null && value !== undefined) {\n searchParams.append(key, String(value));\n }\n });\n const queryString = searchParams.toString();\n if (queryString) {\n finalUrl = url.includes('?') ? `${url}&${queryString}` : `${url}?${queryString}`;\n }\n }\n\n // Build headers\n const finalHeaders: Record<string, string> = { ...headers };\n\n // Determine body and content-type\n let requestBody: string | FormData | undefined;\n\n if (formData) {\n // For multipart/form-data, let browser set Content-Type with boundary\n requestBody = formData;\n // Don't set Content-Type - browser will set it with boundary\n } else if (body) {\n // JSON request\n finalHeaders['Content-Type'] = 'application/json';\n requestBody = JSON.stringify(body);\n }\n\n // Make request\n const response = await fetch(finalUrl, {\n method,\n headers: finalHeaders,\n body: requestBody,\n credentials: 'include', // Include Django session cookies\n });\n\n // Parse response\n let data: any = null;\n const contentType = response.headers.get('content-type');\n\n if (response.status !== 204 && contentType?.includes('application/json')) {\n data = await response.json();\n } else if (response.status !== 204) {\n data = await response.text();\n }\n\n // Convert Headers to plain object\n const responseHeaders: Record<string, string> = {};\n response.headers.forEach((value, key) => {\n responseHeaders[key] = value;\n });\n\n return {\n data,\n status: response.status,\n statusText: response.statusText,\n headers: responseHeaders,\n };\n }\n}","// Auto-generated by DjangoCFG - see CLAUDE.md\n/**\n * API Error Classes\n *\n * Typed error classes with Django REST Framework support.\n */\n\n/**\n * HTTP API Error with DRF field-specific validation errors.\n *\n * Usage:\n * ```typescript\n * try {\n * await api.users.create(userData);\n * } catch (error) {\n * if (error instanceof APIError) {\n * if (error.isValidationError) {\n * console.log('Field errors:', error.fieldErrors);\n * // { \"email\": [\"Email already exists\"], \"username\": [\"Required\"] }\n * }\n * }\n * }\n * ```\n */\nexport class APIError extends Error {\n constructor(\n public statusCode: number,\n public statusText: string,\n public response: any,\n public url: string,\n message?: string\n ) {\n super(message || `HTTP ${statusCode}: ${statusText}`);\n this.name = 'APIError';\n }\n\n /**\n * Get error details from response.\n * DRF typically returns: { \"detail\": \"Error message\" } or { \"field\": [\"error1\", \"error2\"] }\n */\n get details(): Record<string, any> | null {\n if (typeof this.response === 'object' && this.response !== null) {\n return this.response;\n }\n return null;\n }\n\n /**\n * Get field-specific validation errors from DRF.\n * Returns: { \"field_name\": [\"error1\", \"error2\"], ... }\n */\n get fieldErrors(): Record<string, string[]> | null {\n const details = this.details;\n if (!details) return null;\n\n // DRF typically returns: { \"field\": [\"error1\", \"error2\"] }\n const fieldErrors: Record<string, string[]> = {};\n for (const [key, value] of Object.entries(details)) {\n if (Array.isArray(value)) {\n fieldErrors[key] = value;\n }\n }\n\n return Object.keys(fieldErrors).length > 0 ? fieldErrors : null;\n }\n\n /**\n * Get single error message from DRF.\n * Checks for \"detail\", \"message\", or first field error.\n */\n get errorMessage(): string {\n const details = this.details;\n if (!details) return this.message;\n\n // Check for \"detail\" field (common in DRF)\n if (details.detail) {\n return Array.isArray(details.detail) ? details.detail.join(', ') : String(details.detail);\n }\n\n // Check for \"message\" field\n if (details.message) {\n return String(details.message);\n }\n\n // Return first field error\n const fieldErrors = this.fieldErrors;\n if (fieldErrors) {\n const firstField = Object.keys(fieldErrors)[0];\n if (firstField) {\n return `${firstField}: ${fieldErrors[firstField]?.join(', ')}`;\n }\n }\n\n return this.message;\n }\n\n // Helper methods for common HTTP status codes\n get isValidationError(): boolean { return this.statusCode === 400; }\n get isAuthError(): boolean { return this.statusCode === 401; }\n get isPermissionError(): boolean { return this.statusCode === 403; }\n get isNotFoundError(): boolean { return this.statusCode === 404; }\n get isServerError(): boolean { return this.statusCode >= 500 && this.statusCode < 600; }\n}\n\n/**\n * Network Error (connection failed, timeout, etc.)\n */\nexport class NetworkError extends Error {\n constructor(\n message: string,\n public url: string,\n public originalError?: Error\n ) {\n super(message);\n this.name = 'NetworkError';\n }\n}","// Auto-generated by DjangoCFG - see CLAUDE.md\n/**\n * API Logger with Consola\n * Beautiful console logging for API requests and responses\n *\n * Installation:\n * npm install consola\n */\n\nimport { type ConsolaInstance, createConsola } from 'consola';\n\n/**\n * Request log data\n */\nexport interface RequestLog {\n method: string;\n url: string;\n headers?: Record<string, string>;\n body?: any;\n timestamp: number;\n}\n\n/**\n * Response log data\n */\nexport interface ResponseLog {\n status: number;\n statusText: string;\n data?: any;\n duration: number;\n timestamp: number;\n}\n\n/**\n * Error log data\n */\nexport interface ErrorLog {\n message: string;\n statusCode?: number;\n fieldErrors?: Record<string, string[]>;\n duration: number;\n timestamp: number;\n}\n\n/**\n * Logger configuration\n */\nexport interface LoggerConfig {\n /** Enable logging */\n enabled: boolean;\n /** Log requests */\n logRequests: boolean;\n /** Log responses */\n logResponses: boolean;\n /** Log errors */\n logErrors: boolean;\n /** Log request/response bodies */\n logBodies: boolean;\n /** Log headers (excluding sensitive ones) */\n logHeaders: boolean;\n /** Custom consola instance */\n consola?: ConsolaInstance;\n}\n\n/**\n * Default logger configuration\n */\nconst DEFAULT_CONFIG: LoggerConfig = {\n enabled: process.env.NODE_ENV !== 'production',\n logRequests: true,\n logResponses: true,\n logErrors: true,\n logBodies: true,\n logHeaders: false,\n};\n\n/**\n * Sensitive header names to filter out\n */\nconst SENSITIVE_HEADERS = [\n 'authorization',\n 'cookie',\n 'set-cookie',\n 'x-api-key',\n 'x-csrf-token',\n];\n\n/**\n * API Logger class\n */\nexport class APILogger {\n private config: LoggerConfig;\n private consola: ConsolaInstance;\n\n constructor(config: Partial<LoggerConfig> = {}) {\n this.config = { ...DEFAULT_CONFIG, ...config };\n this.consola = config.consola || createConsola({\n level: this.config.enabled ? 4 : 0,\n });\n }\n\n /**\n * Enable logging\n */\n enable(): void {\n this.config.enabled = true;\n }\n\n /**\n * Disable logging\n */\n disable(): void {\n this.config.enabled = false;\n }\n\n /**\n * Update configuration\n */\n setConfig(config: Partial<LoggerConfig>): void {\n this.config = { ...this.config, ...config };\n }\n\n /**\n * Filter sensitive headers\n */\n private filterHeaders(headers?: Record<string, string>): Record<string, string> {\n if (!headers) return {};\n\n const filtered: Record<string, string> = {};\n Object.keys(headers).forEach((key) => {\n const lowerKey = key.toLowerCase();\n if (SENSITIVE_HEADERS.includes(lowerKey)) {\n filtered[key] = '***';\n } else {\n filtered[key] = headers[key] || '';\n }\n });\n\n return filtered;\n }\n\n /**\n * Log request\n */\n logRequest(request: RequestLog): void {\n if (!this.config.enabled || !this.config.logRequests) return;\n\n const { method, url, headers, body } = request;\n\n this.consola.start(`${method} ${url}`);\n\n if (this.config.logHeaders && headers) {\n this.consola.debug('Headers:', this.filterHeaders(headers));\n }\n\n if (this.config.logBodies && body) {\n this.consola.debug('Body:', body);\n }\n }\n\n /**\n * Log response\n */\n logResponse(request: RequestLog, response: ResponseLog): void {\n if (!this.config.enabled || !this.config.logResponses) return;\n\n const { method, url } = request;\n const { status, statusText, data, duration } = response;\n\n const statusColor = status >= 500 ? 'red'\n : status >= 400 ? 'yellow'\n : status >= 300 ? 'cyan'\n : 'green';\n\n this.consola.success(\n `${method} ${url} ${status} ${statusText} (${duration}ms)`\n );\n\n if (this.config.logBodies && data) {\n this.consola.debug('Response:', data);\n }\n }\n\n /**\n * Log error\n */\n logError(request: RequestLog, error: ErrorLog): void {\n if (!this.config.enabled || !this.config.logErrors) return;\n\n const { method, url } = request;\n const { message, statusCode, fieldErrors, duration } = error;\n\n this.consola.error(\n `${method} ${url} ${statusCode || 'Network'} Error (${duration}ms)`\n );\n\n this.consola.error('Message:', message);\n\n if (fieldErrors && Object.keys(fieldErrors).length > 0) {\n this.consola.error('Field Errors:');\n Object.entries(fieldErrors).forEach(([field, errors]) => {\n errors.forEach((err) => {\n this.consola.error(` • ${field}: ${err}`);\n });\n });\n }\n }\n\n /**\n * Log general info\n */\n info(message: string, ...args: any[]): void {\n if (!this.config.enabled) return;\n this.consola.info(message, ...args);\n }\n\n /**\n * Log warning\n */\n warn(message: string, ...args: any[]): void {\n if (!this.config.enabled) return;\n this.consola.warn(message, ...args);\n }\n\n /**\n * Log error\n */\n error(message: string, ...args: any[]): void {\n if (!this.config.enabled) return;\n this.consola.error(message, ...args);\n }\n\n /**\n * Log debug\n */\n debug(message: string, ...args: any[]): void {\n if (!this.config.enabled) return;\n this.consola.debug(message, ...args);\n }\n\n /**\n * Log success\n */\n success(message: string, ...args: any[]): void {\n if (!this.config.enabled) return;\n this.consola.success(message, ...args);\n }\n\n /**\n * Create a sub-logger with prefix\n */\n withTag(tag: string): ConsolaInstance {\n return this.consola.withTag(tag);\n }\n}\n\n/**\n * Default logger instance\n */\nexport const defaultLogger = new APILogger();","// Auto-generated by DjangoCFG - see CLAUDE.md\n/**\n * Retry Configuration and Utilities\n *\n * Provides automatic retry logic for failed HTTP requests using p-retry.\n * Retries only on network errors and server errors (5xx), not client errors (4xx).\n */\n\nimport pRetry, { AbortError } from 'p-retry';\nimport { APIError, NetworkError } from './errors';\n\n/**\n * Information about a failed retry attempt.\n */\nexport interface FailedAttemptInfo {\n /** The error that caused the failure */\n error: Error;\n /** The attempt number (1-indexed) */\n attemptNumber: number;\n /** Number of retries left */\n retriesLeft: number;\n}\n\n/**\n * Retry configuration options.\n *\n * Uses exponential backoff with jitter by default to avoid thundering herd.\n */\nexport interface RetryConfig {\n /**\n * Maximum number of retry attempts.\n * @default 3\n */\n retries?: number;\n\n /**\n * Exponential backoff factor.\n * @default 2\n */\n factor?: number;\n\n /**\n * Minimum wait time between retries (ms).\n * @default 1000\n */\n minTimeout?: number;\n\n /**\n * Maximum wait time between retries (ms).\n * @default 60000\n */\n maxTimeout?: number;\n\n /**\n * Add randomness to wait times (jitter).\n * Helps avoid thundering herd problem.\n * @default true\n */\n randomize?: boolean;\n\n /**\n * Callback called on each failed attempt.\n */\n onFailedAttempt?: (info: FailedAttemptInfo) => void;\n}\n\n/**\n * Default retry configuration.\n */\nexport const DEFAULT_RETRY_CONFIG: Required<RetryConfig> = {\n retries: 3,\n factor: 2,\n minTimeout: 1000,\n maxTimeout: 60000,\n randomize: true,\n onFailedAttempt: () => {},\n};\n\n/**\n * Determine if an error should trigger a retry.\n *\n * Retries on:\n * - Network errors (connection refused, timeout, etc.)\n * - Server errors (5xx status codes)\n * - Rate limiting (429 status code)\n *\n * Does NOT retry on:\n * - Client errors (4xx except 429)\n * - Authentication errors (401, 403)\n * - Not found (404)\n *\n * @param error - The error to check\n * @returns true if should retry, false otherwise\n */\nexport function shouldRetry(error: any): boolean {\n // Always retry network errors\n if (error instanceof NetworkError) {\n return true;\n }\n\n // For API errors, check status code\n if (error instanceof APIError) {\n const status = error.statusCode;\n\n // Retry on 5xx server errors\n if (status >= 500 && status < 600) {\n return true;\n }\n\n // Retry on 429 (rate limit)\n if (status === 429) {\n return true;\n }\n\n // Do NOT retry on 4xx client errors\n return false;\n }\n\n // Retry on unknown errors (might be network issues)\n return true;\n}\n\n/**\n * Wrap a function with retry logic.\n *\n * @param fn - Async function to retry\n * @param config - Retry configuration\n * @returns Result of the function\n *\n * @example\n * ```typescript\n * const result = await withRetry(\n * async () => fetch('https://api.example.com/users'),\n * { retries: 5, minTimeout: 2000 }\n * );\n * ```\n */\nexport async function withRetry<T>(\n fn: () => Promise<T>,\n config?: RetryConfig\n): Promise<T> {\n const finalConfig = { ...DEFAULT_RETRY_CONFIG, ...config };\n\n return pRetry(\n async () => {\n try {\n return await fn();\n } catch (error) {\n // Check if we should retry this error\n if (!shouldRetry(error)) {\n // Abort retry immediately for non-retryable errors\n throw new AbortError(error as Error);\n }\n\n // Re-throw error to trigger retry\n throw error;\n }\n },\n {\n retries: finalConfig.retries,\n factor: finalConfig.factor,\n minTimeout: finalConfig.minTimeout,\n maxTimeout: finalConfig.maxTimeout,\n randomize: finalConfig.randomize,\n onFailedAttempt: finalConfig.onFailedAttempt ? (error) => {\n // Adapt p-retry's FailedAttemptError to our FailedAttemptInfo\n const pRetryError = error as any; // p-retry's internal type\n finalConfig.onFailedAttempt!({\n error: pRetryError as Error,\n attemptNumber: pRetryError.attemptNumber,\n retriesLeft: pRetryError.retriesLeft,\n });\n } : undefined,\n }\n );\n}","import { Auth } from \"./accounts__auth\";\nimport { Oauth } from \"./accounts__oauth\";\nimport { UserProfile } from \"./accounts__user_profile\";\nimport { Accounts } from \"./accounts\";\nimport { HttpClientAdapter, FetchAdapter } from \"./http\";\nimport { APIError, NetworkError } from \"./errors\";\nimport { APILogger, type LoggerConfig } from \"./logger\";\nimport { withRetry, type RetryConfig } from \"./retry\";\n\n\n/**\n * Async API client for Django CFG API.\n *\n * Usage:\n * ```typescript\n * const client = new APIClient('https://api.example.com');\n * const users = await client.users.list();\n * const post = await client.posts.create(newPost);\n *\n * // Custom HTTP adapter (e.g., Axios)\n * const client = new APIClient('https://api.example.com', {\n * httpClient: new AxiosAdapter()\n * });\n * ```\n */\nexport class APIClient {\n private baseUrl: string;\n private httpClient: HttpClientAdapter;\n private logger: APILogger | null = null;\n private retryConfig: RetryConfig | null = null;\n\n // Sub-clients\n public auth: Auth;\n public oauth: Oauth;\n public user_profile: UserProfile;\n public accounts: Accounts;\n\n constructor(\n baseUrl: string,\n options?: {\n httpClient?: HttpClientAdapter;\n loggerConfig?: Partial<LoggerConfig>;\n retryConfig?: RetryConfig;\n }\n ) {\n this.baseUrl = baseUrl.replace(/\\/$/, '');\n this.httpClient = options?.httpClient || new FetchAdapter();\n\n // Initialize logger if config provided\n if (options?.loggerConfig !== undefined) {\n this.logger = new APILogger(options.loggerConfig);\n }\n\n // Store retry configuration\n if (options?.retryConfig !== undefined) {\n this.retryConfig = options.retryConfig;\n }\n\n // Initialize sub-clients\n this.auth = new Auth(this);\n this.oauth = new Oauth(this);\n this.user_profile = new UserProfile(this);\n this.accounts = new Accounts(this);\n }\n\n /**\n * Get CSRF token from cookies (for SessionAuthentication).\n *\n * Returns null if cookie doesn't exist (JWT-only auth).\n */\n getCsrfToken(): string | null {\n const name = 'csrftoken';\n const value = `; ${document.cookie}`;\n const parts = value.split(`; ${name}=`);\n if (parts.length === 2) {\n return parts.pop()?.split(';').shift() || null;\n }\n return null;\n }\n\n /**\n * Make HTTP request with Django CSRF and session handling.\n * Automatically retries on network errors and 5xx server errors.\n */\n async request<T>(\n method: string,\n path: string,\n options?: {\n params?: Record<string, any>;\n body?: any;\n formData?: FormData;\n headers?: Record<string, string>;\n }\n ): Promise<T> {\n // Wrap request in retry logic if configured\n if (this.retryConfig) {\n return withRetry(() => this._makeRequest<T>(method, path, options), {\n ...this.retryConfig,\n onFailedAttempt: (info) => {\n // Log retry attempts\n if (this.logger) {\n this.logger.warn(\n `Retry attempt ${info.attemptNumber}/${info.retriesLeft + info.attemptNumber} ` +\n `for ${method} ${path}: ${info.error.message}`\n );\n }\n // Call user's onFailedAttempt if provided\n this.retryConfig?.onFailedAttempt?.(info);\n },\n });\n }\n\n // No retry configured, make request directly\n return this._makeRequest<T>(method, path, options);\n }\n\n /**\n * Internal request method (without retry wrapper).\n * Used by request() method with optional retry logic.\n */\n private async _makeRequest<T>(\n method: string,\n path: string,\n options?: {\n params?: Record<string, any>;\n body?: any;\n formData?: FormData;\n headers?: Record<string, string>;\n }\n ): Promise<T> {\n // Build URL - handle both absolute and relative paths\n // When baseUrl is empty (static builds), path is used as-is (relative to current origin)\n const url = this.baseUrl ? `${this.baseUrl}${path}` : path;\n const startTime = Date.now();\n\n // Build headers - start with custom headers from options\n const headers: Record<string, string> = {\n ...(options?.headers || {})\n };\n\n // Don't set Content-Type for FormData (browser will set it with boundary)\n if (!options?.formData && !headers['Content-Type']) {\n headers['Content-Type'] = 'application/json';\n }\n\n // CSRF not needed - SessionAuthentication not enabled in DRF config\n // Your API uses JWT/Token authentication (no CSRF required)\n\n // Log request\n if (this.logger) {\n this.logger.logRequest({\n method,\n url: url,\n headers,\n body: options?.formData || options?.body,\n timestamp: startTime,\n });\n }\n\n try {\n // Make request via HTTP adapter\n const response = await this.httpClient.request<T>({\n method,\n url: url,\n headers,\n params: options?.params,\n body: options?.body,\n formData: options?.formData,\n });\n\n const duration = Date.now() - startTime;\n\n // Check for HTTP errors\n if (response.status >= 400) {\n const error = new APIError(\n response.status,\n response.statusText,\n response.data,\n url\n );\n\n // Log error\n if (this.logger) {\n this.logger.logError(\n {\n method,\n url: url,\n headers,\n body: options?.formData || options?.body,\n timestamp: startTime,\n },\n {\n message: error.message,\n statusCode: response.status,\n duration,\n timestamp: Date.now(),\n }\n );\n }\n\n throw error;\n }\n\n // Log successful response\n if (this.logger) {\n this.logger.logResponse(\n {\n method,\n url: url,\n headers,\n body: options?.formData || options?.body,\n timestamp: startTime,\n },\n {\n status: response.status,\n statusText: response.statusText,\n data: response.data,\n duration,\n timestamp: Date.now(),\n }\n );\n }\n\n return response.data as T;\n } catch (error) {\n const duration = Date.now() - startTime;\n\n // Re-throw APIError as-is\n if (error instanceof APIError) {\n throw error;\n }\n\n // Detect CORS errors and dispatch event\n const isCORSError = error instanceof TypeError &&\n (error.message.toLowerCase().includes('cors') ||\n error.message.toLowerCase().includes('failed to fetch') ||\n error.message.toLowerCase().includes('network request failed'));\n\n // Log specific error type first\n if (this.logger) {\n if (isCORSError) {\n this.logger.error(`🚫 CORS Error: ${method} ${url}`);\n this.logger.error(` → ${error instanceof Error ? error.message : String(error)}`);\n this.logger.error(` → Configure security_domains parameter on the server`);\n } else {\n this.logger.error(`⚠️ Network Error: ${method} ${url}`);\n this.logger.error(` → ${error instanceof Error ? error.message : String(error)}`);\n }\n }\n\n // Dispatch browser events\n if (typeof window !== 'undefined') {\n try {\n if (isCORSError) {\n // Dispatch CORS-specific error event\n window.dispatchEvent(new CustomEvent('cors-error', {\n detail: {\n url: url,\n method: method,\n error: error instanceof Error ? error.message : String(error),\n timestamp: new Date(),\n },\n bubbles: true,\n cancelable: false,\n }));\n } else {\n // Dispatch generic network error event\n window.dispatchEvent(new CustomEvent('network-error', {\n detail: {\n url: url,\n method: method,\n error: error instanceof Error ? error.message : String(error),\n timestamp: new Date(),\n },\n bubbles: true,\n cancelable: false,\n }));\n }\n } catch (eventError) {\n // Silently fail - event dispatch should never crash the app\n }\n }\n\n // Wrap other errors as NetworkError\n const networkError = error instanceof Error\n ? new NetworkError(error.message, url, error)\n : new NetworkError('Unknown error', url);\n\n // Detailed logging via logger.logError\n if (this.logger) {\n this.logger.logError(\n {\n method,\n url: url,\n headers,\n body: options?.formData || options?.body,\n timestamp: startTime,\n },\n {\n message: networkError.message,\n duration,\n timestamp: Date.now(),\n }\n );\n }\n\n throw networkError;\n }\n }\n}\n","// Auto-generated by DjangoCFG - see CLAUDE.md\n/**\n * Storage adapters for cross-platform token storage.\n *\n * Supports:\n * - LocalStorage (browser)\n * - Cookies (SSR/browser)\n * - Memory (Node.js/Electron/testing)\n */\n\nimport type { APILogger } from './logger';\n\n/**\n * Storage adapter interface for cross-platform token storage.\n */\nexport interface StorageAdapter {\n getItem(key: string): string | null;\n setItem(key: string, value: string): void;\n removeItem(key: string): void;\n}\n\n/**\n * LocalStorage adapter with safe try-catch for browser environments.\n * Works in modern browsers with localStorage support.\n * \n * Note: This adapter uses window.localStorage and should only be used in browser/client environments.\n * For server-side usage, use MemoryStorageAdapter or CookieStorageAdapter instead.\n */\nexport class LocalStorageAdapter implements StorageAdapter {\n private logger?: APILogger;\n\n constructor(logger?: APILogger) {\n this.logger = logger;\n }\n\n getItem(key: string): string | null {\n try {\n if (typeof window !== 'undefined' && window.localStorage) {\n const value = localStorage.getItem(key);\n this.logger?.debug(`LocalStorage.getItem(\"${key}\"): ${value ? 'found' : 'not found'}`);\n return value;\n }\n this.logger?.warn('LocalStorage not available: window.localStorage is undefined');\n } catch (error) {\n this.logger?.error('LocalStorage.getItem failed:', error);\n }\n return null;\n }\n\n setItem(key: string, value: string): void {\n try {\n if (typeof window !== 'undefined' && window.localStorage) {\n localStorage.setItem(key, value);\n this.logger?.debug(`LocalStorage.setItem(\"${key}\"): success`);\n } else {\n this.logger?.warn('LocalStorage not available: window.localStorage is undefined');\n }\n } catch (error) {\n this.logger?.error('LocalStorage.setItem failed:', error);\n }\n }\n\n removeItem(key: string): void {\n try {\n if (typeof window !== 'undefined' && window.localStorage) {\n localStorage.removeItem(key);\n this.logger?.debug(`LocalStorage.removeItem(\"${key}\"): success`);\n } else {\n this.logger?.warn('LocalStorage not available: window.localStorage is undefined');\n }\n } catch (error) {\n this.logger?.error('LocalStorage.removeItem failed:', error);\n }\n }\n}\n\n/**\n * Cookie-based storage adapter for SSR and browser environments.\n * Useful for Next.js, Nuxt.js, and other SSR frameworks.\n */\nexport class CookieStorageAdapter implements StorageAdapter {\n private logger?: APILogger;\n\n constructor(logger?: APILogger) {\n this.logger = logger;\n }\n\n getItem(key: string): string | null {\n try {\n if (typeof document === 'undefined') {\n this.logger?.warn('Cookies not available: document is undefined (SSR context?)');\n return null;\n }\n const value = `; ${document.cookie}`;\n const parts = value.split(`; ${key}=`);\n if (parts.length === 2) {\n const result = parts.pop()?.split(';').shift() || null;\n this.logger?.debug(`CookieStorage.getItem(\"${key}\"): ${result ? 'found' : 'not found'}`);\n return result;\n }\n this.logger?.debug(`CookieStorage.getItem(\"${key}\"): not found`);\n } catch (error) {\n this.logger?.error('CookieStorage.getItem failed:', error);\n }\n return null;\n }\n\n setItem(key: string, value: string): void {\n try {\n if (typeof document !== 'undefined') {\n document.cookie = `${key}=${value}; path=/; max-age=31536000`;\n this.logger?.debug(`CookieStorage.setItem(\"${key}\"): success`);\n } else {\n this.logger?.warn('Cookies not available: document is undefined (SSR context?)');\n }\n } catch (error) {\n this.logger?.error('CookieStorage.setItem failed:', error);\n }\n }\n\n removeItem(key: string): void {\n try {\n if (typeof document !== 'undefined') {\n document.cookie = `${key}=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT`;\n this.logger?.debug(`CookieStorage.removeItem(\"${key}\"): success`);\n } else {\n this.logger?.warn('Cookies not available: document is undefined (SSR context?)');\n }\n } catch (error) {\n this.logger?.error('CookieStorage.removeItem failed:', error);\n }\n }\n}\n\n/**\n * In-memory storage adapter for Node.js, Electron, and testing environments.\n * Data is stored in RAM and cleared when process exits.\n */\nexport class MemoryStorageAdapter implements StorageAdapter {\n private storage: Map<string, string> = new Map();\n private logger?: APILogger;\n\n constructor(logger?: APILogger) {\n this.logger = logger;\n }\n\n getItem(key: string): string | null {\n const value = this.storage.get(key) || null;\n this.logger?.debug(`MemoryStorage.getItem(\"${key}\"): ${value ? 'found' : 'not found'}`);\n return value;\n }\n\n setItem(key: string, value: string): void {\n this.storage.set(key, value);\n this.logger?.debug(`MemoryStorage.setItem(\"${key}\"): success`);\n }\n\n removeItem(key: string): void {\n this.storage.delete(key);\n this.logger?.debug(`MemoryStorage.removeItem(\"${key}\"): success`);\n }\n}","// Auto-generated by DjangoCFG - see CLAUDE.md\n/**\n * OAuth provider name (github, google, etc.)\n * * `github` - GitHub\n */\nexport enum OAuthConnectionProvider {\n GITHUB = \"github\",\n}\n\n/**\n * OAuth provider to disconnect\n * * `github` - GitHub\n */\nexport enum OAuthDisconnectRequestRequestProvider {\n GITHUB = \"github\",\n}\n\n/**\n * Delivery channel: 'email' or 'phone'. Auto-detected if not provided.\n * * `email` - Email\n * * `phone` - Phone\n */\nexport enum OTPRequestRequestChannel {\n EMAIL = \"email\",\n PHONE = \"phone\",\n}\n\n/**\n * Delivery channel: 'email' or 'phone'. Auto-detected if not provided.\n * * `email` - Email\n * * `phone` - Phone\n */\nexport enum OTPVerifyRequestChannel {\n EMAIL = \"email\",\n PHONE = \"phone\",\n}\n\n","/**\n * Zod schema for CentrifugoToken\n *\n * This schema provides runtime validation and type inference.\n * * Nested serializer for Centrifugo WebSocket connection token.\n * */\nimport { z } from 'zod'\n\n/**\n * Nested serializer for Centrifugo WebSocket connection token.\n */\nexport const CentrifugoTokenSchema = z.object({\n token: z.string(),\n centrifugo_url: z.union([z.url(), z.literal('')]),\n expires_at: z.iso.datetime(),\n channels: z.array(z.string()),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type CentrifugoToken = z.infer<typeof CentrifugoTokenSchema>","/**\n * Zod schema for OAuthAuthorizeRequestRequest\n *\n * This schema provides runtime validation and type inference.\n * * Request to start OAuth flow.\n * */\nimport { z } from 'zod'\n\n/**\n * Request to start OAuth flow.\n */\nexport const OAuthAuthorizeRequestRequestSchema = z.object({\n redirect_uri: z.union([z.url(), z.literal('')]).optional(),\n source_url: z.union([z.url(), z.literal('')]).optional(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type OAuthAuthorizeRequestRequest = z.infer<typeof OAuthAuthorizeRequestRequestSchema>","/**\n * Zod schema for OAuthAuthorizeResponse\n *\n * This schema provides runtime validation and type inference.\n * * Response with OAuth authorization URL.\n * */\nimport { z } from 'zod'\n\n/**\n * Response with OAuth authorization URL.\n */\nexport const OAuthAuthorizeResponseSchema = z.object({\n authorization_url: z.union([z.url(), z.literal('')]),\n state: z.string(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type OAuthAuthorizeResponse = z.infer<typeof OAuthAuthorizeResponseSchema>","/**\n * Zod schema for OAuthCallbackRequestRequest\n *\n * This schema provides runtime validation and type inference.\n * * Request to complete OAuth flow (callback handler).\n * */\nimport { z } from 'zod'\n\n/**\n * Request to complete OAuth flow (callback handler).\n */\nexport const OAuthCallbackRequestRequestSchema = z.object({\n code: z.string().min(10).max(500),\n state: z.string().min(20).max(100),\n redirect_uri: z.union([z.url(), z.literal('')]).optional(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type OAuthCallbackRequestRequest = z.infer<typeof OAuthCallbackRequestRequestSchema>","/**\n * Zod schema for OAuthConnection\n *\n * This schema provides runtime validation and type inference.\n * * Serializer for OAuth connection info (user-facing).\n * */\nimport { z } from 'zod'\nimport * as Enums from '../../enums'\n\n/**\n * Serializer for OAuth connection info (user-facing).\n */\nexport const OAuthConnectionSchema = z.object({\n id: z.int(),\n provider: z.nativeEnum(Enums.OAuthConnectionProvider),\n provider_display: z.string(),\n provider_username: z.string(),\n provider_email: z.email(),\n provider_avatar_url: z.union([z.url(), z.literal('')]),\n connected_at: z.iso.datetime(),\n last_login_at: z.iso.datetime(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type OAuthConnection = z.infer<typeof OAuthConnectionSchema>","/**\n * Zod schema for OAuthDisconnectRequestRequest\n *\n * This schema provides runtime validation and type inference.\n * * Request to disconnect OAuth provider.\n * */\nimport { z } from 'zod'\nimport * as Enums from '../../enums'\n\n/**\n * Request to disconnect OAuth provider.\n */\nexport const OAuthDisconnectRequestRequestSchema = z.object({\n provider: z.nativeEnum(Enums.OAuthDisconnectRequestRequestProvider),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type OAuthDisconnectRequestRequest = z.infer<typeof OAuthDisconnectRequestRequestSchema>","/**\n * Zod schema for OAuthError\n *\n * This schema provides runtime validation and type inference.\n * * Error response for OAuth endpoints.\n * */\nimport { z } from 'zod'\n\n/**\n * Error response for OAuth endpoints.\n */\nexport const OAuthErrorSchema = z.object({\n error: z.string(),\n error_description: z.string().optional(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type OAuthError = z.infer<typeof OAuthErrorSchema>","/**\n * Zod schema for OAuthProvidersResponse\n *\n * This schema provides runtime validation and type inference.\n * * Response with available OAuth providers.\n * */\nimport { z } from 'zod'\n\n/**\n * Response with available OAuth providers.\n */\nexport const OAuthProvidersResponseSchema = z.object({\n providers: z.array(z.record(z.string(), z.any())),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type OAuthProvidersResponse = z.infer<typeof OAuthProvidersResponseSchema>","/**\n * Zod schema for OAuthTokenResponse\n *\n * This schema provides runtime validation and type inference.\n * * Response with JWT tokens after OAuth authentication.\n * */\nimport { z } from 'zod'\n\n/**\n * Response with JWT tokens after OAuth authentication.\n */\nexport const OAuthTokenResponseSchema = z.object({\n access: z.string(),\n refresh: z.string(),\n user: z.record(z.string(), z.any()),\n is_new_user: z.boolean(),\n is_new_connection: z.boolean(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type OAuthTokenResponse = z.infer<typeof OAuthTokenResponseSchema>","/**\n * Zod schema for OTPErrorResponse\n *\n * This schema provides runtime validation and type inference.\n * * Error response for OTP operations.\n * */\nimport { z } from 'zod'\n\n/**\n * Error response for OTP operations.\n */\nexport const OTPErrorResponseSchema = z.object({\n error: z.string(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type OTPErrorResponse = z.infer<typeof OTPErrorResponseSchema>","/**\n * Zod schema for OTPRequestRequest\n *\n * This schema provides runtime validation and type inference.\n * * Serializer for OTP request.\n * */\nimport { z } from 'zod'\nimport * as Enums from '../../enums'\n\n/**\n * Serializer for OTP request.\n */\nexport const OTPRequestRequestSchema = z.object({\n identifier: z.string().min(1),\n channel: z.nativeEnum(Enums.OTPRequestRequestChannel).optional(),\n source_url: z.union([z.url(), z.literal('')]).optional(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type OTPRequestRequest = z.infer<typeof OTPRequestRequestSchema>","/**\n * Zod schema for OTPRequestResponse\n *\n * This schema provides runtime validation and type inference.\n * * OTP request response.\n * */\nimport { z } from 'zod'\n\n/**\n * OTP request response.\n */\nexport const OTPRequestResponseSchema = z.object({\n message: z.string(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type OTPRequestResponse = z.infer<typeof OTPRequestResponseSchema>","/**\n * Zod schema for OTPVerifyRequest\n *\n * This schema provides runtime validation and type inference.\n * * Serializer for OTP verification.\n * */\nimport { z } from 'zod'\nimport * as Enums from '../../enums'\n\n/**\n * Serializer for OTP verification.\n */\nexport const OTPVerifyRequestSchema = z.object({\n identifier: z.string().min(1),\n otp: z.string().min(6).max(6),\n channel: z.nativeEnum(Enums.OTPVerifyRequestChannel).optional(),\n source_url: z.union([z.url(), z.literal('')]).optional(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type OTPVerifyRequest = z.infer<typeof OTPVerifyRequestSchema>","/**\n * Zod schema for OTPVerifyResponse\n *\n * This schema provides runtime validation and type inference.\n * * OTP verification response.\n * */\nimport { z } from 'zod'\nimport { UserSchema } from './User.schema'\n\n/**\n * OTP verification response.\n */\nexport const OTPVerifyResponseSchema = z.object({\n refresh: z.string(),\n access: z.string(),\n user: UserSchema,\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type OTPVerifyResponse = z.infer<typeof OTPVerifyResponseSchema>","/**\n * Zod schema for User\n *\n * This schema provides runtime validation and type inference.\n * * Serializer for user details.\n * */\nimport { z } from 'zod'\nimport { CentrifugoTokenSchema } from './CentrifugoToken.schema'\n\n/**\n * Serializer for user details.\n */\nexport const UserSchema = z.object({\n id: z.int(),\n email: z.email(),\n first_name: z.string().max(50).optional(),\n last_name: z.string().max(50).optional(),\n full_name: z.string(),\n initials: z.string(),\n display_username: z.string(),\n company: z.string().max(100).optional(),\n phone: z.string().max(20).optional(),\n position: z.string().max(100).optional(),\n avatar: z.union([z.url(), z.literal('')]).nullable(),\n is_staff: z.boolean(),\n is_superuser: z.boolean(),\n date_joined: z.iso.datetime(),\n last_login: z.iso.datetime().nullable(),\n unanswered_messages_count: z.int(),\n centrifugo: CentrifugoTokenSchema.nullable(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type User = z.infer<typeof UserSchema>","/**\n * Zod schema for PatchedUserProfileUpdateRequest\n *\n * This schema provides runtime validation and type inference.\n * * Serializer for updating user profile.\n * */\nimport { z } from 'zod'\n\n/**\n * Serializer for updating user profile.\n */\nexport const PatchedUserProfileUpdateRequestSchema = z.object({\n first_name: z.string().max(50).optional(),\n last_name: z.string().max(50).optional(),\n company: z.string().max(100).optional(),\n phone: z.string().max(20).optional(),\n position: z.string().max(100).optional(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type PatchedUserProfileUpdateRequest = z.infer<typeof PatchedUserProfileUpdateRequestSchema>","/**\n * Zod schema for TokenRefresh\n *\n * This schema provides runtime validation and type inference.\n * */\nimport { z } from 'zod'\n\nexport const TokenRefreshSchema = z.object({\n access: z.string(),\n refresh: z.string(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type TokenRefresh = z.infer<typeof TokenRefreshSchema>","/**\n * Zod schema for TokenRefreshRequest\n *\n * This schema provides runtime validation and type inference.\n * */\nimport { z } from 'zod'\n\nexport const TokenRefreshRequestSchema = z.object({\n refresh: z.string().min(1),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type TokenRefreshRequest = z.infer<typeof TokenRefreshRequestSchema>","/**\n * Zod schema for UserProfileUpdateRequest\n *\n * This schema provides runtime validation and type inference.\n * * Serializer for updating user profile.\n * */\nimport { z } from 'zod'\n\n/**\n * Serializer for updating user profile.\n */\nexport const UserProfileUpdateRequestSchema = z.object({\n first_name: z.string().max(50).optional(),\n last_name: z.string().max(50).optional(),\n company: z.string().max(100).optional(),\n phone: z.string().max(20).optional(),\n position: z.string().max(100).optional(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type UserProfileUpdateRequest = z.infer<typeof UserProfileUpdateRequestSchema>","// Auto-generated by DjangoCFG - see CLAUDE.md\n/**\n * Typed fetchers for Accounts\n *\n * Universal functions that work in any environment:\n * - Next.js (App Router / Pages Router / Server Components)\n * - React Native\n * - Node.js backend\n *\n * These fetchers use Zod schemas for runtime validation.\n *\n * Usage:\n * ```typescript\n * // Configure API once (in your app entry point)\n * import { configureAPI } from '../../api-instance'\n * configureAPI({ baseUrl: 'https://api.example.com' })\n *\n * // Then use fetchers anywhere\n * const users = await getUsers({ page: 1 })\n *\n * // With SWR\n * const { data } = useSWR(['users', params], () => getUsers(params))\n *\n * // With React Query\n * const { data } = useQuery(['users', params], () => getUsers(params))\n *\n * // In Server Component or SSR (pass custom client)\n * import { API } from '../../index'\n * const api = new API('https://api.example.com')\n * const users = await getUsers({ page: 1 }, api)\n * ```\n */\nimport { consola } from 'consola'\nimport { OTPRequestRequestSchema, type OTPRequestRequest } from '../schemas/OTPRequestRequest.schema'\nimport { OTPRequestResponseSchema, type OTPRequestResponse } from '../schemas/OTPRequestResponse.schema'\nimport { OTPVerifyRequestSchema, type OTPVerifyRequest } from '../schemas/OTPVerifyRequest.schema'\nimport { OTPVerifyResponseSchema, type OTPVerifyResponse } from '../schemas/OTPVerifyResponse.schema'\nimport { getAPIInstance } from '../../api-instance'\n\n/**\n * API operation\n *\n * @method POST\n * @path /cfg/accounts/otp/request/\n */\nexport async function createAccountsOtpRequestCreate( data: OTPRequestRequest, client?: any\n): Promise<OTPRequestResponse> {\n const api = client || getAPIInstance()\n const response = await api.accounts.otpRequestCreate(data)\n try {\n return OTPRequestResponseSchema.parse(response)\n } catch (error) {\n // Zod validation error - log detailed information\n consola.error('❌ Zod Validation Failed');\n consola.box(`createAccountsOtpRequestCreate\\nPath: /cfg/accounts/otp/request/\\nMethod: POST`);\n\n if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {\n consola.error('Validation Issues:');\n (error as any).issues.forEach((issue: any, index: number) => {\n consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);\n consola.error(` ├─ Message: ${issue.message}`);\n if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);\n if (issue.received) consola.error(` └─ Received: ${issue.received}`);\n });\n }\n\n consola.error('Response data:', response);\n\n // Dispatch browser CustomEvent (only if window is defined)\n if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {\n try {\n const event = new CustomEvent('zod-validation-error', {\n detail: {\n operation: 'createAccountsOtpRequestCreate',\n path: '/cfg/accounts/otp/request/',\n method: 'POST',\n error: error,\n response: response,\n timestamp: new Date(),\n },\n bubbles: true,\n cancelable: false,\n });\n window.dispatchEvent(event);\n } catch (eventError) {\n // Silently fail - event dispatch should never crash the app\n consola.warn('Failed to dispatch validation error event:', eventError);\n }\n }\n\n // Re-throw the error\n throw error;\n }\n}\n\n\n/**\n * API operation\n *\n * @method POST\n * @path /cfg/accounts/otp/verify/\n */\nexport async function createAccountsOtpVerifyCreate( data: OTPVerifyRequest, client?: any\n): Promise<OTPVerifyResponse> {\n const api = client || getAPIInstance()\n const response = await api.accounts.otpVerifyCreate(data)\n try {\n return OTPVerifyResponseSchema.parse(response)\n } catch (error) {\n // Zod validation error - log detailed information\n consola.error('❌ Zod Validation Failed');\n consola.box(`createAccountsOtpVerifyCreate\\nPath: /cfg/accounts/otp/verify/\\nMethod: POST`);\n\n if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {\n consola.error('Validation Issues:');\n (error as any).issues.forEach((issue: any, index: number) => {\n consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);\n consola.error(` ├─ Message: ${issue.message}`);\n if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);\n if (issue.received) consola.error(` └─ Received: ${issue.received}`);\n });\n }\n\n consola.error('Response data:', response);\n\n // Dispatch browser CustomEvent (only if window is defined)\n if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {\n try {\n const event = new CustomEvent('zod-validation-error', {\n detail: {\n operation: 'createAccountsOtpVerifyCreate',\n path: '/cfg/accounts/otp/verify/',\n method: 'POST',\n error: error,\n response: response,\n timestamp: new Date(),\n },\n bubbles: true,\n cancelable: false,\n });\n window.dispatchEvent(event);\n } catch (eventError) {\n // Silently fail - event dispatch should never crash the app\n consola.warn('Failed to dispatch validation error event:', eventError);\n }\n }\n\n // Re-throw the error\n throw error;\n }\n}\n\n\n","// Auto-generated by DjangoCFG - see CLAUDE.md\n/**\n * Global API Instance - Singleton configuration with auto-configuration support\n *\n * This module provides a global API instance that auto-configures from\n * environment variables or can be configured manually.\n *\n * AUTO-CONFIGURATION (recommended):\n * Set one of these environment variables and the API will auto-configure:\n * - NEXT_PUBLIC_API_URL (Next.js)\n * - VITE_API_URL (Vite)\n * - REACT_APP_API_URL (Create React App)\n * - API_URL (generic)\n *\n * Then just use fetchers and hooks directly:\n * ```typescript\n * import { getUsers } from './_utils/fetchers'\n * const users = await getUsers({ page: 1 })\n * ```\n *\n * MANUAL CONFIGURATION:\n * ```typescript\n * import { configureAPI } from './api-instance'\n *\n * configureAPI({\n * baseUrl: 'https://api.example.com',\n * token: 'your-jwt-token'\n * })\n * ```\n *\n * For SSR or multiple instances:\n * ```typescript\n * import { API } from './index'\n * import { getUsers } from './_utils/fetchers'\n *\n * const api = new API('https://api.example.com')\n * const users = await getUsers({ page: 1 }, api)\n * ```\n */\n\nimport { API, type APIOptions } from './index'\n\nlet globalAPI: API | null = null\nlet autoConfigAttempted = false\n\n/**\n * Auto-configure from environment variable if available (Next.js pattern)\n * This allows hooks and fetchers to work without explicit configureAPI() call\n *\n * Supported environment variables:\n * - NEXT_PUBLIC_API_URL (Next.js)\n * - VITE_API_URL (Vite)\n * - REACT_APP_API_URL (Create React App)\n * - API_URL (generic)\n */\nfunction tryAutoConfigureFromEnv(): void {\n // Only attempt once\n if (autoConfigAttempted) return\n autoConfigAttempted = true\n\n // Skip if already configured\n if (globalAPI) return\n\n // Skip if process is not available (pure browser without bundler)\n if (typeof process === 'undefined' || !process.env) return\n\n // Try different environment variable patterns\n const baseUrl =\n process.env.NEXT_PUBLIC_API_URL ||\n process.env.VITE_API_URL ||\n process.env.REACT_APP_API_URL ||\n process.env.API_URL\n\n if (baseUrl) {\n globalAPI = new API(baseUrl)\n }\n}\n\n/**\n * Get the global API instance\n * Auto-configures from environment variables on first call if not manually configured.\n * @throws Error if API is not configured and no env variable is set\n */\nexport function getAPIInstance(): API {\n // Try auto-configuration on first access (lazy initialization)\n tryAutoConfigureFromEnv()\n\n if (!globalAPI) {\n throw new Error(\n 'API not configured. Call configureAPI() with your base URL before using fetchers or hooks.\\n\\n' +\n 'Example:\\n' +\n ' import { configureAPI } from \"./api-instance\"\\n' +\n ' configureAPI({ baseUrl: \"https://api.example.com\" })\\n\\n' +\n 'Or set environment variable: NEXT_PUBLIC_API_URL, VITE_API_URL, or REACT_APP_API_URL'\n )\n }\n return globalAPI\n}\n\n/**\n * Check if API is configured (or can be auto-configured)\n */\nexport function isAPIConfigured(): boolean {\n tryAutoConfigureFromEnv()\n return globalAPI !== null\n}\n\n/**\n * Configure the global API instance\n *\n * @param baseUrl - Base URL for the API\n * @param options - Optional configuration (storage, retry, logger)\n *\n * @example\n * ```typescript\n * configureAPI({\n * baseUrl: 'https://api.example.com',\n * token: 'jwt-token',\n * options: {\n * retryConfig: { maxRetries: 3 },\n * loggerConfig: { enabled: true }\n * }\n * })\n * ```\n */\nexport function configureAPI(config: {\n baseUrl: string\n token?: string\n refreshToken?: string\n options?: APIOptions\n}): API {\n globalAPI = new API(config.baseUrl, config.options)\n\n if (config.token) {\n globalAPI.setToken(config.token, config.refreshToken)\n }\n\n return globalAPI\n}\n\n/**\n * Reconfigure the global API instance with new settings\n * Useful for updating tokens or base URL\n */\nexport function reconfigureAPI(updates: {\n baseUrl?: string\n token?: string\n refreshToken?: string\n}): API {\n const instance = getAPIInstance()\n\n if (updates.baseUrl) {\n instance.setBaseUrl(updates.baseUrl)\n }\n\n if (updates.token) {\n instance.setToken(updates.token, updates.refreshToken)\n }\n\n return instance\n}\n\n/**\n * Clear tokens from the global API instance\n */\nexport function clearAPITokens(): void {\n const instance = getAPIInstance()\n instance.clearTokens()\n}\n\n/**\n * Reset the global API instance\n * Useful for testing or logout scenarios\n */\nexport function resetAPI(): void {\n if (globalAPI) {\n globalAPI.clearTokens()\n }\n globalAPI = null\n}","// Auto-generated by DjangoCFG - see CLAUDE.md\n/**\n * Typed fetchers for Auth\n *\n * Universal functions that work in any environment:\n * - Next.js (App Router / Pages Router / Server Components)\n * - React Native\n * - Node.js backend\n *\n * These fetchers use Zod schemas for runtime validation.\n *\n * Usage:\n * ```typescript\n * // Configure API once (in your app entry point)\n * import { configureAPI } from '../../api-instance'\n * configureAPI({ baseUrl: 'https://api.example.com' })\n *\n * // Then use fetchers anywhere\n * const users = await getUsers({ page: 1 })\n *\n * // With SWR\n * const { data } = useSWR(['users', params], () => getUsers(params))\n *\n * // With React Query\n * const { data } = useQuery(['users', params], () => getUsers(params))\n *\n * // In Server Component or SSR (pass custom client)\n * import { API } from '../../index'\n * const api = new API('https://api.example.com')\n * const users = await getUsers({ page: 1 }, api)\n * ```\n */\nimport { consola } from 'consola'\nimport { TokenRefreshSchema, type TokenRefresh } from '../schemas/TokenRefresh.schema'\nimport { TokenRefreshRequestSchema, type TokenRefreshRequest } from '../schemas/TokenRefreshRequest.schema'\nimport { getAPIInstance } from '../../api-instance'\n\n/**\n * API operation\n *\n * @method POST\n * @path /cfg/accounts/token/refresh/\n */\nexport async function createAccountsTokenRefreshCreate( data: TokenRefreshRequest, client?: any\n): Promise<TokenRefresh> {\n const api = client || getAPIInstance()\n const response = await api.auth.accountsTokenRefreshCreate(data)\n try {\n return TokenRefreshSchema.parse(response)\n } catch (error) {\n // Zod validation error - log detailed information\n consola.error('❌ Zod Validation Failed');\n consola.box(`createAccountsTokenRefreshCreate\\nPath: /cfg/accounts/token/refresh/\\nMethod: POST`);\n\n if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {\n consola.error('Validation Issues:');\n (error as any).issues.forEach((issue: any, index: number) => {\n consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);\n consola.error(` ├─ Message: ${issue.message}`);\n if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);\n if (issue.received) consola.error(` └─ Received: ${issue.received}`);\n });\n }\n\n consola.error('Response data:', response);\n\n // Dispatch browser CustomEvent (only if window is defined)\n if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {\n try {\n const event = new CustomEvent('zod-validation-error', {\n detail: {\n operation: 'createAccountsTokenRefreshCreate',\n path: '/cfg/accounts/token/refresh/',\n method: 'POST',\n error: error,\n response: response,\n timestamp: new Date(),\n },\n bubbles: true,\n cancelable: false,\n });\n window.dispatchEvent(event);\n } catch (eventError) {\n // Silently fail - event dispatch should never crash the app\n consola.warn('Failed to dispatch validation error event:', eventError);\n }\n }\n\n // Re-throw the error\n throw error;\n }\n}\n\n\n","// Auto-generated by DjangoCFG - see CLAUDE.md\n/**\n * Typed fetchers for Oauth\n *\n * Universal functions that work in any environment:\n * - Next.js (App Router / Pages Router / Server Components)\n * - React Native\n * - Node.js backend\n *\n * These fetchers use Zod schemas for runtime validation.\n *\n * Usage:\n * ```typescript\n * // Configure API once (in your app entry point)\n * import { configureAPI } from '../../api-instance'\n * configureAPI({ baseUrl: 'https://api.example.com' })\n *\n * // Then use fetchers anywhere\n * const users = await getUsers({ page: 1 })\n *\n * // With SWR\n * const { data } = useSWR(['users', params], () => getUsers(params))\n *\n * // With React Query\n * const { data } = useQuery(['users', params], () => getUsers(params))\n *\n * // In Server Component or SSR (pass custom client)\n * import { API } from '../../index'\n * const api = new API('https://api.example.com')\n * const users = await getUsers({ page: 1 }, api)\n * ```\n */\nimport { consola } from 'consola'\nimport { OAuthAuthorizeRequestRequestSchema, type OAuthAuthorizeRequestRequest } from '../schemas/OAuthAuthorizeRequestRequest.schema'\nimport { OAuthAuthorizeResponseSchema, type OAuthAuthorizeResponse } from '../schemas/OAuthAuthorizeResponse.schema'\nimport { OAuthCallbackRequestRequestSchema, type OAuthCallbackRequestRequest } from '../schemas/OAuthCallbackRequestRequest.schema'\nimport { OAuthDisconnectRequestRequestSchema, type OAuthDisconnectRequestRequest } from '../schemas/OAuthDisconnectRequestRequest.schema'\nimport { OAuthProvidersResponseSchema, type OAuthProvidersResponse } from '../schemas/OAuthProvidersResponse.schema'\nimport { OAuthTokenResponseSchema, type OAuthTokenResponse } from '../schemas/OAuthTokenResponse.schema'\nimport { getAPIInstance } from '../../api-instance'\n\n/**\n * List OAuth connections\n *\n * @method GET\n * @path /cfg/accounts/oauth/connections/\n */\nexport async function getAccountsOauthConnectionsList( client?: any\n): Promise<any> {\n const api = client || getAPIInstance()\n const response = await api.oauth.accountsOauthConnectionsList()\n return response\n}\n\n\n/**\n * Disconnect OAuth provider\n *\n * @method POST\n * @path /cfg/accounts/oauth/disconnect/\n */\nexport async function createAccountsOauthDisconnectCreate( data: OAuthDisconnectRequestRequest, client?: any\n): Promise<any> {\n const api = client || getAPIInstance()\n const response = await api.oauth.accountsOauthDisconnectCreate(data)\n return response\n}\n\n\n/**\n * Start GitHub OAuth\n *\n * @method POST\n * @path /cfg/accounts/oauth/github/authorize/\n */\nexport async function createAccountsOauthGithubAuthorizeCreate( data: OAuthAuthorizeRequestRequest, client?: any\n): Promise<OAuthAuthorizeResponse> {\n const api = client || getAPIInstance()\n const response = await api.oauth.accountsOauthGithubAuthorizeCreate(data)\n try {\n return OAuthAuthorizeResponseSchema.parse(response)\n } catch (error) {\n // Zod validation error - log detailed information\n consola.error('❌ Zod Validation Failed');\n consola.box(`createAccountsOauthGithubAuthorizeCreate\\nPath: /cfg/accounts/oauth/github/authorize/\\nMethod: POST`);\n\n if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {\n consola.error('Validation Issues:');\n (error as any).issues.forEach((issue: any, index: number) => {\n consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);\n consola.error(` ├─ Message: ${issue.message}`);\n if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);\n if (issue.received) consola.error(` └─ Received: ${issue.received}`);\n });\n }\n\n consola.error('Response data:', response);\n\n // Dispatch browser CustomEvent (only if window is defined)\n if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {\n try {\n const event = new CustomEvent('zod-validation-error', {\n detail: {\n operation: 'createAccountsOauthGithubAuthorizeCreate',\n path: '/cfg/accounts/oauth/github/authorize/',\n method: 'POST',\n error: error,\n response: response,\n timestamp: new Date(),\n },\n bubbles: true,\n cancelable: false,\n });\n window.dispatchEvent(event);\n } catch (eventError) {\n // Silently fail - event dispatch should never crash the app\n consola.warn('Failed to dispatch validation error event:', eventError);\n }\n }\n\n // Re-throw the error\n throw error;\n }\n}\n\n\n/**\n * Complete GitHub OAuth\n *\n * @method POST\n * @path /cfg/accounts/oauth/github/callback/\n */\nexport async function createAccountsOauthGithubCallbackCreate( data: OAuthCallbackRequestRequest, client?: any\n): Promise<OAuthTokenResponse> {\n const api = client || getAPIInstance()\n const response = await api.oauth.accountsOauthGithubCallbackCreate(data)\n try {\n return OAuthTokenResponseSchema.parse(response)\n } catch (error) {\n // Zod validation error - log detailed information\n consola.error('❌ Zod Validation Failed');\n consola.box(`createAccountsOauthGithubCallbackCreate\\nPath: /cfg/accounts/oauth/github/callback/\\nMethod: POST`);\n\n if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {\n consola.error('Validation Issues:');\n (error as any).issues.forEach((issue: any, index: number) => {\n consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);\n consola.error(` ├─ Message: ${issue.message}`);\n if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);\n if (issue.received) consola.error(` └─ Received: ${issue.received}`);\n });\n }\n\n consola.error('Response data:', response);\n\n // Dispatch browser CustomEvent (only if window is defined)\n if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {\n try {\n const event = new CustomEvent('zod-validation-error', {\n detail: {\n operation: 'createAccountsOauthGithubCallbackCreate',\n path: '/cfg/accounts/oauth/github/callback/',\n method: 'POST',\n error: error,\n response: response,\n timestamp: new Date(),\n },\n bubbles: true,\n cancelable: false,\n });\n window.dispatchEvent(event);\n } catch (eventError) {\n // Silently fail - event dispatch should never crash the app\n consola.warn('Failed to dispatch validation error event:', eventError);\n }\n }\n\n // Re-throw the error\n throw error;\n }\n}\n\n\n/**\n * List OAuth providers\n *\n * @method GET\n * @path /cfg/accounts/oauth/providers/\n */\nexport async function getAccountsOauthProvidersRetrieve( client?: any\n): Promise<OAuthProvidersResponse> {\n const api = client || getAPIInstance()\n const response = await api.oauth.accountsOauthProvidersRetrieve()\n try {\n return OAuthProvidersResponseSchema.parse(response)\n } catch (error) {\n // Zod validation error - log detailed information\n consola.error('❌ Zod Validation Failed');\n consola.box(`getAccountsOauthProvidersRetrieve\\nPath: /cfg/accounts/oauth/providers/\\nMethod: GET`);\n\n if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {\n consola.error('Validation Issues:');\n (error as any).issues.forEach((issue: any, index: number) => {\n consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);\n consola.error(` ├─ Message: ${issue.message}`);\n if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);\n if (issue.received) consola.error(` └─ Received: ${issue.received}`);\n });\n }\n\n consola.error('Response data:', response);\n\n // Dispatch browser CustomEvent (only if window is defined)\n if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {\n try {\n const event = new CustomEvent('zod-validation-error', {\n detail: {\n operation: 'getAccountsOauthProvidersRetrieve',\n path: '/cfg/accounts/oauth/providers/',\n method: 'GET',\n error: error,\n response: response,\n timestamp: new Date(),\n },\n bubbles: true,\n cancelable: false,\n });\n window.dispatchEvent(event);\n } catch (eventError) {\n // Silently fail - event dispatch should never crash the app\n consola.warn('Failed to dispatch validation error event:', eventError);\n }\n }\n\n // Re-throw the error\n throw error;\n }\n}\n\n\n","// Auto-generated by DjangoCFG - see CLAUDE.md\n/**\n * Typed fetchers for User Profile\n *\n * Universal functions that work in any environment:\n * - Next.js (App Router / Pages Router / Server Components)\n * - React Native\n * - Node.js backend\n *\n * These fetchers use Zod schemas for runtime validation.\n *\n * Usage:\n * ```typescript\n * // Configure API once (in your app entry point)\n * import { configureAPI } from '../../api-instance'\n * configureAPI({ baseUrl: 'https://api.example.com' })\n *\n * // Then use fetchers anywhere\n * const users = await getUsers({ page: 1 })\n *\n * // With SWR\n * const { data } = useSWR(['users', params], () => getUsers(params))\n *\n * // With React Query\n * const { data } = useQuery(['users', params], () => getUsers(params))\n *\n * // In Server Component or SSR (pass custom client)\n * import { API } from '../../index'\n * const api = new API('https://api.example.com')\n * const users = await getUsers({ page: 1 }, api)\n * ```\n */\nimport { consola } from 'consola'\nimport { PatchedUserProfileUpdateRequestSchema, type PatchedUserProfileUpdateRequest } from '../schemas/PatchedUserProfileUpdateRequest.schema'\nimport { UserSchema, type User } from '../schemas/User.schema'\nimport { UserProfileUpdateRequestSchema, type UserProfileUpdateRequest } from '../schemas/UserProfileUpdateRequest.schema'\nimport { getAPIInstance } from '../../api-instance'\n\n/**\n * Get current user profile\n *\n * @method GET\n * @path /cfg/accounts/profile/\n */\nexport async function getAccountsProfileRetrieve( client?: any\n): Promise<User> {\n const api = client || getAPIInstance()\n const response = await api.user_profile.accountsProfileRetrieve()\n try {\n return UserSchema.parse(response)\n } catch (error) {\n // Zod validation error - log detailed information\n consola.error('❌ Zod Validation Failed');\n consola.box(`getAccountsProfileRetrieve\\nPath: /cfg/accounts/profile/\\nMethod: GET`);\n\n if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {\n consola.error('Validation Issues:');\n (error as any).issues.forEach((issue: any, index: number) => {\n consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);\n consola.error(` ├─ Message: ${issue.message}`);\n if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);\n if (issue.received) consola.error(` └─ Received: ${issue.received}`);\n });\n }\n\n consola.error('Response data:', response);\n\n // Dispatch browser CustomEvent (only if window is defined)\n if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {\n try {\n const event = new CustomEvent('zod-validation-error', {\n detail: {\n operation: 'getAccountsProfileRetrieve',\n path: '/cfg/accounts/profile/',\n method: 'GET',\n error: error,\n response: response,\n timestamp: new Date(),\n },\n bubbles: true,\n cancelable: false,\n });\n window.dispatchEvent(event);\n } catch (eventError) {\n // Silently fail - event dispatch should never crash the app\n consola.warn('Failed to dispatch validation error event:', eventError);\n }\n }\n\n // Re-throw the error\n throw error;\n }\n}\n\n\n/**\n * Upload user avatar\n *\n * @method POST\n * @path /cfg/accounts/profile/avatar/\n */\nexport async function createAccountsProfileAvatarCreate( data: any, client?: any\n): Promise<User> {\n const api = client || getAPIInstance()\n const response = await api.user_profile.accountsProfileAvatarCreate(data)\n try {\n return UserSchema.parse(response)\n } catch (error) {\n // Zod validation error - log detailed information\n consola.error('❌ Zod Validation Failed');\n consola.box(`createAccountsProfileAvatarCreate\\nPath: /cfg/accounts/profile/avatar/\\nMethod: POST`);\n\n if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {\n consola.error('Validation Issues:');\n (error as any).issues.forEach((issue: any, index: number) => {\n consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);\n consola.error(` ├─ Message: ${issue.message}`);\n if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);\n if (issue.received) consola.error(` └─ Received: ${issue.received}`);\n });\n }\n\n consola.error('Response data:', response);\n\n // Dispatch browser CustomEvent (only if window is defined)\n if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {\n try {\n const event = new CustomEvent('zod-validation-error', {\n detail: {\n operation: 'createAccountsProfileAvatarCreate',\n path: '/cfg/accounts/profile/avatar/',\n method: 'POST',\n error: error,\n response: response,\n timestamp: new Date(),\n },\n bubbles: true,\n cancelable: false,\n });\n window.dispatchEvent(event);\n } catch (eventError) {\n // Silently fail - event dispatch should never crash the app\n consola.warn('Failed to dispatch validation error event:', eventError);\n }\n }\n\n // Re-throw the error\n throw error;\n }\n}\n\n\n/**\n * Partial update user profile\n *\n * @method PUT\n * @path /cfg/accounts/profile/partial/\n */\nexport async function partialUpdateAccountsProfilePartialUpdate( data: UserProfileUpdateRequest, client?: any\n): Promise<User> {\n const api = client || getAPIInstance()\n const response = await api.user_profile.accountsProfilePartialUpdate(data)\n try {\n return UserSchema.parse(response)\n } catch (error) {\n // Zod validation error - log detailed information\n consola.error('❌ Zod Validation Failed');\n consola.box(`partialUpdateAccountsProfilePartialUpdate\\nPath: /cfg/accounts/profile/partial/\\nMethod: PUT`);\n\n if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {\n consola.error('Validation Issues:');\n (error as any).issues.forEach((issue: any, index: number) => {\n consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);\n consola.error(` ├─ Message: ${issue.message}`);\n if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);\n if (issue.received) consola.error(` └─ Received: ${issue.received}`);\n });\n }\n\n consola.error('Response data:', response);\n\n // Dispatch browser CustomEvent (only if window is defined)\n if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {\n try {\n const event = new CustomEvent('zod-validation-error', {\n detail: {\n operation: 'partialUpdateAccountsProfilePartialUpdate',\n path: '/cfg/accounts/profile/partial/',\n method: 'PUT',\n error: error,\n response: response,\n timestamp: new Date(),\n },\n bubbles: true,\n cancelable: false,\n });\n window.dispatchEvent(event);\n } catch (eventError) {\n // Silently fail - event dispatch should never crash the app\n consola.warn('Failed to dispatch validation error event:', eventError);\n }\n }\n\n // Re-throw the error\n throw error;\n }\n}\n\n\n/**\n * Partial update user profile\n *\n * @method PATCH\n * @path /cfg/accounts/profile/partial/\n */\nexport async function partialUpdateAccountsProfilePartialPartialUpdate( data?: PatchedUserProfileUpdateRequest, client?: any\n): Promise<User> {\n const api = client || getAPIInstance()\n const response = await api.user_profile.accountsProfilePartialPartialUpdate(data)\n try {\n return UserSchema.parse(response)\n } catch (error) {\n // Zod validation error - log detailed information\n consola.error('❌ Zod Validation Failed');\n consola.box(`partialUpdateAccountsProfilePartialPartialUpdate\\nPath: /cfg/accounts/profile/partial/\\nMethod: PATCH`);\n\n if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {\n consola.error('Validation Issues:');\n (error as any).issues.forEach((issue: any, index: number) => {\n consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);\n consola.error(` ├─ Message: ${issue.message}`);\n if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);\n if (issue.received) consola.error(` └─ Received: ${issue.received}`);\n });\n }\n\n consola.error('Response data:', response);\n\n // Dispatch browser CustomEvent (only if window is defined)\n if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {\n try {\n const event = new CustomEvent('zod-validation-error', {\n detail: {\n operation: 'partialUpdateAccountsProfilePartialPartialUpdate',\n path: '/cfg/accounts/profile/partial/',\n method: 'PATCH',\n error: error,\n response: response,\n timestamp: new Date(),\n },\n bubbles: true,\n cancelable: false,\n });\n window.dispatchEvent(event);\n } catch (eventError) {\n // Silently fail - event dispatch should never crash the app\n consola.warn('Failed to dispatch validation error event:', eventError);\n }\n }\n\n // Re-throw the error\n throw error;\n }\n}\n\n\n/**\n * Update user profile\n *\n * @method PUT\n * @path /cfg/accounts/profile/update/\n */\nexport async function updateAccountsProfileUpdateUpdate( data: UserProfileUpdateRequest, client?: any\n): Promise<User> {\n const api = client || getAPIInstance()\n const response = await api.user_profile.accountsProfileUpdateUpdate(data)\n try {\n return UserSchema.parse(response)\n } catch (error) {\n // Zod validation error - log detailed information\n consola.error('❌ Zod Validation Failed');\n consola.box(`updateAccountsProfileUpdateUpdate\\nPath: /cfg/accounts/profile/update/\\nMethod: PUT`);\n\n if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {\n consola.error('Validation Issues:');\n (error as any).issues.forEach((issue: any, index: number) => {\n consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);\n consola.error(` ├─ Message: ${issue.message}`);\n if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);\n if (issue.received) consola.error(` └─ Received: ${issue.received}`);\n });\n }\n\n consola.error('Response data:', response);\n\n // Dispatch browser CustomEvent (only if window is defined)\n if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {\n try {\n const event = new CustomEvent('zod-validation-error', {\n detail: {\n operation: 'updateAccountsProfileUpdateUpdate',\n path: '/cfg/accounts/profile/update/',\n method: 'PUT',\n error: error,\n response: response,\n timestamp: new Date(),\n },\n bubbles: true,\n cancelable: false,\n });\n window.dispatchEvent(event);\n } catch (eventError) {\n // Silently fail - event dispatch should never crash the app\n consola.warn('Failed to dispatch validation error event:', eventError);\n }\n }\n\n // Re-throw the error\n throw error;\n }\n}\n\n\n/**\n * Update user profile\n *\n * @method PATCH\n * @path /cfg/accounts/profile/update/\n */\nexport async function partialUpdateAccountsProfileUpdatePartialUpdate( data?: PatchedUserProfileUpdateRequest, client?: any\n): Promise<User> {\n const api = client || getAPIInstance()\n const response = await api.user_profile.accountsProfileUpdatePartialUpdate(data)\n try {\n return UserSchema.parse(response)\n } catch (error) {\n // Zod validation error - log detailed information\n consola.error('❌ Zod Validation Failed');\n consola.box(`partialUpdateAccountsProfileUpdatePartialUpdate\\nPath: /cfg/accounts/profile/update/\\nMethod: PATCH`);\n\n if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {\n consola.error('Validation Issues:');\n (error as any).issues.forEach((issue: any, index: number) => {\n consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);\n consola.error(` ├─ Message: ${issue.message}`);\n if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);\n if (issue.received) consola.error(` └─ Received: ${issue.received}`);\n });\n }\n\n consola.error('Response data:', response);\n\n // Dispatch browser CustomEvent (only if window is defined)\n if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {\n try {\n const event = new CustomEvent('zod-validation-error', {\n detail: {\n operation: 'partialUpdateAccountsProfileUpdatePartialUpdate',\n path: '/cfg/accounts/profile/update/',\n method: 'PATCH',\n error: error,\n response: response,\n timestamp: new Date(),\n },\n bubbles: true,\n cancelable: false,\n });\n window.dispatchEvent(event);\n } catch (eventError) {\n // Silently fail - event dispatch should never crash the app\n consola.warn('Failed to dispatch validation error event:', eventError);\n }\n }\n\n // Re-throw the error\n throw error;\n }\n}\n\n\n","// Auto-generated by DjangoCFG - see CLAUDE.md\n/**\n * Django CFG API - API Client with JWT Management\n *\n * Usage:\n * ```typescript\n * import { API } from './api';\n *\n * const api = new API('https://api.example.com');\n *\n * // Set JWT token\n * api.setToken('your-jwt-token', 'refresh-token');\n *\n * // Use API\n * const posts = await api.posts.list();\n * const user = await api.users.retrieve(1);\n *\n * // Check authentication\n * if (api.isAuthenticated()) {\n * // ...\n * }\n *\n * // Custom storage with logging (for Electron/Node.js)\n * import { MemoryStorageAdapter, APILogger } from './storage';\n * const logger = new APILogger({ enabled: true, logLevel: 'debug' });\n * const api = new API('https://api.example.com', {\n * storage: new MemoryStorageAdapter(logger),\n * loggerConfig: { enabled: true, logLevel: 'debug' }\n * });\n *\n * // Get OpenAPI schema\n * const schema = api.getSchema();\n * ```\n */\n\nimport { APIClient } from \"./client\";\nimport {\n StorageAdapter,\n LocalStorageAdapter,\n CookieStorageAdapter,\n MemoryStorageAdapter\n} from \"./storage\";\nimport type { RetryConfig } from \"./retry\";\nimport type { LoggerConfig } from \"./logger\";\nimport { APILogger } from \"./logger\";\nimport { Auth } from \"./accounts__auth/client\";\nimport { Oauth } from \"./accounts__oauth/client\";\nimport { UserProfile } from \"./accounts__user_profile/client\";\nimport { Accounts } from \"./accounts/client\";\nexport * as AuthTypes from \"./accounts__auth/models\";\n// Note: Direct exports (export * from) are removed to avoid duplicate type conflicts\n// Use namespace exports like CfgAccountsTypes.User or import from specific modules\nexport * as OauthTypes from \"./accounts__oauth/models\";\n// Note: Direct exports (export * from) are removed to avoid duplicate type conflicts\n// Use namespace exports like CfgAccountsTypes.User or import from specific modules\nexport * as UserProfileTypes from \"./accounts__user_profile/models\";\n// Note: Direct exports (export * from) are removed to avoid duplicate type conflicts\n// Use namespace exports like CfgAccountsTypes.User or import from specific modules\nexport * as AccountsTypes from \"./accounts/models\";\n// Note: Direct exports (export * from) are removed to avoid duplicate type conflicts\n// Use namespace exports like CfgAccountsTypes.User or import from specific modules\nexport * as Enums from \"./enums\";\n\n// Re-export Zod schemas for runtime validation\nexport * as Schemas from \"./_utils/schemas\";\n// Also export all schemas directly for convenience\nexport * from \"./_utils/schemas\";\n\n// Re-export Zod validation events for browser integration\nexport type { ValidationErrorDetail, ValidationErrorEvent } from \"./validation-events\";\nexport { dispatchValidationError, onValidationError, formatZodError } from \"./validation-events\";\n\n// Re-export typed fetchers for universal usage\nexport * as Fetchers from \"./_utils/fetchers\";\nexport * from \"./_utils/fetchers\";\n\n// Re-export API instance configuration functions\nexport {\n configureAPI,\n getAPIInstance,\n reconfigureAPI,\n clearAPITokens,\n resetAPI,\n isAPIConfigured\n} from \"./api-instance\";\n// NOTE: SWR hooks are generated in ./_utils/hooks/ but NOT exported here to keep\n// the main bundle server-safe. Import hooks directly from the hooks directory:\n// import { useUsers } from './_utils/hooks';\n// Or use a separate entry point like '@djangocfg/api/hooks' for client components.\n\n// Re-export core client\nexport { APIClient };\n\n// Re-export storage adapters for convenience\nexport type { StorageAdapter };\nexport { LocalStorageAdapter, CookieStorageAdapter, MemoryStorageAdapter };\n\n// Re-export error classes for convenience\nexport { APIError, NetworkError } from \"./errors\";\n\n// Re-export HTTP adapters for custom implementations\nexport type { HttpClientAdapter, HttpRequest, HttpResponse } from \"./http\";\nexport { FetchAdapter } from \"./http\";\n\n// Re-export logger types and classes\nexport type { LoggerConfig, RequestLog, ResponseLog, ErrorLog } from \"./logger\";\nexport { APILogger } from \"./logger\";\n\n// Re-export retry configuration and utilities\nexport type { RetryConfig, FailedAttemptInfo } from \"./retry\";\nexport { withRetry, shouldRetry, DEFAULT_RETRY_CONFIG } from \"./retry\";\n\nexport const TOKEN_KEY = \"auth_token\";\nexport const REFRESH_TOKEN_KEY = \"refresh_token\";\n\nexport interface APIOptions {\n /** Custom storage adapter (defaults to LocalStorageAdapter) */\n storage?: StorageAdapter;\n /** Retry configuration for failed requests */\n retryConfig?: RetryConfig;\n /** Logger configuration */\n loggerConfig?: Partial<LoggerConfig>;\n}\n\nexport class API {\n private baseUrl: string;\n private _client: APIClient;\n private _token: string | null = null;\n private _refreshToken: string | null = null;\n private storage: StorageAdapter;\n private options?: APIOptions;\n\n // Sub-clients\n public auth!: Auth;\n public oauth!: Oauth;\n public user_profile!: UserProfile;\n public accounts!: Accounts;\n\n constructor(baseUrl: string, options?: APIOptions) {\n this.baseUrl = baseUrl;\n this.options = options;\n\n // Create logger if config provided\n const logger = options?.loggerConfig ? new APILogger(options.loggerConfig) : undefined;\n\n // Initialize storage with logger\n this.storage = options?.storage || new LocalStorageAdapter(logger);\n\n this._loadTokensFromStorage();\n\n // Initialize APIClient\n this._client = new APIClient(this.baseUrl, {\n retryConfig: this.options?.retryConfig,\n loggerConfig: this.options?.loggerConfig,\n });\n\n // Always inject auth header wrapper (reads token dynamically from storage)\n this._injectAuthHeader();\n\n // Initialize sub-clients from APIClient\n this.auth = this._client.auth;\n this.oauth = this._client.oauth;\n this.user_profile = this._client.user_profile;\n this.accounts = this._client.accounts;\n }\n\n private _loadTokensFromStorage(): void {\n this._token = this.storage.getItem(TOKEN_KEY);\n this._refreshToken = this.storage.getItem(REFRESH_TOKEN_KEY);\n }\n\n private _reinitClients(): void {\n this._client = new APIClient(this.baseUrl, {\n retryConfig: this.options?.retryConfig,\n loggerConfig: this.options?.loggerConfig,\n });\n\n // Always inject auth header wrapper (reads token dynamically from storage)\n this._injectAuthHeader();\n\n // Reinitialize sub-clients\n this.auth = this._client.auth;\n this.oauth = this._client.oauth;\n this.user_profile = this._client.user_profile;\n this.accounts = this._client.accounts;\n }\n\n private _injectAuthHeader(): void {\n // Override request method to inject auth header\n const originalRequest = this._client.request.bind(this._client);\n this._client.request = async <T>(\n method: string,\n path: string,\n options?: { params?: Record<string, any>; body?: any; formData?: FormData; headers?: Record<string, string> }\n ): Promise<T> => {\n // Read token from storage dynamically (supports JWT injection after instantiation)\n const token = this.getToken();\n const mergedOptions = {\n ...options,\n headers: {\n ...(options?.headers || {}),\n ...(token ? { 'Authorization': `Bearer ${token}` } : {}),\n },\n };\n\n return originalRequest(method, path, mergedOptions);\n };\n }\n\n /**\n * Get current JWT token\n */\n getToken(): string | null {\n return this.storage.getItem(TOKEN_KEY);\n }\n\n /**\n * Get current refresh token\n */\n getRefreshToken(): string | null {\n return this.storage.getItem(REFRESH_TOKEN_KEY);\n }\n\n /**\n * Set JWT token and refresh token\n * @param token - JWT access token\n * @param refreshToken - JWT refresh token (optional)\n */\n setToken(token: string, refreshToken?: string): void {\n this._token = token;\n this.storage.setItem(TOKEN_KEY, token);\n\n if (refreshToken) {\n this._refreshToken = refreshToken;\n this.storage.setItem(REFRESH_TOKEN_KEY, refreshToken);\n }\n\n // Reinitialize clients with new token\n this._reinitClients();\n }\n\n /**\n * Clear all tokens\n */\n clearTokens(): void {\n this._token = null;\n this._refreshToken = null;\n this.storage.removeItem(TOKEN_KEY);\n this.storage.removeItem(REFRESH_TOKEN_KEY);\n\n // Reinitialize clients without token\n this._reinitClients();\n }\n\n /**\n * Check if user is authenticated\n */\n isAuthenticated(): boolean {\n return !!this.getToken();\n }\n\n /**\n * Update base URL and reinitialize clients\n * @param url - New base URL\n */\n setBaseUrl(url: string): void {\n this.baseUrl = url;\n this._reinitClients();\n }\n\n /**\n * Get current base URL\n */\n getBaseUrl(): string {\n return this.baseUrl;\n }\n\n /**\n * Get OpenAPI schema path\n * @returns Path to the OpenAPI schema JSON file\n *\n * Note: The OpenAPI schema is available in the schema.json file.\n * You can load it dynamically using:\n * ```typescript\n * const schema = await fetch('./schema.json').then(r => r.json());\n * // or using fs in Node.js:\n * // const schema = JSON.parse(fs.readFileSync('./schema.json', 'utf-8'));\n * ```\n */\n getSchemaPath(): string {\n return './schema.json';\n }\n}\n\nexport default API;","import * as Models from \"./models\";\n\n\n/**\n * API endpoints for Centrifugo Admin API.\n */\nexport class CentrifugoAdminApi {\n private client: any;\n\n constructor(client: any) {\n this.client = client;\n }\n\n /**\n * Get connection token for dashboard\n * \n * Returns JWT token and config for WebSocket connection to Centrifugo.\n */\n async centrifugoServerAuthTokenCreate(): Promise<any> {\n const response = await this.client.request('POST', \"/cfg/centrifugo/server/auth/token/\");\n return response;\n }\n\n /**\n * List active channels\n * \n * Returns list of active channels with optional pattern filter.\n */\n async centrifugoServerChannelsCreate(data: Models.CentrifugoChannelsRequestRequest): Promise<Models.CentrifugoChannelsResponse> {\n const response = await this.client.request('POST', \"/cfg/centrifugo/server/channels/\", { body: data });\n return response;\n }\n\n /**\n * Get channel history\n * \n * Returns message history for a channel.\n */\n async centrifugoServerHistoryCreate(data: Models.CentrifugoHistoryRequestRequest): Promise<Models.CentrifugoHistoryResponse> {\n const response = await this.client.request('POST', \"/cfg/centrifugo/server/history/\", { body: data });\n return response;\n }\n\n /**\n * Get Centrifugo server info\n * \n * Returns server information including node count, version, and uptime.\n */\n async centrifugoServerInfoCreate(): Promise<Models.CentrifugoInfoResponse> {\n const response = await this.client.request('POST', \"/cfg/centrifugo/server/info/\");\n return response;\n }\n\n /**\n * Get channel presence\n * \n * Returns list of clients currently subscribed to a channel.\n */\n async centrifugoServerPresenceCreate(data: Models.CentrifugoPresenceRequestRequest): Promise<Models.CentrifugoPresenceResponse> {\n const response = await this.client.request('POST', \"/cfg/centrifugo/server/presence/\", { body: data });\n return response;\n }\n\n /**\n * Get channel presence statistics\n * \n * Returns quick statistics about channel presence (num_clients,\n * num_users).\n */\n async centrifugoServerPresenceStatsCreate(data: Models.CentrifugoPresenceStatsRequestRequest): Promise<Models.CentrifugoPresenceStatsResponse> {\n const response = await this.client.request('POST', \"/cfg/centrifugo/server/presence-stats/\", { body: data });\n return response;\n }\n\n}","import * as Models from \"./models\";\n\n\n/**\n * API endpoints for Centrifugo Auth.\n */\nexport class CentrifugoAuth {\n private client: any;\n\n constructor(client: any) {\n this.client = client;\n }\n\n /**\n * Get Centrifugo connection token\n * \n * Generate JWT token for WebSocket connection to Centrifugo. Token\n * includes user's allowed channels based on their permissions. Requires\n * authentication.\n */\n async tokenRetrieve(): Promise<Models.ConnectionTokenResponse> {\n const response = await this.client.request('GET', \"/cfg/centrifugo/auth/token/\");\n return response;\n }\n\n}","import * as Models from \"./models\";\n\n\n/**\n * API endpoints for Centrifugo Monitoring.\n */\nexport class CentrifugoMonitoring {\n private client: any;\n\n constructor(client: any) {\n this.client = client;\n }\n\n async centrifugoMonitorChannelsRetrieve(hours?: number): Promise<Models.ChannelList[]>;\n async centrifugoMonitorChannelsRetrieve(params?: { hours?: number }): Promise<Models.ChannelList[]>;\n\n /**\n * Get channel statistics\n * \n * Returns statistics grouped by channel.\n */\n async centrifugoMonitorChannelsRetrieve(...args: any[]): Promise<Models.ChannelList[]> {\n const isParamsObject = args.length === 1 && typeof args[0] === 'object' && args[0] !== null && !Array.isArray(args[0]);\n \n let params;\n if (isParamsObject) {\n params = args[0];\n } else {\n params = { hours: args[0] };\n }\n const response = await this.client.request('GET', \"/cfg/centrifugo/monitor/channels/\", { params });\n return (response as any).results || response;\n }\n\n /**\n * Get Centrifugo health status\n * \n * Returns the current health status of the Centrifugo client.\n */\n async centrifugoMonitorHealthRetrieve(): Promise<Models.CentrifugoHealthCheck> {\n const response = await this.client.request('GET', \"/cfg/centrifugo/monitor/health/\");\n return response;\n }\n\n async centrifugoMonitorOverviewRetrieve(hours?: number): Promise<Models.CentrifugoOverviewStats>;\n async centrifugoMonitorOverviewRetrieve(params?: { hours?: number }): Promise<Models.CentrifugoOverviewStats>;\n\n /**\n * Get overview statistics\n * \n * Returns overview statistics for Centrifugo publishes.\n */\n async centrifugoMonitorOverviewRetrieve(...args: any[]): Promise<Models.CentrifugoOverviewStats> {\n const isParamsObject = args.length === 1 && typeof args[0] === 'object' && args[0] !== null && !Array.isArray(args[0]);\n \n let params;\n if (isParamsObject) {\n params = args[0];\n } else {\n params = { hours: args[0] };\n }\n const response = await this.client.request('GET', \"/cfg/centrifugo/monitor/overview/\", { params });\n return response;\n }\n\n async centrifugoMonitorPublishesList(channel?: string, page?: number, page_size?: number, status?: string): Promise<Models.PaginatedPublishList>;\n async centrifugoMonitorPublishesList(params?: { channel?: string; page?: number; page_size?: number; status?: string }): Promise<Models.PaginatedPublishList>;\n\n /**\n * Get recent publishes\n * \n * Returns a paginated list of recent Centrifugo publishes with their\n * details. Uses standard DRF pagination.\n */\n async centrifugoMonitorPublishesList(...args: any[]): Promise<Models.PaginatedPublishList> {\n const isParamsObject = args.length === 1 && typeof args[0] === 'object' && args[0] !== null && !Array.isArray(args[0]);\n \n let params;\n if (isParamsObject) {\n params = args[0];\n } else {\n params = { channel: args[0], page: args[1], page_size: args[2], status: args[3] };\n }\n const response = await this.client.request('GET', \"/cfg/centrifugo/monitor/publishes/\", { params });\n return response;\n }\n\n async centrifugoMonitorTimelineRetrieve(hours?: number, interval?: string): Promise<Models.TimelineResponse>;\n async centrifugoMonitorTimelineRetrieve(params?: { hours?: number; interval?: string }): Promise<Models.TimelineResponse>;\n\n /**\n * Get publish timeline\n * \n * Returns hourly or daily breakdown of publish counts for charts.\n */\n async centrifugoMonitorTimelineRetrieve(...args: any[]): Promise<Models.TimelineResponse> {\n const isParamsObject = args.length === 1 && typeof args[0] === 'object' && args[0] !== null && !Array.isArray(args[0]);\n \n let params;\n if (isParamsObject) {\n params = args[0];\n } else {\n params = { hours: args[0], interval: args[1] };\n }\n const response = await this.client.request('GET', \"/cfg/centrifugo/monitor/timeline/\", { params });\n return response;\n }\n\n}","import * as Models from \"./models\";\n\n\n/**\n * API endpoints for Centrifugo Testing.\n */\nexport class CentrifugoTesting {\n private client: any;\n\n constructor(client: any) {\n this.client = client;\n }\n\n /**\n * Publish test message\n * \n * Publish test message to Centrifugo via wrapper with optional ACK\n * tracking.\n */\n async publishTestCreate(data: Models.PublishTestRequestRequest): Promise<Models.PublishTestResponse> {\n const response = await this.client.request('POST', \"/cfg/centrifugo/testing/publish-test/\", { body: data });\n return response;\n }\n\n /**\n * Publish with database logging\n * \n * Publish message using CentrifugoClient with database logging. This will\n * create CentrifugoLog records.\n */\n async publishWithLoggingCreate(data: Models.PublishTestRequestRequest): Promise<Models.PublishTestResponse> {\n const response = await this.client.request('POST', \"/cfg/centrifugo/testing/publish-with-logging/\", { body: data });\n return response;\n }\n\n /**\n * Send manual ACK\n * \n * Manually send ACK for a message to the wrapper. Pass message_id in\n * request body.\n */\n async sendAckCreate(data: Models.ManualAckRequestRequest): Promise<Models.ManualAckResponse> {\n const response = await this.client.request('POST', \"/cfg/centrifugo/testing/send-ack/\", { body: data });\n return response;\n }\n\n}","// Auto-generated by DjangoCFG - see CLAUDE.md\n/**\n * HTTP Client Adapter Pattern\n *\n * Allows switching between fetch/axios/httpx without changing generated code.\n * Provides unified interface for making HTTP requests.\n */\n\nexport interface HttpRequest {\n method: string;\n url: string;\n headers?: Record<string, string>;\n body?: any;\n params?: Record<string, any>;\n /** FormData for file uploads (multipart/form-data) */\n formData?: FormData;\n}\n\nexport interface HttpResponse<T = any> {\n data: T;\n status: number;\n statusText: string;\n headers: Record<string, string>;\n}\n\n/**\n * HTTP Client Adapter Interface.\n * Implement this to use custom HTTP clients (axios, httpx, etc.)\n */\nexport interface HttpClientAdapter {\n request<T = any>(request: HttpRequest): Promise<HttpResponse<T>>;\n}\n\n/**\n * Default Fetch API adapter.\n * Uses native browser fetch() with proper error handling.\n */\nexport class FetchAdapter implements HttpClientAdapter {\n async request<T = any>(request: HttpRequest): Promise<HttpResponse<T>> {\n const { method, url, headers, body, params, formData } = request;\n\n // Build URL with query params\n let finalUrl = url;\n if (params) {\n const searchParams = new URLSearchParams();\n Object.entries(params).forEach(([key, value]) => {\n if (value !== null && value !== undefined) {\n searchParams.append(key, String(value));\n }\n });\n const queryString = searchParams.toString();\n if (queryString) {\n finalUrl = url.includes('?') ? `${url}&${queryString}` : `${url}?${queryString}`;\n }\n }\n\n // Build headers\n const finalHeaders: Record<string, string> = { ...headers };\n\n // Determine body and content-type\n let requestBody: string | FormData | undefined;\n\n if (formData) {\n // For multipart/form-data, let browser set Content-Type with boundary\n requestBody = formData;\n // Don't set Content-Type - browser will set it with boundary\n } else if (body) {\n // JSON request\n finalHeaders['Content-Type'] = 'application/json';\n requestBody = JSON.stringify(body);\n }\n\n // Make request\n const response = await fetch(finalUrl, {\n method,\n headers: finalHeaders,\n body: requestBody,\n credentials: 'include', // Include Django session cookies\n });\n\n // Parse response\n let data: any = null;\n const contentType = response.headers.get('content-type');\n\n if (response.status !== 204 && contentType?.includes('application/json')) {\n data = await response.json();\n } else if (response.status !== 204) {\n data = await response.text();\n }\n\n // Convert Headers to plain object\n const responseHeaders: Record<string, string> = {};\n response.headers.forEach((value, key) => {\n responseHeaders[key] = value;\n });\n\n return {\n data,\n status: response.status,\n statusText: response.statusText,\n headers: responseHeaders,\n };\n }\n}","// Auto-generated by DjangoCFG - see CLAUDE.md\n/**\n * API Error Classes\n *\n * Typed error classes with Django REST Framework support.\n */\n\n/**\n * HTTP API Error with DRF field-specific validation errors.\n *\n * Usage:\n * ```typescript\n * try {\n * await api.users.create(userData);\n * } catch (error) {\n * if (error instanceof APIError) {\n * if (error.isValidationError) {\n * console.log('Field errors:', error.fieldErrors);\n * // { \"email\": [\"Email already exists\"], \"username\": [\"Required\"] }\n * }\n * }\n * }\n * ```\n */\nexport class APIError extends Error {\n constructor(\n public statusCode: number,\n public statusText: string,\n public response: any,\n public url: string,\n message?: string\n ) {\n super(message || `HTTP ${statusCode}: ${statusText}`);\n this.name = 'APIError';\n }\n\n /**\n * Get error details from response.\n * DRF typically returns: { \"detail\": \"Error message\" } or { \"field\": [\"error1\", \"error2\"] }\n */\n get details(): Record<string, any> | null {\n if (typeof this.response === 'object' && this.response !== null) {\n return this.response;\n }\n return null;\n }\n\n /**\n * Get field-specific validation errors from DRF.\n * Returns: { \"field_name\": [\"error1\", \"error2\"], ... }\n */\n get fieldErrors(): Record<string, string[]> | null {\n const details = this.details;\n if (!details) return null;\n\n // DRF typically returns: { \"field\": [\"error1\", \"error2\"] }\n const fieldErrors: Record<string, string[]> = {};\n for (const [key, value] of Object.entries(details)) {\n if (Array.isArray(value)) {\n fieldErrors[key] = value;\n }\n }\n\n return Object.keys(fieldErrors).length > 0 ? fieldErrors : null;\n }\n\n /**\n * Get single error message from DRF.\n * Checks for \"detail\", \"message\", or first field error.\n */\n get errorMessage(): string {\n const details = this.details;\n if (!details) return this.message;\n\n // Check for \"detail\" field (common in DRF)\n if (details.detail) {\n return Array.isArray(details.detail) ? details.detail.join(', ') : String(details.detail);\n }\n\n // Check for \"message\" field\n if (details.message) {\n return String(details.message);\n }\n\n // Return first field error\n const fieldErrors = this.fieldErrors;\n if (fieldErrors) {\n const firstField = Object.keys(fieldErrors)[0];\n if (firstField) {\n return `${firstField}: ${fieldErrors[firstField]?.join(', ')}`;\n }\n }\n\n return this.message;\n }\n\n // Helper methods for common HTTP status codes\n get isValidationError(): boolean { return this.statusCode === 400; }\n get isAuthError(): boolean { return this.statusCode === 401; }\n get isPermissionError(): boolean { return this.statusCode === 403; }\n get isNotFoundError(): boolean { return this.statusCode === 404; }\n get isServerError(): boolean { return this.statusCode >= 500 && this.statusCode < 600; }\n}\n\n/**\n * Network Error (connection failed, timeout, etc.)\n */\nexport class NetworkError extends Error {\n constructor(\n message: string,\n public url: string,\n public originalError?: Error\n ) {\n super(message);\n this.name = 'NetworkError';\n }\n}","// Auto-generated by DjangoCFG - see CLAUDE.md\n/**\n * API Logger with Consola\n * Beautiful console logging for API requests and responses\n *\n * Installation:\n * npm install consola\n */\n\nimport { type ConsolaInstance, createConsola } from 'consola';\n\n/**\n * Request log data\n */\nexport interface RequestLog {\n method: string;\n url: string;\n headers?: Record<string, string>;\n body?: any;\n timestamp: number;\n}\n\n/**\n * Response log data\n */\nexport interface ResponseLog {\n status: number;\n statusText: string;\n data?: any;\n duration: number;\n timestamp: number;\n}\n\n/**\n * Error log data\n */\nexport interface ErrorLog {\n message: string;\n statusCode?: number;\n fieldErrors?: Record<string, string[]>;\n duration: number;\n timestamp: number;\n}\n\n/**\n * Logger configuration\n */\nexport interface LoggerConfig {\n /** Enable logging */\n enabled: boolean;\n /** Log requests */\n logRequests: boolean;\n /** Log responses */\n logResponses: boolean;\n /** Log errors */\n logErrors: boolean;\n /** Log request/response bodies */\n logBodies: boolean;\n /** Log headers (excluding sensitive ones) */\n logHeaders: boolean;\n /** Custom consola instance */\n consola?: ConsolaInstance;\n}\n\n/**\n * Default logger configuration\n */\nconst DEFAULT_CONFIG: LoggerConfig = {\n enabled: process.env.NODE_ENV !== 'production',\n logRequests: true,\n logResponses: true,\n logErrors: true,\n logBodies: true,\n logHeaders: false,\n};\n\n/**\n * Sensitive header names to filter out\n */\nconst SENSITIVE_HEADERS = [\n 'authorization',\n 'cookie',\n 'set-cookie',\n 'x-api-key',\n 'x-csrf-token',\n];\n\n/**\n * API Logger class\n */\nexport class APILogger {\n private config: LoggerConfig;\n private consola: ConsolaInstance;\n\n constructor(config: Partial<LoggerConfig> = {}) {\n this.config = { ...DEFAULT_CONFIG, ...config };\n this.consola = config.consola || createConsola({\n level: this.config.enabled ? 4 : 0,\n });\n }\n\n /**\n * Enable logging\n */\n enable(): void {\n this.config.enabled = true;\n }\n\n /**\n * Disable logging\n */\n disable(): void {\n this.config.enabled = false;\n }\n\n /**\n * Update configuration\n */\n setConfig(config: Partial<LoggerConfig>): void {\n this.config = { ...this.config, ...config };\n }\n\n /**\n * Filter sensitive headers\n */\n private filterHeaders(headers?: Record<string, string>): Record<string, string> {\n if (!headers) return {};\n\n const filtered: Record<string, string> = {};\n Object.keys(headers).forEach((key) => {\n const lowerKey = key.toLowerCase();\n if (SENSITIVE_HEADERS.includes(lowerKey)) {\n filtered[key] = '***';\n } else {\n filtered[key] = headers[key] || '';\n }\n });\n\n return filtered;\n }\n\n /**\n * Log request\n */\n logRequest(request: RequestLog): void {\n if (!this.config.enabled || !this.config.logRequests) return;\n\n const { method, url, headers, body } = request;\n\n this.consola.start(`${method} ${url}`);\n\n if (this.config.logHeaders && headers) {\n this.consola.debug('Headers:', this.filterHeaders(headers));\n }\n\n if (this.config.logBodies && body) {\n this.consola.debug('Body:', body);\n }\n }\n\n /**\n * Log response\n */\n logResponse(request: RequestLog, response: ResponseLog): void {\n if (!this.config.enabled || !this.config.logResponses) return;\n\n const { method, url } = request;\n const { status, statusText, data, duration } = response;\n\n const statusColor = status >= 500 ? 'red'\n : status >= 400 ? 'yellow'\n : status >= 300 ? 'cyan'\n : 'green';\n\n this.consola.success(\n `${method} ${url} ${status} ${statusText} (${duration}ms)`\n );\n\n if (this.config.logBodies && data) {\n this.consola.debug('Response:', data);\n }\n }\n\n /**\n * Log error\n */\n logError(request: RequestLog, error: ErrorLog): void {\n if (!this.config.enabled || !this.config.logErrors) return;\n\n const { method, url } = request;\n const { message, statusCode, fieldErrors, duration } = error;\n\n this.consola.error(\n `${method} ${url} ${statusCode || 'Network'} Error (${duration}ms)`\n );\n\n this.consola.error('Message:', message);\n\n if (fieldErrors && Object.keys(fieldErrors).length > 0) {\n this.consola.error('Field Errors:');\n Object.entries(fieldErrors).forEach(([field, errors]) => {\n errors.forEach((err) => {\n this.consola.error(` • ${field}: ${err}`);\n });\n });\n }\n }\n\n /**\n * Log general info\n */\n info(message: string, ...args: any[]): void {\n if (!this.config.enabled) return;\n this.consola.info(message, ...args);\n }\n\n /**\n * Log warning\n */\n warn(message: string, ...args: any[]): void {\n if (!this.config.enabled) return;\n this.consola.warn(message, ...args);\n }\n\n /**\n * Log error\n */\n error(message: string, ...args: any[]): void {\n if (!this.config.enabled) return;\n this.consola.error(message, ...args);\n }\n\n /**\n * Log debug\n */\n debug(message: string, ...args: any[]): void {\n if (!this.config.enabled) return;\n this.consola.debug(message, ...args);\n }\n\n /**\n * Log success\n */\n success(message: string, ...args: any[]): void {\n if (!this.config.enabled) return;\n this.consola.success(message, ...args);\n }\n\n /**\n * Create a sub-logger with prefix\n */\n withTag(tag: string): ConsolaInstance {\n return this.consola.withTag(tag);\n }\n}\n\n/**\n * Default logger instance\n */\nexport const defaultLogger = new APILogger();","// Auto-generated by DjangoCFG - see CLAUDE.md\n/**\n * Retry Configuration and Utilities\n *\n * Provides automatic retry logic for failed HTTP requests using p-retry.\n * Retries only on network errors and server errors (5xx), not client errors (4xx).\n */\n\nimport pRetry, { AbortError } from 'p-retry';\nimport { APIError, NetworkError } from './errors';\n\n/**\n * Information about a failed retry attempt.\n */\nexport interface FailedAttemptInfo {\n /** The error that caused the failure */\n error: Error;\n /** The attempt number (1-indexed) */\n attemptNumber: number;\n /** Number of retries left */\n retriesLeft: number;\n}\n\n/**\n * Retry configuration options.\n *\n * Uses exponential backoff with jitter by default to avoid thundering herd.\n */\nexport interface RetryConfig {\n /**\n * Maximum number of retry attempts.\n * @default 3\n */\n retries?: number;\n\n /**\n * Exponential backoff factor.\n * @default 2\n */\n factor?: number;\n\n /**\n * Minimum wait time between retries (ms).\n * @default 1000\n */\n minTimeout?: number;\n\n /**\n * Maximum wait time between retries (ms).\n * @default 60000\n */\n maxTimeout?: number;\n\n /**\n * Add randomness to wait times (jitter).\n * Helps avoid thundering herd problem.\n * @default true\n */\n randomize?: boolean;\n\n /**\n * Callback called on each failed attempt.\n */\n onFailedAttempt?: (info: FailedAttemptInfo) => void;\n}\n\n/**\n * Default retry configuration.\n */\nexport const DEFAULT_RETRY_CONFIG: Required<RetryConfig> = {\n retries: 3,\n factor: 2,\n minTimeout: 1000,\n maxTimeout: 60000,\n randomize: true,\n onFailedAttempt: () => {},\n};\n\n/**\n * Determine if an error should trigger a retry.\n *\n * Retries on:\n * - Network errors (connection refused, timeout, etc.)\n * - Server errors (5xx status codes)\n * - Rate limiting (429 status code)\n *\n * Does NOT retry on:\n * - Client errors (4xx except 429)\n * - Authentication errors (401, 403)\n * - Not found (404)\n *\n * @param error - The error to check\n * @returns true if should retry, false otherwise\n */\nexport function shouldRetry(error: any): boolean {\n // Always retry network errors\n if (error instanceof NetworkError) {\n return true;\n }\n\n // For API errors, check status code\n if (error instanceof APIError) {\n const status = error.statusCode;\n\n // Retry on 5xx server errors\n if (status >= 500 && status < 600) {\n return true;\n }\n\n // Retry on 429 (rate limit)\n if (status === 429) {\n return true;\n }\n\n // Do NOT retry on 4xx client errors\n return false;\n }\n\n // Retry on unknown errors (might be network issues)\n return true;\n}\n\n/**\n * Wrap a function with retry logic.\n *\n * @param fn - Async function to retry\n * @param config - Retry configuration\n * @returns Result of the function\n *\n * @example\n * ```typescript\n * const result = await withRetry(\n * async () => fetch('https://api.example.com/users'),\n * { retries: 5, minTimeout: 2000 }\n * );\n * ```\n */\nexport async function withRetry<T>(\n fn: () => Promise<T>,\n config?: RetryConfig\n): Promise<T> {\n const finalConfig = { ...DEFAULT_RETRY_CONFIG, ...config };\n\n return pRetry(\n async () => {\n try {\n return await fn();\n } catch (error) {\n // Check if we should retry this error\n if (!shouldRetry(error)) {\n // Abort retry immediately for non-retryable errors\n throw new AbortError(error as Error);\n }\n\n // Re-throw error to trigger retry\n throw error;\n }\n },\n {\n retries: finalConfig.retries,\n factor: finalConfig.factor,\n minTimeout: finalConfig.minTimeout,\n maxTimeout: finalConfig.maxTimeout,\n randomize: finalConfig.randomize,\n onFailedAttempt: finalConfig.onFailedAttempt ? (error) => {\n // Adapt p-retry's FailedAttemptError to our FailedAttemptInfo\n const pRetryError = error as any; // p-retry's internal type\n finalConfig.onFailedAttempt!({\n error: pRetryError as Error,\n attemptNumber: pRetryError.attemptNumber,\n retriesLeft: pRetryError.retriesLeft,\n });\n } : undefined,\n }\n );\n}","import { CentrifugoAdminApi } from \"./centrifugo__centrifugo_admin_api\";\nimport { CentrifugoAuth } from \"./centrifugo__centrifugo_auth\";\nimport { CentrifugoMonitoring } from \"./centrifugo__centrifugo_monitoring\";\nimport { CentrifugoTesting } from \"./centrifugo__centrifugo_testing\";\nimport { HttpClientAdapter, FetchAdapter } from \"./http\";\nimport { APIError, NetworkError } from \"./errors\";\nimport { APILogger, type LoggerConfig } from \"./logger\";\nimport { withRetry, type RetryConfig } from \"./retry\";\n\n\n/**\n * Async API client for Django CFG API.\n *\n * Usage:\n * ```typescript\n * const client = new APIClient('https://api.example.com');\n * const users = await client.users.list();\n * const post = await client.posts.create(newPost);\n *\n * // Custom HTTP adapter (e.g., Axios)\n * const client = new APIClient('https://api.example.com', {\n * httpClient: new AxiosAdapter()\n * });\n * ```\n */\nexport class APIClient {\n private baseUrl: string;\n private httpClient: HttpClientAdapter;\n private logger: APILogger | null = null;\n private retryConfig: RetryConfig | null = null;\n\n // Sub-clients\n public centrifugo_admin_api: CentrifugoAdminApi;\n public centrifugo_auth: CentrifugoAuth;\n public centrifugo_monitoring: CentrifugoMonitoring;\n public centrifugo_testing: CentrifugoTesting;\n\n constructor(\n baseUrl: string,\n options?: {\n httpClient?: HttpClientAdapter;\n loggerConfig?: Partial<LoggerConfig>;\n retryConfig?: RetryConfig;\n }\n ) {\n this.baseUrl = baseUrl.replace(/\\/$/, '');\n this.httpClient = options?.httpClient || new FetchAdapter();\n\n // Initialize logger if config provided\n if (options?.loggerConfig !== undefined) {\n this.logger = new APILogger(options.loggerConfig);\n }\n\n // Store retry configuration\n if (options?.retryConfig !== undefined) {\n this.retryConfig = options.retryConfig;\n }\n\n // Initialize sub-clients\n this.centrifugo_admin_api = new CentrifugoAdminApi(this);\n this.centrifugo_auth = new CentrifugoAuth(this);\n this.centrifugo_monitoring = new CentrifugoMonitoring(this);\n this.centrifugo_testing = new CentrifugoTesting(this);\n }\n\n /**\n * Get CSRF token from cookies (for SessionAuthentication).\n *\n * Returns null if cookie doesn't exist (JWT-only auth).\n */\n getCsrfToken(): string | null {\n const name = 'csrftoken';\n const value = `; ${document.cookie}`;\n const parts = value.split(`; ${name}=`);\n if (parts.length === 2) {\n return parts.pop()?.split(';').shift() || null;\n }\n return null;\n }\n\n /**\n * Make HTTP request with Django CSRF and session handling.\n * Automatically retries on network errors and 5xx server errors.\n */\n async request<T>(\n method: string,\n path: string,\n options?: {\n params?: Record<string, any>;\n body?: any;\n formData?: FormData;\n headers?: Record<string, string>;\n }\n ): Promise<T> {\n // Wrap request in retry logic if configured\n if (this.retryConfig) {\n return withRetry(() => this._makeRequest<T>(method, path, options), {\n ...this.retryConfig,\n onFailedAttempt: (info) => {\n // Log retry attempts\n if (this.logger) {\n this.logger.warn(\n `Retry attempt ${info.attemptNumber}/${info.retriesLeft + info.attemptNumber} ` +\n `for ${method} ${path}: ${info.error.message}`\n );\n }\n // Call user's onFailedAttempt if provided\n this.retryConfig?.onFailedAttempt?.(info);\n },\n });\n }\n\n // No retry configured, make request directly\n return this._makeRequest<T>(method, path, options);\n }\n\n /**\n * Internal request method (without retry wrapper).\n * Used by request() method with optional retry logic.\n */\n private async _makeRequest<T>(\n method: string,\n path: string,\n options?: {\n params?: Record<string, any>;\n body?: any;\n formData?: FormData;\n headers?: Record<string, string>;\n }\n ): Promise<T> {\n // Build URL - handle both absolute and relative paths\n // When baseUrl is empty (static builds), path is used as-is (relative to current origin)\n const url = this.baseUrl ? `${this.baseUrl}${path}` : path;\n const startTime = Date.now();\n\n // Build headers - start with custom headers from options\n const headers: Record<string, string> = {\n ...(options?.headers || {})\n };\n\n // Don't set Content-Type for FormData (browser will set it with boundary)\n if (!options?.formData && !headers['Content-Type']) {\n headers['Content-Type'] = 'application/json';\n }\n\n // CSRF not needed - SessionAuthentication not enabled in DRF config\n // Your API uses JWT/Token authentication (no CSRF required)\n\n // Log request\n if (this.logger) {\n this.logger.logRequest({\n method,\n url: url,\n headers,\n body: options?.formData || options?.body,\n timestamp: startTime,\n });\n }\n\n try {\n // Make request via HTTP adapter\n const response = await this.httpClient.request<T>({\n method,\n url: url,\n headers,\n params: options?.params,\n body: options?.body,\n formData: options?.formData,\n });\n\n const duration = Date.now() - startTime;\n\n // Check for HTTP errors\n if (response.status >= 400) {\n const error = new APIError(\n response.status,\n response.statusText,\n response.data,\n url\n );\n\n // Log error\n if (this.logger) {\n this.logger.logError(\n {\n method,\n url: url,\n headers,\n body: options?.formData || options?.body,\n timestamp: startTime,\n },\n {\n message: error.message,\n statusCode: response.status,\n duration,\n timestamp: Date.now(),\n }\n );\n }\n\n throw error;\n }\n\n // Log successful response\n if (this.logger) {\n this.logger.logResponse(\n {\n method,\n url: url,\n headers,\n body: options?.formData || options?.body,\n timestamp: startTime,\n },\n {\n status: response.status,\n statusText: response.statusText,\n data: response.data,\n duration,\n timestamp: Date.now(),\n }\n );\n }\n\n return response.data as T;\n } catch (error) {\n const duration = Date.now() - startTime;\n\n // Re-throw APIError as-is\n if (error instanceof APIError) {\n throw error;\n }\n\n // Detect CORS errors and dispatch event\n const isCORSError = error instanceof TypeError &&\n (error.message.toLowerCase().includes('cors') ||\n error.message.toLowerCase().includes('failed to fetch') ||\n error.message.toLowerCase().includes('network request failed'));\n\n // Log specific error type first\n if (this.logger) {\n if (isCORSError) {\n this.logger.error(`🚫 CORS Error: ${method} ${url}`);\n this.logger.error(` → ${error instanceof Error ? error.message : String(error)}`);\n this.logger.error(` → Configure security_domains parameter on the server`);\n } else {\n this.logger.error(`⚠️ Network Error: ${method} ${url}`);\n this.logger.error(` → ${error instanceof Error ? error.message : String(error)}`);\n }\n }\n\n // Dispatch browser events\n if (typeof window !== 'undefined') {\n try {\n if (isCORSError) {\n // Dispatch CORS-specific error event\n window.dispatchEvent(new CustomEvent('cors-error', {\n detail: {\n url: url,\n method: method,\n error: error instanceof Error ? error.message : String(error),\n timestamp: new Date(),\n },\n bubbles: true,\n cancelable: false,\n }));\n } else {\n // Dispatch generic network error event\n window.dispatchEvent(new CustomEvent('network-error', {\n detail: {\n url: url,\n method: method,\n error: error instanceof Error ? error.message : String(error),\n timestamp: new Date(),\n },\n bubbles: true,\n cancelable: false,\n }));\n }\n } catch (eventError) {\n // Silently fail - event dispatch should never crash the app\n }\n }\n\n // Wrap other errors as NetworkError\n const networkError = error instanceof Error\n ? new NetworkError(error.message, url, error)\n : new NetworkError('Unknown error', url);\n\n // Detailed logging via logger.logError\n if (this.logger) {\n this.logger.logError(\n {\n method,\n url: url,\n headers,\n body: options?.formData || options?.body,\n timestamp: startTime,\n },\n {\n message: networkError.message,\n duration,\n timestamp: Date.now(),\n }\n );\n }\n\n throw networkError;\n }\n }\n}\n","// Auto-generated by DjangoCFG - see CLAUDE.md\n/**\n * Storage adapters for cross-platform token storage.\n *\n * Supports:\n * - LocalStorage (browser)\n * - Cookies (SSR/browser)\n * - Memory (Node.js/Electron/testing)\n */\n\nimport type { APILogger } from './logger';\n\n/**\n * Storage adapter interface for cross-platform token storage.\n */\nexport interface StorageAdapter {\n getItem(key: string): string | null;\n setItem(key: string, value: string): void;\n removeItem(key: string): void;\n}\n\n/**\n * LocalStorage adapter with safe try-catch for browser environments.\n * Works in modern browsers with localStorage support.\n * \n * Note: This adapter uses window.localStorage and should only be used in browser/client environments.\n * For server-side usage, use MemoryStorageAdapter or CookieStorageAdapter instead.\n */\nexport class LocalStorageAdapter implements StorageAdapter {\n private logger?: APILogger;\n\n constructor(logger?: APILogger) {\n this.logger = logger;\n }\n\n getItem(key: string): string | null {\n try {\n if (typeof window !== 'undefined' && window.localStorage) {\n const value = localStorage.getItem(key);\n this.logger?.debug(`LocalStorage.getItem(\"${key}\"): ${value ? 'found' : 'not found'}`);\n return value;\n }\n this.logger?.warn('LocalStorage not available: window.localStorage is undefined');\n } catch (error) {\n this.logger?.error('LocalStorage.getItem failed:', error);\n }\n return null;\n }\n\n setItem(key: string, value: string): void {\n try {\n if (typeof window !== 'undefined' && window.localStorage) {\n localStorage.setItem(key, value);\n this.logger?.debug(`LocalStorage.setItem(\"${key}\"): success`);\n } else {\n this.logger?.warn('LocalStorage not available: window.localStorage is undefined');\n }\n } catch (error) {\n this.logger?.error('LocalStorage.setItem failed:', error);\n }\n }\n\n removeItem(key: string): void {\n try {\n if (typeof window !== 'undefined' && window.localStorage) {\n localStorage.removeItem(key);\n this.logger?.debug(`LocalStorage.removeItem(\"${key}\"): success`);\n } else {\n this.logger?.warn('LocalStorage not available: window.localStorage is undefined');\n }\n } catch (error) {\n this.logger?.error('LocalStorage.removeItem failed:', error);\n }\n }\n}\n\n/**\n * Cookie-based storage adapter for SSR and browser environments.\n * Useful for Next.js, Nuxt.js, and other SSR frameworks.\n */\nexport class CookieStorageAdapter implements StorageAdapter {\n private logger?: APILogger;\n\n constructor(logger?: APILogger) {\n this.logger = logger;\n }\n\n getItem(key: string): string | null {\n try {\n if (typeof document === 'undefined') {\n this.logger?.warn('Cookies not available: document is undefined (SSR context?)');\n return null;\n }\n const value = `; ${document.cookie}`;\n const parts = value.split(`; ${key}=`);\n if (parts.length === 2) {\n const result = parts.pop()?.split(';').shift() || null;\n this.logger?.debug(`CookieStorage.getItem(\"${key}\"): ${result ? 'found' : 'not found'}`);\n return result;\n }\n this.logger?.debug(`CookieStorage.getItem(\"${key}\"): not found`);\n } catch (error) {\n this.logger?.error('CookieStorage.getItem failed:', error);\n }\n return null;\n }\n\n setItem(key: string, value: string): void {\n try {\n if (typeof document !== 'undefined') {\n document.cookie = `${key}=${value}; path=/; max-age=31536000`;\n this.logger?.debug(`CookieStorage.setItem(\"${key}\"): success`);\n } else {\n this.logger?.warn('Cookies not available: document is undefined (SSR context?)');\n }\n } catch (error) {\n this.logger?.error('CookieStorage.setItem failed:', error);\n }\n }\n\n removeItem(key: string): void {\n try {\n if (typeof document !== 'undefined') {\n document.cookie = `${key}=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT`;\n this.logger?.debug(`CookieStorage.removeItem(\"${key}\"): success`);\n } else {\n this.logger?.warn('Cookies not available: document is undefined (SSR context?)');\n }\n } catch (error) {\n this.logger?.error('CookieStorage.removeItem failed:', error);\n }\n }\n}\n\n/**\n * In-memory storage adapter for Node.js, Electron, and testing environments.\n * Data is stored in RAM and cleared when process exits.\n */\nexport class MemoryStorageAdapter implements StorageAdapter {\n private storage: Map<string, string> = new Map();\n private logger?: APILogger;\n\n constructor(logger?: APILogger) {\n this.logger = logger;\n }\n\n getItem(key: string): string | null {\n const value = this.storage.get(key) || null;\n this.logger?.debug(`MemoryStorage.getItem(\"${key}\"): ${value ? 'found' : 'not found'}`);\n return value;\n }\n\n setItem(key: string, value: string): void {\n this.storage.set(key, value);\n this.logger?.debug(`MemoryStorage.setItem(\"${key}\"): success`);\n }\n\n removeItem(key: string): void {\n this.storage.delete(key);\n this.logger?.debug(`MemoryStorage.removeItem(\"${key}\"): success`);\n }\n}","/**\n * Zod schema for CentrifugoChannelInfo\n *\n * This schema provides runtime validation and type inference.\n * * Information about a single channel.\n * */\nimport { z } from 'zod'\n\n/**\n * Information about a single channel.\n */\nexport const CentrifugoChannelInfoSchema = z.object({\n num_clients: z.int(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type CentrifugoChannelInfo = z.infer<typeof CentrifugoChannelInfoSchema>","/**\n * Zod schema for CentrifugoChannelsRequestRequest\n *\n * This schema provides runtime validation and type inference.\n * * Request to list active channels.\n * */\nimport { z } from 'zod'\n\n/**\n * Request to list active channels.\n */\nexport const CentrifugoChannelsRequestRequestSchema = z.object({\n pattern: z.string().nullable().optional(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type CentrifugoChannelsRequestRequest = z.infer<typeof CentrifugoChannelsRequestRequestSchema>","/**\n * Zod schema for CentrifugoChannelsResponse\n *\n * This schema provides runtime validation and type inference.\n * * List of active channels response.\n * */\nimport { z } from 'zod'\nimport { CentrifugoChannelsResultSchema } from './CentrifugoChannelsResult.schema'\nimport { CentrifugoErrorSchema } from './CentrifugoError.schema'\n\n/**\n * List of active channels response.\n */\nexport const CentrifugoChannelsResponseSchema = z.object({\n error: CentrifugoErrorSchema.optional(),\n result: CentrifugoChannelsResultSchema.optional(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type CentrifugoChannelsResponse = z.infer<typeof CentrifugoChannelsResponseSchema>","/**\n * Zod schema for CentrifugoChannelsResult\n *\n * This schema provides runtime validation and type inference.\n * * Channels result wrapper.\n * */\nimport { z } from 'zod'\nimport { CentrifugoChannelInfoSchema } from './CentrifugoChannelInfo.schema'\n\n/**\n * Channels result wrapper.\n */\nexport const CentrifugoChannelsResultSchema = z.object({\n channels: z.record(z.string(), CentrifugoChannelInfoSchema),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type CentrifugoChannelsResult = z.infer<typeof CentrifugoChannelsResultSchema>","/**\n * Zod schema for CentrifugoError\n *\n * This schema provides runtime validation and type inference.\n * * Centrifugo API error structure.\n * */\nimport { z } from 'zod'\n\n/**\n * Centrifugo API error structure.\n */\nexport const CentrifugoErrorSchema = z.object({\n code: z.int().optional(),\n message: z.string().optional(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type CentrifugoError = z.infer<typeof CentrifugoErrorSchema>","/**\n * Zod schema for CentrifugoClientInfo\n *\n * This schema provides runtime validation and type inference.\n * * Information about connected client.\n * */\nimport { z } from 'zod'\n\n/**\n * Information about connected client.\n */\nexport const CentrifugoClientInfoSchema = z.object({\n user: z.string(),\n client: z.string(),\n conn_info: z.record(z.string(), z.any()).nullable().optional(),\n chan_info: z.record(z.string(), z.any()).nullable().optional(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type CentrifugoClientInfo = z.infer<typeof CentrifugoClientInfoSchema>","/**\n * Zod schema for CentrifugoHealthCheck\n *\n * This schema provides runtime validation and type inference.\n * * Health check response.\n * */\nimport { z } from 'zod'\n\n/**\n * Health check response.\n */\nexport const CentrifugoHealthCheckSchema = z.object({\n status: z.string(),\n wrapper_url: z.string(),\n has_api_key: z.boolean(),\n timestamp: z.string(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type CentrifugoHealthCheck = z.infer<typeof CentrifugoHealthCheckSchema>","/**\n * Zod schema for CentrifugoHistoryRequestRequest\n *\n * This schema provides runtime validation and type inference.\n * * Request to get channel history.\n * */\nimport { z } from 'zod'\nimport { CentrifugoStreamPositionSchema } from './CentrifugoStreamPosition.schema'\n\n/**\n * Request to get channel history.\n */\nexport const CentrifugoHistoryRequestRequestSchema = z.object({\n channel: z.string(),\n limit: z.int().nullable().optional(),\n since: CentrifugoStreamPositionSchema.optional(),\n reverse: z.boolean().nullable().optional(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type CentrifugoHistoryRequestRequest = z.infer<typeof CentrifugoHistoryRequestRequestSchema>","/**\n * Zod schema for CentrifugoStreamPosition\n *\n * This schema provides runtime validation and type inference.\n * * Stream position for pagination.\n * */\nimport { z } from 'zod'\n\n/**\n * Stream position for pagination.\n */\nexport const CentrifugoStreamPositionSchema = z.object({\n offset: z.int(),\n epoch: z.string(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type CentrifugoStreamPosition = z.infer<typeof CentrifugoStreamPositionSchema>","/**\n * Zod schema for CentrifugoHistoryResponse\n *\n * This schema provides runtime validation and type inference.\n * * Channel history response.\n * */\nimport { z } from 'zod'\nimport { CentrifugoErrorSchema } from './CentrifugoError.schema'\nimport { CentrifugoHistoryResultSchema } from './CentrifugoHistoryResult.schema'\n\n/**\n * Channel history response.\n */\nexport const CentrifugoHistoryResponseSchema = z.object({\n error: CentrifugoErrorSchema.optional(),\n result: CentrifugoHistoryResultSchema.optional(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type CentrifugoHistoryResponse = z.infer<typeof CentrifugoHistoryResponseSchema>","/**\n * Zod schema for CentrifugoHistoryResult\n *\n * This schema provides runtime validation and type inference.\n * * History result wrapper.\n * */\nimport { z } from 'zod'\nimport { CentrifugoPublicationSchema } from './CentrifugoPublication.schema'\n\n/**\n * History result wrapper.\n */\nexport const CentrifugoHistoryResultSchema = z.object({\n publications: z.array(CentrifugoPublicationSchema),\n epoch: z.string(),\n offset: z.int(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type CentrifugoHistoryResult = z.infer<typeof CentrifugoHistoryResultSchema>","/**\n * Zod schema for CentrifugoPublication\n *\n * This schema provides runtime validation and type inference.\n * * Single publication (message) in channel history.\n * */\nimport { z } from 'zod'\nimport { CentrifugoClientInfoSchema } from './CentrifugoClientInfo.schema'\n\n/**\n * Single publication (message) in channel history.\n */\nexport const CentrifugoPublicationSchema = z.object({\n data: z.record(z.string(), z.any()),\n info: CentrifugoClientInfoSchema.optional(),\n offset: z.int(),\n tags: z.record(z.string(), z.any()).nullable().optional(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type CentrifugoPublication = z.infer<typeof CentrifugoPublicationSchema>","/**\n * Zod schema for CentrifugoInfoResponse\n *\n * This schema provides runtime validation and type inference.\n * * Server info response.\n * */\nimport { z } from 'zod'\nimport { CentrifugoErrorSchema } from './CentrifugoError.schema'\nimport { CentrifugoInfoResultSchema } from './CentrifugoInfoResult.schema'\n\n/**\n * Server info response.\n */\nexport const CentrifugoInfoResponseSchema = z.object({\n error: CentrifugoErrorSchema.optional(),\n result: CentrifugoInfoResultSchema.optional(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type CentrifugoInfoResponse = z.infer<typeof CentrifugoInfoResponseSchema>","/**\n * Zod schema for CentrifugoInfoResult\n *\n * This schema provides runtime validation and type inference.\n * * Info result wrapper.\n * */\nimport { z } from 'zod'\nimport { CentrifugoNodeInfoSchema } from './CentrifugoNodeInfo.schema'\n\n/**\n * Info result wrapper.\n */\nexport const CentrifugoInfoResultSchema = z.object({\n nodes: z.array(CentrifugoNodeInfoSchema),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type CentrifugoInfoResult = z.infer<typeof CentrifugoInfoResultSchema>","/**\n * Zod schema for CentrifugoNodeInfo\n *\n * This schema provides runtime validation and type inference.\n * * Information about a single Centrifugo node.\n * */\nimport { z } from 'zod'\nimport { CentrifugoMetricsSchema } from './CentrifugoMetrics.schema'\nimport { CentrifugoProcessSchema } from './CentrifugoProcess.schema'\n\n/**\n * Information about a single Centrifugo node.\n */\nexport const CentrifugoNodeInfoSchema = z.object({\n uid: z.string(),\n name: z.string(),\n version: z.string(),\n num_clients: z.int(),\n num_users: z.int(),\n num_channels: z.int(),\n uptime: z.int(),\n num_subs: z.int(),\n metrics: CentrifugoMetricsSchema.optional(),\n process: CentrifugoProcessSchema.optional(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type CentrifugoNodeInfo = z.infer<typeof CentrifugoNodeInfoSchema>","/**\n * Zod schema for CentrifugoMetrics\n *\n * This schema provides runtime validation and type inference.\n * * Server metrics.\n * */\nimport { z } from 'zod'\n\n/**\n * Server metrics.\n */\nexport const CentrifugoMetricsSchema = z.object({\n interval: z.number(),\n items: z.record(z.string(), z.number()),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type CentrifugoMetrics = z.infer<typeof CentrifugoMetricsSchema>","/**\n * Zod schema for CentrifugoProcess\n *\n * This schema provides runtime validation and type inference.\n * * Process information.\n * */\nimport { z } from 'zod'\n\n/**\n * Process information.\n */\nexport const CentrifugoProcessSchema = z.object({\n cpu: z.number(),\n rss: z.int(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type CentrifugoProcess = z.infer<typeof CentrifugoProcessSchema>","/**\n * Zod schema for CentrifugoOverviewStats\n *\n * This schema provides runtime validation and type inference.\n * * Overview statistics for Centrifugo publishes.\n * */\nimport { z } from 'zod'\n\n/**\n * Overview statistics for Centrifugo publishes.\n */\nexport const CentrifugoOverviewStatsSchema = z.object({\n total: z.int(),\n successful: z.int(),\n failed: z.int(),\n timeout: z.int(),\n success_rate: z.number(),\n avg_duration_ms: z.number(),\n avg_acks_received: z.number(),\n period_hours: z.int(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type CentrifugoOverviewStats = z.infer<typeof CentrifugoOverviewStatsSchema>","/**\n * Zod schema for CentrifugoPresenceRequestRequest\n *\n * This schema provides runtime validation and type inference.\n * * Request to get channel presence.\n * */\nimport { z } from 'zod'\n\n/**\n * Request to get channel presence.\n */\nexport const CentrifugoPresenceRequestRequestSchema = z.object({\n channel: z.string(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type CentrifugoPresenceRequestRequest = z.infer<typeof CentrifugoPresenceRequestRequestSchema>","/**\n * Zod schema for CentrifugoPresenceResponse\n *\n * This schema provides runtime validation and type inference.\n * * Channel presence response.\n * */\nimport { z } from 'zod'\nimport { CentrifugoErrorSchema } from './CentrifugoError.schema'\nimport { CentrifugoPresenceResultSchema } from './CentrifugoPresenceResult.schema'\n\n/**\n * Channel presence response.\n */\nexport const CentrifugoPresenceResponseSchema = z.object({\n error: CentrifugoErrorSchema.optional(),\n result: CentrifugoPresenceResultSchema.optional(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type CentrifugoPresenceResponse = z.infer<typeof CentrifugoPresenceResponseSchema>","/**\n * Zod schema for CentrifugoPresenceResult\n *\n * This schema provides runtime validation and type inference.\n * * Presence result wrapper.\n * */\nimport { z } from 'zod'\nimport { CentrifugoClientInfoSchema } from './CentrifugoClientInfo.schema'\n\n/**\n * Presence result wrapper.\n */\nexport const CentrifugoPresenceResultSchema = z.object({\n presence: z.record(z.string(), CentrifugoClientInfoSchema),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type CentrifugoPresenceResult = z.infer<typeof CentrifugoPresenceResultSchema>","/**\n * Zod schema for CentrifugoPresenceStatsRequestRequest\n *\n * This schema provides runtime validation and type inference.\n * * Request to get channel presence statistics.\n * */\nimport { z } from 'zod'\n\n/**\n * Request to get channel presence statistics.\n */\nexport const CentrifugoPresenceStatsRequestRequestSchema = z.object({\n channel: z.string(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type CentrifugoPresenceStatsRequestRequest = z.infer<typeof CentrifugoPresenceStatsRequestRequestSchema>","/**\n * Zod schema for CentrifugoPresenceStatsResponse\n *\n * This schema provides runtime validation and type inference.\n * * Channel presence stats response.\n * */\nimport { z } from 'zod'\nimport { CentrifugoErrorSchema } from './CentrifugoError.schema'\nimport { CentrifugoPresenceStatsResultSchema } from './CentrifugoPresenceStatsResult.schema'\n\n/**\n * Channel presence stats response.\n */\nexport const CentrifugoPresenceStatsResponseSchema = z.object({\n error: CentrifugoErrorSchema.optional(),\n result: CentrifugoPresenceStatsResultSchema.optional(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type CentrifugoPresenceStatsResponse = z.infer<typeof CentrifugoPresenceStatsResponseSchema>","/**\n * Zod schema for CentrifugoPresenceStatsResult\n *\n * This schema provides runtime validation and type inference.\n * * Presence stats result.\n * */\nimport { z } from 'zod'\n\n/**\n * Presence stats result.\n */\nexport const CentrifugoPresenceStatsResultSchema = z.object({\n num_clients: z.int(),\n num_users: z.int(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type CentrifugoPresenceStatsResult = z.infer<typeof CentrifugoPresenceStatsResultSchema>","/**\n * Zod schema for ChannelList\n *\n * This schema provides runtime validation and type inference.\n * * List of channel statistics.\n * */\nimport { z } from 'zod'\nimport { ChannelStatsSchema } from './ChannelStats.schema'\n\n/**\n * List of channel statistics.\n */\nexport const ChannelListSchema = z.object({\n channels: z.array(ChannelStatsSchema),\n total_channels: z.int(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type ChannelList = z.infer<typeof ChannelListSchema>","/**\n * Zod schema for ChannelStats\n *\n * This schema provides runtime validation and type inference.\n * * Statistics per channel.\n * */\nimport { z } from 'zod'\n\n/**\n * Statistics per channel.\n */\nexport const ChannelStatsSchema = z.object({\n channel: z.string(),\n total: z.int(),\n successful: z.int(),\n failed: z.int(),\n avg_duration_ms: z.number(),\n avg_acks: z.number(),\n last_activity_at: z.string().nullable(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type ChannelStats = z.infer<typeof ChannelStatsSchema>","/**\n * Zod schema for ConnectionTokenResponse\n *\n * This schema provides runtime validation and type inference.\n * * Response model for Centrifugo connection token.\n * */\nimport { z } from 'zod'\n\n/**\n * Response model for Centrifugo connection token.\n */\nexport const ConnectionTokenResponseSchema = z.object({\n token: z.string(),\n centrifugo_url: z.string(),\n expires_at: z.string(),\n channels: z.array(z.string()),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type ConnectionTokenResponse = z.infer<typeof ConnectionTokenResponseSchema>","/**\n * Zod schema for ManualAckRequestRequest\n *\n * This schema provides runtime validation and type inference.\n * * Request model for manual ACK sending.\n * */\nimport { z } from 'zod'\n\n/**\n * Request model for manual ACK sending.\n */\nexport const ManualAckRequestRequestSchema = z.object({\n message_id: z.string(),\n client_id: z.string(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type ManualAckRequestRequest = z.infer<typeof ManualAckRequestRequestSchema>","/**\n * Zod schema for ManualAckResponse\n *\n * This schema provides runtime validation and type inference.\n * * Response model for manual ACK.\n * */\nimport { z } from 'zod'\n\n/**\n * Response model for manual ACK.\n */\nexport const ManualAckResponseSchema = z.object({\n success: z.boolean(),\n message_id: z.string(),\n error: z.string().nullable().optional(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type ManualAckResponse = z.infer<typeof ManualAckResponseSchema>","/**\n * Zod schema for PaginatedPublishList\n *\n * This schema provides runtime validation and type inference.\n * */\nimport { z } from 'zod'\nimport { PublishSchema } from './Publish.schema'\n\nexport const PaginatedPublishListSchema = z.object({\n count: z.int(),\n page: z.int(),\n pages: z.int(),\n page_size: z.int(),\n has_next: z.boolean(),\n has_previous: z.boolean(),\n next_page: z.int().nullable().optional(),\n previous_page: z.int().nullable().optional(),\n results: z.array(PublishSchema),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type PaginatedPublishList = z.infer<typeof PaginatedPublishListSchema>","/**\n * Zod schema for Publish\n *\n * This schema provides runtime validation and type inference.\n * * Single publish item for DRF pagination.\n * */\nimport { z } from 'zod'\n\n/**\n * Single publish item for DRF pagination.\n */\nexport const PublishSchema = z.object({\n message_id: z.string(),\n channel: z.string(),\n status: z.string(),\n wait_for_ack: z.boolean(),\n acks_received: z.int(),\n acks_expected: z.int().nullable(),\n duration_ms: z.number().nullable(),\n created_at: z.iso.datetime(),\n completed_at: z.iso.datetime().nullable(),\n error_code: z.string().nullable(),\n error_message: z.string().nullable(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type Publish = z.infer<typeof PublishSchema>","/**\n * Zod schema for PublishTestRequestRequest\n *\n * This schema provides runtime validation and type inference.\n * * Request model for test message publishing.\n * */\nimport { z } from 'zod'\n\n/**\n * Request model for test message publishing.\n */\nexport const PublishTestRequestRequestSchema = z.object({\n channel: z.string(),\n data: z.record(z.string(), z.any()),\n wait_for_ack: z.boolean().optional(),\n ack_timeout: z.int().min(1.0).max(60.0).optional(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type PublishTestRequestRequest = z.infer<typeof PublishTestRequestRequestSchema>","/**\n * Zod schema for PublishTestResponse\n *\n * This schema provides runtime validation and type inference.\n * * Response model for test message publishing.\n * */\nimport { z } from 'zod'\n\n/**\n * Response model for test message publishing.\n */\nexport const PublishTestResponseSchema = z.object({\n success: z.boolean(),\n message_id: z.string(),\n channel: z.string(),\n acks_received: z.int().optional(),\n delivered: z.boolean().optional(),\n error: z.string().nullable().optional(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type PublishTestResponse = z.infer<typeof PublishTestResponseSchema>","/**\n * Zod schema for TimelineItem\n *\n * This schema provides runtime validation and type inference.\n * * Single timeline data point for DRF.\n * */\nimport { z } from 'zod'\n\n/**\n * Single timeline data point for DRF.\n */\nexport const TimelineItemSchema = z.object({\n timestamp: z.string(),\n count: z.int(),\n successful: z.int(),\n failed: z.int(),\n timeout: z.int(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type TimelineItem = z.infer<typeof TimelineItemSchema>","/**\n * Zod schema for TimelineResponse\n *\n * This schema provides runtime validation and type inference.\n * * Timeline response with hourly/daily breakdown for DRF.\n * */\nimport { z } from 'zod'\nimport { TimelineItemSchema } from './TimelineItem.schema'\n\n/**\n * Timeline response with hourly/daily breakdown for DRF.\n */\nexport const TimelineResponseSchema = z.object({\n timeline: z.array(TimelineItemSchema),\n period_hours: z.int(),\n interval: z.string(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type TimelineResponse = z.infer<typeof TimelineResponseSchema>","// Auto-generated by DjangoCFG - see CLAUDE.md\n/**\n * Typed fetchers for Centrifugo Admin API\n *\n * Universal functions that work in any environment:\n * - Next.js (App Router / Pages Router / Server Components)\n * - React Native\n * - Node.js backend\n *\n * These fetchers use Zod schemas for runtime validation.\n *\n * Usage:\n * ```typescript\n * // Configure API once (in your app entry point)\n * import { configureAPI } from '../../api-instance'\n * configureAPI({ baseUrl: 'https://api.example.com' })\n *\n * // Then use fetchers anywhere\n * const users = await getUsers({ page: 1 })\n *\n * // With SWR\n * const { data } = useSWR(['users', params], () => getUsers(params))\n *\n * // With React Query\n * const { data } = useQuery(['users', params], () => getUsers(params))\n *\n * // In Server Component or SSR (pass custom client)\n * import { API } from '../../index'\n * const api = new API('https://api.example.com')\n * const users = await getUsers({ page: 1 }, api)\n * ```\n */\nimport { consola } from 'consola'\nimport { CentrifugoChannelsRequestRequestSchema, type CentrifugoChannelsRequestRequest } from '../schemas/CentrifugoChannelsRequestRequest.schema'\nimport { CentrifugoChannelsResponseSchema, type CentrifugoChannelsResponse } from '../schemas/CentrifugoChannelsResponse.schema'\nimport { CentrifugoHistoryRequestRequestSchema, type CentrifugoHistoryRequestRequest } from '../schemas/CentrifugoHistoryRequestRequest.schema'\nimport { CentrifugoHistoryResponseSchema, type CentrifugoHistoryResponse } from '../schemas/CentrifugoHistoryResponse.schema'\nimport { CentrifugoInfoResponseSchema, type CentrifugoInfoResponse } from '../schemas/CentrifugoInfoResponse.schema'\nimport { CentrifugoPresenceRequestRequestSchema, type CentrifugoPresenceRequestRequest } from '../schemas/CentrifugoPresenceRequestRequest.schema'\nimport { CentrifugoPresenceResponseSchema, type CentrifugoPresenceResponse } from '../schemas/CentrifugoPresenceResponse.schema'\nimport { CentrifugoPresenceStatsRequestRequestSchema, type CentrifugoPresenceStatsRequestRequest } from '../schemas/CentrifugoPresenceStatsRequestRequest.schema'\nimport { CentrifugoPresenceStatsResponseSchema, type CentrifugoPresenceStatsResponse } from '../schemas/CentrifugoPresenceStatsResponse.schema'\nimport { getAPIInstance } from '../../api-instance'\n\n/**\n * Get connection token for dashboard\n *\n * @method POST\n * @path /cfg/centrifugo/server/auth/token/\n */\nexport async function createCentrifugoServerAuthTokenCreate( client?: any\n): Promise<any> {\n const api = client || getAPIInstance()\n const response = await api.centrifugo_admin_api.centrifugoServerAuthTokenCreate()\n return response\n}\n\n\n/**\n * List active channels\n *\n * @method POST\n * @path /cfg/centrifugo/server/channels/\n */\nexport async function createCentrifugoServerChannelsCreate( data: CentrifugoChannelsRequestRequest, client?: any\n): Promise<CentrifugoChannelsResponse> {\n const api = client || getAPIInstance()\n const response = await api.centrifugo_admin_api.centrifugoServerChannelsCreate(data)\n try {\n return CentrifugoChannelsResponseSchema.parse(response)\n } catch (error) {\n // Zod validation error - log detailed information\n consola.error('❌ Zod Validation Failed');\n consola.box(`createCentrifugoServerChannelsCreate\\nPath: /cfg/centrifugo/server/channels/\\nMethod: POST`);\n\n if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {\n consola.error('Validation Issues:');\n (error as any).issues.forEach((issue: any, index: number) => {\n consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);\n consola.error(` ├─ Message: ${issue.message}`);\n if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);\n if (issue.received) consola.error(` └─ Received: ${issue.received}`);\n });\n }\n\n consola.error('Response data:', response);\n\n // Dispatch browser CustomEvent (only if window is defined)\n if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {\n try {\n const event = new CustomEvent('zod-validation-error', {\n detail: {\n operation: 'createCentrifugoServerChannelsCreate',\n path: '/cfg/centrifugo/server/channels/',\n method: 'POST',\n error: error,\n response: response,\n timestamp: new Date(),\n },\n bubbles: true,\n cancelable: false,\n });\n window.dispatchEvent(event);\n } catch (eventError) {\n // Silently fail - event dispatch should never crash the app\n consola.warn('Failed to dispatch validation error event:', eventError);\n }\n }\n\n // Re-throw the error\n throw error;\n }\n}\n\n\n/**\n * Get channel history\n *\n * @method POST\n * @path /cfg/centrifugo/server/history/\n */\nexport async function createCentrifugoServerHistoryCreate( data: CentrifugoHistoryRequestRequest, client?: any\n): Promise<CentrifugoHistoryResponse> {\n const api = client || getAPIInstance()\n const response = await api.centrifugo_admin_api.centrifugoServerHistoryCreate(data)\n try {\n return CentrifugoHistoryResponseSchema.parse(response)\n } catch (error) {\n // Zod validation error - log detailed information\n consola.error('❌ Zod Validation Failed');\n consola.box(`createCentrifugoServerHistoryCreate\\nPath: /cfg/centrifugo/server/history/\\nMethod: POST`);\n\n if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {\n consola.error('Validation Issues:');\n (error as any).issues.forEach((issue: any, index: number) => {\n consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);\n consola.error(` ├─ Message: ${issue.message}`);\n if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);\n if (issue.received) consola.error(` └─ Received: ${issue.received}`);\n });\n }\n\n consola.error('Response data:', response);\n\n // Dispatch browser CustomEvent (only if window is defined)\n if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {\n try {\n const event = new CustomEvent('zod-validation-error', {\n detail: {\n operation: 'createCentrifugoServerHistoryCreate',\n path: '/cfg/centrifugo/server/history/',\n method: 'POST',\n error: error,\n response: response,\n timestamp: new Date(),\n },\n bubbles: true,\n cancelable: false,\n });\n window.dispatchEvent(event);\n } catch (eventError) {\n // Silently fail - event dispatch should never crash the app\n consola.warn('Failed to dispatch validation error event:', eventError);\n }\n }\n\n // Re-throw the error\n throw error;\n }\n}\n\n\n/**\n * Get Centrifugo server info\n *\n * @method POST\n * @path /cfg/centrifugo/server/info/\n */\nexport async function createCentrifugoServerInfoCreate( client?: any\n): Promise<CentrifugoInfoResponse> {\n const api = client || getAPIInstance()\n const response = await api.centrifugo_admin_api.centrifugoServerInfoCreate()\n try {\n return CentrifugoInfoResponseSchema.parse(response)\n } catch (error) {\n // Zod validation error - log detailed information\n consola.error('❌ Zod Validation Failed');\n consola.box(`createCentrifugoServerInfoCreate\\nPath: /cfg/centrifugo/server/info/\\nMethod: POST`);\n\n if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {\n consola.error('Validation Issues:');\n (error as any).issues.forEach((issue: any, index: number) => {\n consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);\n consola.error(` ├─ Message: ${issue.message}`);\n if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);\n if (issue.received) consola.error(` └─ Received: ${issue.received}`);\n });\n }\n\n consola.error('Response data:', response);\n\n // Dispatch browser CustomEvent (only if window is defined)\n if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {\n try {\n const event = new CustomEvent('zod-validation-error', {\n detail: {\n operation: 'createCentrifugoServerInfoCreate',\n path: '/cfg/centrifugo/server/info/',\n method: 'POST',\n error: error,\n response: response,\n timestamp: new Date(),\n },\n bubbles: true,\n cancelable: false,\n });\n window.dispatchEvent(event);\n } catch (eventError) {\n // Silently fail - event dispatch should never crash the app\n consola.warn('Failed to dispatch validation error event:', eventError);\n }\n }\n\n // Re-throw the error\n throw error;\n }\n}\n\n\n/**\n * Get channel presence\n *\n * @method POST\n * @path /cfg/centrifugo/server/presence/\n */\nexport async function createCentrifugoServerPresenceCreate( data: CentrifugoPresenceRequestRequest, client?: any\n): Promise<CentrifugoPresenceResponse> {\n const api = client || getAPIInstance()\n const response = await api.centrifugo_admin_api.centrifugoServerPresenceCreate(data)\n try {\n return CentrifugoPresenceResponseSchema.parse(response)\n } catch (error) {\n // Zod validation error - log detailed information\n consola.error('❌ Zod Validation Failed');\n consola.box(`createCentrifugoServerPresenceCreate\\nPath: /cfg/centrifugo/server/presence/\\nMethod: POST`);\n\n if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {\n consola.error('Validation Issues:');\n (error as any).issues.forEach((issue: any, index: number) => {\n consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);\n consola.error(` ├─ Message: ${issue.message}`);\n if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);\n if (issue.received) consola.error(` └─ Received: ${issue.received}`);\n });\n }\n\n consola.error('Response data:', response);\n\n // Dispatch browser CustomEvent (only if window is defined)\n if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {\n try {\n const event = new CustomEvent('zod-validation-error', {\n detail: {\n operation: 'createCentrifugoServerPresenceCreate',\n path: '/cfg/centrifugo/server/presence/',\n method: 'POST',\n error: error,\n response: response,\n timestamp: new Date(),\n },\n bubbles: true,\n cancelable: false,\n });\n window.dispatchEvent(event);\n } catch (eventError) {\n // Silently fail - event dispatch should never crash the app\n consola.warn('Failed to dispatch validation error event:', eventError);\n }\n }\n\n // Re-throw the error\n throw error;\n }\n}\n\n\n/**\n * Get channel presence statistics\n *\n * @method POST\n * @path /cfg/centrifugo/server/presence-stats/\n */\nexport async function createCentrifugoServerPresenceStatsCreate( data: CentrifugoPresenceStatsRequestRequest, client?: any\n): Promise<CentrifugoPresenceStatsResponse> {\n const api = client || getAPIInstance()\n const response = await api.centrifugo_admin_api.centrifugoServerPresenceStatsCreate(data)\n try {\n return CentrifugoPresenceStatsResponseSchema.parse(response)\n } catch (error) {\n // Zod validation error - log detailed information\n consola.error('❌ Zod Validation Failed');\n consola.box(`createCentrifugoServerPresenceStatsCreate\\nPath: /cfg/centrifugo/server/presence-stats/\\nMethod: POST`);\n\n if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {\n consola.error('Validation Issues:');\n (error as any).issues.forEach((issue: any, index: number) => {\n consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);\n consola.error(` ├─ Message: ${issue.message}`);\n if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);\n if (issue.received) consola.error(` └─ Received: ${issue.received}`);\n });\n }\n\n consola.error('Response data:', response);\n\n // Dispatch browser CustomEvent (only if window is defined)\n if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {\n try {\n const event = new CustomEvent('zod-validation-error', {\n detail: {\n operation: 'createCentrifugoServerPresenceStatsCreate',\n path: '/cfg/centrifugo/server/presence-stats/',\n method: 'POST',\n error: error,\n response: response,\n timestamp: new Date(),\n },\n bubbles: true,\n cancelable: false,\n });\n window.dispatchEvent(event);\n } catch (eventError) {\n // Silently fail - event dispatch should never crash the app\n consola.warn('Failed to dispatch validation error event:', eventError);\n }\n }\n\n // Re-throw the error\n throw error;\n }\n}\n\n\n","// Auto-generated by DjangoCFG - see CLAUDE.md\n/**\n * Typed fetchers for Centrifugo Auth\n *\n * Universal functions that work in any environment:\n * - Next.js (App Router / Pages Router / Server Components)\n * - React Native\n * - Node.js backend\n *\n * These fetchers use Zod schemas for runtime validation.\n *\n * Usage:\n * ```typescript\n * // Configure API once (in your app entry point)\n * import { configureAPI } from '../../api-instance'\n * configureAPI({ baseUrl: 'https://api.example.com' })\n *\n * // Then use fetchers anywhere\n * const users = await getUsers({ page: 1 })\n *\n * // With SWR\n * const { data } = useSWR(['users', params], () => getUsers(params))\n *\n * // With React Query\n * const { data } = useQuery(['users', params], () => getUsers(params))\n *\n * // In Server Component or SSR (pass custom client)\n * import { API } from '../../index'\n * const api = new API('https://api.example.com')\n * const users = await getUsers({ page: 1 }, api)\n * ```\n */\nimport { consola } from 'consola'\nimport { ConnectionTokenResponseSchema, type ConnectionTokenResponse } from '../schemas/ConnectionTokenResponse.schema'\nimport { getAPIInstance } from '../../api-instance'\n\n/**\n * Get Centrifugo connection token\n *\n * @method GET\n * @path /cfg/centrifugo/auth/token/\n */\nexport async function getCentrifugoAuthTokenRetrieve( client?: any\n): Promise<ConnectionTokenResponse> {\n const api = client || getAPIInstance()\n const response = await api.centrifugo_auth.tokenRetrieve()\n try {\n return ConnectionTokenResponseSchema.parse(response)\n } catch (error) {\n // Zod validation error - log detailed information\n consola.error('❌ Zod Validation Failed');\n consola.box(`getCentrifugoAuthTokenRetrieve\\nPath: /cfg/centrifugo/auth/token/\\nMethod: GET`);\n\n if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {\n consola.error('Validation Issues:');\n (error as any).issues.forEach((issue: any, index: number) => {\n consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);\n consola.error(` ├─ Message: ${issue.message}`);\n if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);\n if (issue.received) consola.error(` └─ Received: ${issue.received}`);\n });\n }\n\n consola.error('Response data:', response);\n\n // Dispatch browser CustomEvent (only if window is defined)\n if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {\n try {\n const event = new CustomEvent('zod-validation-error', {\n detail: {\n operation: 'getCentrifugoAuthTokenRetrieve',\n path: '/cfg/centrifugo/auth/token/',\n method: 'GET',\n error: error,\n response: response,\n timestamp: new Date(),\n },\n bubbles: true,\n cancelable: false,\n });\n window.dispatchEvent(event);\n } catch (eventError) {\n // Silently fail - event dispatch should never crash the app\n consola.warn('Failed to dispatch validation error event:', eventError);\n }\n }\n\n // Re-throw the error\n throw error;\n }\n}\n\n\n","// Auto-generated by DjangoCFG - see CLAUDE.md\n/**\n * Typed fetchers for Centrifugo Monitoring\n *\n * Universal functions that work in any environment:\n * - Next.js (App Router / Pages Router / Server Components)\n * - React Native\n * - Node.js backend\n *\n * These fetchers use Zod schemas for runtime validation.\n *\n * Usage:\n * ```typescript\n * // Configure API once (in your app entry point)\n * import { configureAPI } from '../../api-instance'\n * configureAPI({ baseUrl: 'https://api.example.com' })\n *\n * // Then use fetchers anywhere\n * const users = await getUsers({ page: 1 })\n *\n * // With SWR\n * const { data } = useSWR(['users', params], () => getUsers(params))\n *\n * // With React Query\n * const { data } = useQuery(['users', params], () => getUsers(params))\n *\n * // In Server Component or SSR (pass custom client)\n * import { API } from '../../index'\n * const api = new API('https://api.example.com')\n * const users = await getUsers({ page: 1 }, api)\n * ```\n */\nimport { consola } from 'consola'\nimport { CentrifugoHealthCheckSchema, type CentrifugoHealthCheck } from '../schemas/CentrifugoHealthCheck.schema'\nimport { CentrifugoOverviewStatsSchema, type CentrifugoOverviewStats } from '../schemas/CentrifugoOverviewStats.schema'\nimport { ChannelListSchema, type ChannelList } from '../schemas/ChannelList.schema'\nimport { PaginatedPublishListSchema, type PaginatedPublishList } from '../schemas/PaginatedPublishList.schema'\nimport { TimelineResponseSchema, type TimelineResponse } from '../schemas/TimelineResponse.schema'\nimport { getAPIInstance } from '../../api-instance'\n\n/**\n * Get channel statistics\n *\n * @method GET\n * @path /cfg/centrifugo/monitor/channels/\n */\nexport async function getCentrifugoMonitorChannelsRetrieve( params?: { hours?: number }, client?: any\n): Promise<ChannelList> {\n const api = client || getAPIInstance()\n const response = await api.centrifugo_monitoring.centrifugoMonitorChannelsRetrieve(params?.hours)\n try {\n return ChannelListSchema.parse(response)\n } catch (error) {\n // Zod validation error - log detailed information\n consola.error('❌ Zod Validation Failed');\n consola.box(`getCentrifugoMonitorChannelsRetrieve\\nPath: /cfg/centrifugo/monitor/channels/\\nMethod: GET`);\n\n if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {\n consola.error('Validation Issues:');\n (error as any).issues.forEach((issue: any, index: number) => {\n consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);\n consola.error(` ├─ Message: ${issue.message}`);\n if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);\n if (issue.received) consola.error(` └─ Received: ${issue.received}`);\n });\n }\n\n consola.error('Response data:', response);\n\n // Dispatch browser CustomEvent (only if window is defined)\n if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {\n try {\n const event = new CustomEvent('zod-validation-error', {\n detail: {\n operation: 'getCentrifugoMonitorChannelsRetrieve',\n path: '/cfg/centrifugo/monitor/channels/',\n method: 'GET',\n error: error,\n response: response,\n timestamp: new Date(),\n },\n bubbles: true,\n cancelable: false,\n });\n window.dispatchEvent(event);\n } catch (eventError) {\n // Silently fail - event dispatch should never crash the app\n consola.warn('Failed to dispatch validation error event:', eventError);\n }\n }\n\n // Re-throw the error\n throw error;\n }\n}\n\n\n/**\n * Get Centrifugo health status\n *\n * @method GET\n * @path /cfg/centrifugo/monitor/health/\n */\nexport async function getCentrifugoMonitorHealthRetrieve( client?: any\n): Promise<CentrifugoHealthCheck> {\n const api = client || getAPIInstance()\n const response = await api.centrifugo_monitoring.centrifugoMonitorHealthRetrieve()\n try {\n return CentrifugoHealthCheckSchema.parse(response)\n } catch (error) {\n // Zod validation error - log detailed information\n consola.error('❌ Zod Validation Failed');\n consola.box(`getCentrifugoMonitorHealthRetrieve\\nPath: /cfg/centrifugo/monitor/health/\\nMethod: GET`);\n\n if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {\n consola.error('Validation Issues:');\n (error as any).issues.forEach((issue: any, index: number) => {\n consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);\n consola.error(` ├─ Message: ${issue.message}`);\n if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);\n if (issue.received) consola.error(` └─ Received: ${issue.received}`);\n });\n }\n\n consola.error('Response data:', response);\n\n // Dispatch browser CustomEvent (only if window is defined)\n if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {\n try {\n const event = new CustomEvent('zod-validation-error', {\n detail: {\n operation: 'getCentrifugoMonitorHealthRetrieve',\n path: '/cfg/centrifugo/monitor/health/',\n method: 'GET',\n error: error,\n response: response,\n timestamp: new Date(),\n },\n bubbles: true,\n cancelable: false,\n });\n window.dispatchEvent(event);\n } catch (eventError) {\n // Silently fail - event dispatch should never crash the app\n consola.warn('Failed to dispatch validation error event:', eventError);\n }\n }\n\n // Re-throw the error\n throw error;\n }\n}\n\n\n/**\n * Get overview statistics\n *\n * @method GET\n * @path /cfg/centrifugo/monitor/overview/\n */\nexport async function getCentrifugoMonitorOverviewRetrieve( params?: { hours?: number }, client?: any\n): Promise<CentrifugoOverviewStats> {\n const api = client || getAPIInstance()\n const response = await api.centrifugo_monitoring.centrifugoMonitorOverviewRetrieve(params?.hours)\n try {\n return CentrifugoOverviewStatsSchema.parse(response)\n } catch (error) {\n // Zod validation error - log detailed information\n consola.error('❌ Zod Validation Failed');\n consola.box(`getCentrifugoMonitorOverviewRetrieve\\nPath: /cfg/centrifugo/monitor/overview/\\nMethod: GET`);\n\n if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {\n consola.error('Validation Issues:');\n (error as any).issues.forEach((issue: any, index: number) => {\n consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);\n consola.error(` ├─ Message: ${issue.message}`);\n if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);\n if (issue.received) consola.error(` └─ Received: ${issue.received}`);\n });\n }\n\n consola.error('Response data:', response);\n\n // Dispatch browser CustomEvent (only if window is defined)\n if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {\n try {\n const event = new CustomEvent('zod-validation-error', {\n detail: {\n operation: 'getCentrifugoMonitorOverviewRetrieve',\n path: '/cfg/centrifugo/monitor/overview/',\n method: 'GET',\n error: error,\n response: response,\n timestamp: new Date(),\n },\n bubbles: true,\n cancelable: false,\n });\n window.dispatchEvent(event);\n } catch (eventError) {\n // Silently fail - event dispatch should never crash the app\n consola.warn('Failed to dispatch validation error event:', eventError);\n }\n }\n\n // Re-throw the error\n throw error;\n }\n}\n\n\n/**\n * Get recent publishes\n *\n * @method GET\n * @path /cfg/centrifugo/monitor/publishes/\n */\nexport async function getCentrifugoMonitorPublishesList( params?: { channel?: string; page?: number; page_size?: number; status?: string }, client?: any\n): Promise<PaginatedPublishList> {\n const api = client || getAPIInstance()\n const response = await api.centrifugo_monitoring.centrifugoMonitorPublishesList(params?.channel, params?.page, params?.page_size, params?.status)\n try {\n return PaginatedPublishListSchema.parse(response)\n } catch (error) {\n // Zod validation error - log detailed information\n consola.error('❌ Zod Validation Failed');\n consola.box(`getCentrifugoMonitorPublishesList\\nPath: /cfg/centrifugo/monitor/publishes/\\nMethod: GET`);\n\n if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {\n consola.error('Validation Issues:');\n (error as any).issues.forEach((issue: any, index: number) => {\n consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);\n consola.error(` ├─ Message: ${issue.message}`);\n if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);\n if (issue.received) consola.error(` └─ Received: ${issue.received}`);\n });\n }\n\n consola.error('Response data:', response);\n\n // Dispatch browser CustomEvent (only if window is defined)\n if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {\n try {\n const event = new CustomEvent('zod-validation-error', {\n detail: {\n operation: 'getCentrifugoMonitorPublishesList',\n path: '/cfg/centrifugo/monitor/publishes/',\n method: 'GET',\n error: error,\n response: response,\n timestamp: new Date(),\n },\n bubbles: true,\n cancelable: false,\n });\n window.dispatchEvent(event);\n } catch (eventError) {\n // Silently fail - event dispatch should never crash the app\n consola.warn('Failed to dispatch validation error event:', eventError);\n }\n }\n\n // Re-throw the error\n throw error;\n }\n}\n\n\n/**\n * Get publish timeline\n *\n * @method GET\n * @path /cfg/centrifugo/monitor/timeline/\n */\nexport async function getCentrifugoMonitorTimelineRetrieve( params?: { hours?: number; interval?: string }, client?: any\n): Promise<TimelineResponse> {\n const api = client || getAPIInstance()\n const response = await api.centrifugo_monitoring.centrifugoMonitorTimelineRetrieve(params?.hours, params?.interval)\n try {\n return TimelineResponseSchema.parse(response)\n } catch (error) {\n // Zod validation error - log detailed information\n consola.error('❌ Zod Validation Failed');\n consola.box(`getCentrifugoMonitorTimelineRetrieve\\nPath: /cfg/centrifugo/monitor/timeline/\\nMethod: GET`);\n\n if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {\n consola.error('Validation Issues:');\n (error as any).issues.forEach((issue: any, index: number) => {\n consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);\n consola.error(` ├─ Message: ${issue.message}`);\n if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);\n if (issue.received) consola.error(` └─ Received: ${issue.received}`);\n });\n }\n\n consola.error('Response data:', response);\n\n // Dispatch browser CustomEvent (only if window is defined)\n if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {\n try {\n const event = new CustomEvent('zod-validation-error', {\n detail: {\n operation: 'getCentrifugoMonitorTimelineRetrieve',\n path: '/cfg/centrifugo/monitor/timeline/',\n method: 'GET',\n error: error,\n response: response,\n timestamp: new Date(),\n },\n bubbles: true,\n cancelable: false,\n });\n window.dispatchEvent(event);\n } catch (eventError) {\n // Silently fail - event dispatch should never crash the app\n consola.warn('Failed to dispatch validation error event:', eventError);\n }\n }\n\n // Re-throw the error\n throw error;\n }\n}\n\n\n","// Auto-generated by DjangoCFG - see CLAUDE.md\n/**\n * Typed fetchers for Centrifugo Testing\n *\n * Universal functions that work in any environment:\n * - Next.js (App Router / Pages Router / Server Components)\n * - React Native\n * - Node.js backend\n *\n * These fetchers use Zod schemas for runtime validation.\n *\n * Usage:\n * ```typescript\n * // Configure API once (in your app entry point)\n * import { configureAPI } from '../../api-instance'\n * configureAPI({ baseUrl: 'https://api.example.com' })\n *\n * // Then use fetchers anywhere\n * const users = await getUsers({ page: 1 })\n *\n * // With SWR\n * const { data } = useSWR(['users', params], () => getUsers(params))\n *\n * // With React Query\n * const { data } = useQuery(['users', params], () => getUsers(params))\n *\n * // In Server Component or SSR (pass custom client)\n * import { API } from '../../index'\n * const api = new API('https://api.example.com')\n * const users = await getUsers({ page: 1 }, api)\n * ```\n */\nimport { consola } from 'consola'\nimport { ManualAckRequestRequestSchema, type ManualAckRequestRequest } from '../schemas/ManualAckRequestRequest.schema'\nimport { ManualAckResponseSchema, type ManualAckResponse } from '../schemas/ManualAckResponse.schema'\nimport { PublishTestRequestRequestSchema, type PublishTestRequestRequest } from '../schemas/PublishTestRequestRequest.schema'\nimport { PublishTestResponseSchema, type PublishTestResponse } from '../schemas/PublishTestResponse.schema'\nimport { getAPIInstance } from '../../api-instance'\n\n/**\n * Publish test message\n *\n * @method POST\n * @path /cfg/centrifugo/testing/publish-test/\n */\nexport async function createCentrifugoTestingPublishTestCreate( data: PublishTestRequestRequest, client?: any\n): Promise<PublishTestResponse> {\n const api = client || getAPIInstance()\n const response = await api.centrifugo_testing.publishTestCreate(data)\n try {\n return PublishTestResponseSchema.parse(response)\n } catch (error) {\n // Zod validation error - log detailed information\n consola.error('❌ Zod Validation Failed');\n consola.box(`createCentrifugoTestingPublishTestCreate\\nPath: /cfg/centrifugo/testing/publish-test/\\nMethod: POST`);\n\n if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {\n consola.error('Validation Issues:');\n (error as any).issues.forEach((issue: any, index: number) => {\n consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);\n consola.error(` ├─ Message: ${issue.message}`);\n if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);\n if (issue.received) consola.error(` └─ Received: ${issue.received}`);\n });\n }\n\n consola.error('Response data:', response);\n\n // Dispatch browser CustomEvent (only if window is defined)\n if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {\n try {\n const event = new CustomEvent('zod-validation-error', {\n detail: {\n operation: 'createCentrifugoTestingPublishTestCreate',\n path: '/cfg/centrifugo/testing/publish-test/',\n method: 'POST',\n error: error,\n response: response,\n timestamp: new Date(),\n },\n bubbles: true,\n cancelable: false,\n });\n window.dispatchEvent(event);\n } catch (eventError) {\n // Silently fail - event dispatch should never crash the app\n consola.warn('Failed to dispatch validation error event:', eventError);\n }\n }\n\n // Re-throw the error\n throw error;\n }\n}\n\n\n/**\n * Publish with database logging\n *\n * @method POST\n * @path /cfg/centrifugo/testing/publish-with-logging/\n */\nexport async function createCentrifugoTestingPublishWithLoggingCreate( data: PublishTestRequestRequest, client?: any\n): Promise<PublishTestResponse> {\n const api = client || getAPIInstance()\n const response = await api.centrifugo_testing.publishWithLoggingCreate(data)\n try {\n return PublishTestResponseSchema.parse(response)\n } catch (error) {\n // Zod validation error - log detailed information\n consola.error('❌ Zod Validation Failed');\n consola.box(`createCentrifugoTestingPublishWithLoggingCreate\\nPath: /cfg/centrifugo/testing/publish-with-logging/\\nMethod: POST`);\n\n if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {\n consola.error('Validation Issues:');\n (error as any).issues.forEach((issue: any, index: number) => {\n consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);\n consola.error(` ├─ Message: ${issue.message}`);\n if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);\n if (issue.received) consola.error(` └─ Received: ${issue.received}`);\n });\n }\n\n consola.error('Response data:', response);\n\n // Dispatch browser CustomEvent (only if window is defined)\n if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {\n try {\n const event = new CustomEvent('zod-validation-error', {\n detail: {\n operation: 'createCentrifugoTestingPublishWithLoggingCreate',\n path: '/cfg/centrifugo/testing/publish-with-logging/',\n method: 'POST',\n error: error,\n response: response,\n timestamp: new Date(),\n },\n bubbles: true,\n cancelable: false,\n });\n window.dispatchEvent(event);\n } catch (eventError) {\n // Silently fail - event dispatch should never crash the app\n consola.warn('Failed to dispatch validation error event:', eventError);\n }\n }\n\n // Re-throw the error\n throw error;\n }\n}\n\n\n/**\n * Send manual ACK\n *\n * @method POST\n * @path /cfg/centrifugo/testing/send-ack/\n */\nexport async function createCentrifugoTestingSendAckCreate( data: ManualAckRequestRequest, client?: any\n): Promise<ManualAckResponse> {\n const api = client || getAPIInstance()\n const response = await api.centrifugo_testing.sendAckCreate(data)\n try {\n return ManualAckResponseSchema.parse(response)\n } catch (error) {\n // Zod validation error - log detailed information\n consola.error('❌ Zod Validation Failed');\n consola.box(`createCentrifugoTestingSendAckCreate\\nPath: /cfg/centrifugo/testing/send-ack/\\nMethod: POST`);\n\n if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {\n consola.error('Validation Issues:');\n (error as any).issues.forEach((issue: any, index: number) => {\n consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);\n consola.error(` ├─ Message: ${issue.message}`);\n if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);\n if (issue.received) consola.error(` └─ Received: ${issue.received}`);\n });\n }\n\n consola.error('Response data:', response);\n\n // Dispatch browser CustomEvent (only if window is defined)\n if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {\n try {\n const event = new CustomEvent('zod-validation-error', {\n detail: {\n operation: 'createCentrifugoTestingSendAckCreate',\n path: '/cfg/centrifugo/testing/send-ack/',\n method: 'POST',\n error: error,\n response: response,\n timestamp: new Date(),\n },\n bubbles: true,\n cancelable: false,\n });\n window.dispatchEvent(event);\n } catch (eventError) {\n // Silently fail - event dispatch should never crash the app\n consola.warn('Failed to dispatch validation error event:', eventError);\n }\n }\n\n // Re-throw the error\n throw error;\n }\n}\n\n\n","// Auto-generated by DjangoCFG - see CLAUDE.md\n/**\n * Django CFG API - API Client with JWT Management\n *\n * Usage:\n * ```typescript\n * import { API } from './api';\n *\n * const api = new API('https://api.example.com');\n *\n * // Set JWT token\n * api.setToken('your-jwt-token', 'refresh-token');\n *\n * // Use API\n * const posts = await api.posts.list();\n * const user = await api.users.retrieve(1);\n *\n * // Check authentication\n * if (api.isAuthenticated()) {\n * // ...\n * }\n *\n * // Custom storage with logging (for Electron/Node.js)\n * import { MemoryStorageAdapter, APILogger } from './storage';\n * const logger = new APILogger({ enabled: true, logLevel: 'debug' });\n * const api = new API('https://api.example.com', {\n * storage: new MemoryStorageAdapter(logger),\n * loggerConfig: { enabled: true, logLevel: 'debug' }\n * });\n *\n * // Get OpenAPI schema\n * const schema = api.getSchema();\n * ```\n */\n\nimport { APIClient } from \"./client\";\nimport {\n StorageAdapter,\n LocalStorageAdapter,\n CookieStorageAdapter,\n MemoryStorageAdapter\n} from \"./storage\";\nimport type { RetryConfig } from \"./retry\";\nimport type { LoggerConfig } from \"./logger\";\nimport { APILogger } from \"./logger\";\nimport { CentrifugoAdminApi } from \"./centrifugo__centrifugo_admin_api/client\";\nimport { CentrifugoAuth } from \"./centrifugo__centrifugo_auth/client\";\nimport { CentrifugoMonitoring } from \"./centrifugo__centrifugo_monitoring/client\";\nimport { CentrifugoTesting } from \"./centrifugo__centrifugo_testing/client\";\nexport * as CentrifugoAdminApiTypes from \"./centrifugo__centrifugo_admin_api/models\";\n// Note: Direct exports (export * from) are removed to avoid duplicate type conflicts\n// Use namespace exports like CfgAccountsTypes.User or import from specific modules\nexport * as CentrifugoAuthTypes from \"./centrifugo__centrifugo_auth/models\";\n// Note: Direct exports (export * from) are removed to avoid duplicate type conflicts\n// Use namespace exports like CfgAccountsTypes.User or import from specific modules\nexport * as CentrifugoMonitoringTypes from \"./centrifugo__centrifugo_monitoring/models\";\n// Note: Direct exports (export * from) are removed to avoid duplicate type conflicts\n// Use namespace exports like CfgAccountsTypes.User or import from specific modules\nexport * as CentrifugoTestingTypes from \"./centrifugo__centrifugo_testing/models\";\n// Note: Direct exports (export * from) are removed to avoid duplicate type conflicts\n// Use namespace exports like CfgAccountsTypes.User or import from specific modules\n\n// Re-export Zod schemas for runtime validation\nexport * as Schemas from \"./_utils/schemas\";\n// Also export all schemas directly for convenience\nexport * from \"./_utils/schemas\";\n\n// Re-export Zod validation events for browser integration\nexport type { ValidationErrorDetail, ValidationErrorEvent } from \"./validation-events\";\nexport { dispatchValidationError, onValidationError, formatZodError } from \"./validation-events\";\n\n// Re-export typed fetchers for universal usage\nexport * as Fetchers from \"./_utils/fetchers\";\nexport * from \"./_utils/fetchers\";\n\n// Re-export API instance configuration functions\nexport {\n configureAPI,\n getAPIInstance,\n reconfigureAPI,\n clearAPITokens,\n resetAPI,\n isAPIConfigured\n} from \"./api-instance\";\n// NOTE: SWR hooks are generated in ./_utils/hooks/ but NOT exported here to keep\n// the main bundle server-safe. Import hooks directly from the hooks directory:\n// import { useUsers } from './_utils/hooks';\n// Or use a separate entry point like '@djangocfg/api/hooks' for client components.\n\n// Re-export core client\nexport { APIClient };\n\n// Re-export storage adapters for convenience\nexport type { StorageAdapter };\nexport { LocalStorageAdapter, CookieStorageAdapter, MemoryStorageAdapter };\n\n// Re-export error classes for convenience\nexport { APIError, NetworkError } from \"./errors\";\n\n// Re-export HTTP adapters for custom implementations\nexport type { HttpClientAdapter, HttpRequest, HttpResponse } from \"./http\";\nexport { FetchAdapter } from \"./http\";\n\n// Re-export logger types and classes\nexport type { LoggerConfig, RequestLog, ResponseLog, ErrorLog } from \"./logger\";\nexport { APILogger } from \"./logger\";\n\n// Re-export retry configuration and utilities\nexport type { RetryConfig, FailedAttemptInfo } from \"./retry\";\nexport { withRetry, shouldRetry, DEFAULT_RETRY_CONFIG } from \"./retry\";\n\nexport const TOKEN_KEY = \"auth_token\";\nexport const REFRESH_TOKEN_KEY = \"refresh_token\";\n\nexport interface APIOptions {\n /** Custom storage adapter (defaults to LocalStorageAdapter) */\n storage?: StorageAdapter;\n /** Retry configuration for failed requests */\n retryConfig?: RetryConfig;\n /** Logger configuration */\n loggerConfig?: Partial<LoggerConfig>;\n}\n\nexport class API {\n private baseUrl: string;\n private _client: APIClient;\n private _token: string | null = null;\n private _refreshToken: string | null = null;\n private storage: StorageAdapter;\n private options?: APIOptions;\n\n // Sub-clients\n public centrifugo_admin_api!: CentrifugoAdminApi;\n public centrifugo_auth!: CentrifugoAuth;\n public centrifugo_monitoring!: CentrifugoMonitoring;\n public centrifugo_testing!: CentrifugoTesting;\n\n constructor(baseUrl: string, options?: APIOptions) {\n this.baseUrl = baseUrl;\n this.options = options;\n\n // Create logger if config provided\n const logger = options?.loggerConfig ? new APILogger(options.loggerConfig) : undefined;\n\n // Initialize storage with logger\n this.storage = options?.storage || new LocalStorageAdapter(logger);\n\n this._loadTokensFromStorage();\n\n // Initialize APIClient\n this._client = new APIClient(this.baseUrl, {\n retryConfig: this.options?.retryConfig,\n loggerConfig: this.options?.loggerConfig,\n });\n\n // Always inject auth header wrapper (reads token dynamically from storage)\n this._injectAuthHeader();\n\n // Initialize sub-clients from APIClient\n this.centrifugo_admin_api = this._client.centrifugo_admin_api;\n this.centrifugo_auth = this._client.centrifugo_auth;\n this.centrifugo_monitoring = this._client.centrifugo_monitoring;\n this.centrifugo_testing = this._client.centrifugo_testing;\n }\n\n private _loadTokensFromStorage(): void {\n this._token = this.storage.getItem(TOKEN_KEY);\n this._refreshToken = this.storage.getItem(REFRESH_TOKEN_KEY);\n }\n\n private _reinitClients(): void {\n this._client = new APIClient(this.baseUrl, {\n retryConfig: this.options?.retryConfig,\n loggerConfig: this.options?.loggerConfig,\n });\n\n // Always inject auth header wrapper (reads token dynamically from storage)\n this._injectAuthHeader();\n\n // Reinitialize sub-clients\n this.centrifugo_admin_api = this._client.centrifugo_admin_api;\n this.centrifugo_auth = this._client.centrifugo_auth;\n this.centrifugo_monitoring = this._client.centrifugo_monitoring;\n this.centrifugo_testing = this._client.centrifugo_testing;\n }\n\n private _injectAuthHeader(): void {\n // Override request method to inject auth header\n const originalRequest = this._client.request.bind(this._client);\n this._client.request = async <T>(\n method: string,\n path: string,\n options?: { params?: Record<string, any>; body?: any; formData?: FormData; headers?: Record<string, string> }\n ): Promise<T> => {\n // Read token from storage dynamically (supports JWT injection after instantiation)\n const token = this.getToken();\n const mergedOptions = {\n ...options,\n headers: {\n ...(options?.headers || {}),\n ...(token ? { 'Authorization': `Bearer ${token}` } : {}),\n },\n };\n\n return originalRequest(method, path, mergedOptions);\n };\n }\n\n /**\n * Get current JWT token\n */\n getToken(): string | null {\n return this.storage.getItem(TOKEN_KEY);\n }\n\n /**\n * Get current refresh token\n */\n getRefreshToken(): string | null {\n return this.storage.getItem(REFRESH_TOKEN_KEY);\n }\n\n /**\n * Set JWT token and refresh token\n * @param token - JWT access token\n * @param refreshToken - JWT refresh token (optional)\n */\n setToken(token: string, refreshToken?: string): void {\n this._token = token;\n this.storage.setItem(TOKEN_KEY, token);\n\n if (refreshToken) {\n this._refreshToken = refreshToken;\n this.storage.setItem(REFRESH_TOKEN_KEY, refreshToken);\n }\n\n // Reinitialize clients with new token\n this._reinitClients();\n }\n\n /**\n * Clear all tokens\n */\n clearTokens(): void {\n this._token = null;\n this._refreshToken = null;\n this.storage.removeItem(TOKEN_KEY);\n this.storage.removeItem(REFRESH_TOKEN_KEY);\n\n // Reinitialize clients without token\n this._reinitClients();\n }\n\n /**\n * Check if user is authenticated\n */\n isAuthenticated(): boolean {\n return !!this.getToken();\n }\n\n /**\n * Update base URL and reinitialize clients\n * @param url - New base URL\n */\n setBaseUrl(url: string): void {\n this.baseUrl = url;\n this._reinitClients();\n }\n\n /**\n * Get current base URL\n */\n getBaseUrl(): string {\n return this.baseUrl;\n }\n\n /**\n * Get OpenAPI schema path\n * @returns Path to the OpenAPI schema JSON file\n *\n * Note: The OpenAPI schema is available in the schema.json file.\n * You can load it dynamically using:\n * ```typescript\n * const schema = await fetch('./schema.json').then(r => r.json());\n * // or using fs in Node.js:\n * // const schema = JSON.parse(fs.readFileSync('./schema.json', 'utf-8'));\n * ```\n */\n getSchemaPath(): string {\n return './schema.json';\n }\n}\n\nexport default API;","import * as Models from \"./models\";\n\n\n/**\n * API endpoints for Web Push.\n */\nexport class WebPush {\n private client: any;\n\n constructor(client: any) {\n this.client = client;\n }\n\n /**\n * Send push notification\n * \n * Send push notification to all active subscriptions for the authenticated\n * user.\n */\n async webpushSendCreate(data: Models.SendPushRequestRequest): Promise<Models.SendPushResponse> {\n const response = await this.client.request('POST', \"/cfg/webpush/send/\", { body: data });\n return response;\n }\n\n /**\n * Subscribe to push notifications\n * \n * Save push subscription from browser for the authenticated user.\n */\n async webpushSubscribeCreate(data: Models.SubscribeRequestRequest): Promise<Models.SubscribeResponse> {\n const response = await this.client.request('POST', \"/cfg/webpush/subscribe/\", { body: data });\n return response;\n }\n\n /**\n * Get VAPID public key\n * \n * Get VAPID public key for client subscription.\n */\n async webpushVapidRetrieve(): Promise<Models.VapidPublicKeyResponse> {\n const response = await this.client.request('GET', \"/cfg/webpush/vapid/\");\n return response;\n }\n\n}","// Auto-generated by DjangoCFG - see CLAUDE.md\n/**\n * HTTP Client Adapter Pattern\n *\n * Allows switching between fetch/axios/httpx without changing generated code.\n * Provides unified interface for making HTTP requests.\n */\n\nexport interface HttpRequest {\n method: string;\n url: string;\n headers?: Record<string, string>;\n body?: any;\n params?: Record<string, any>;\n /** FormData for file uploads (multipart/form-data) */\n formData?: FormData;\n}\n\nexport interface HttpResponse<T = any> {\n data: T;\n status: number;\n statusText: string;\n headers: Record<string, string>;\n}\n\n/**\n * HTTP Client Adapter Interface.\n * Implement this to use custom HTTP clients (axios, httpx, etc.)\n */\nexport interface HttpClientAdapter {\n request<T = any>(request: HttpRequest): Promise<HttpResponse<T>>;\n}\n\n/**\n * Default Fetch API adapter.\n * Uses native browser fetch() with proper error handling.\n */\nexport class FetchAdapter implements HttpClientAdapter {\n async request<T = any>(request: HttpRequest): Promise<HttpResponse<T>> {\n const { method, url, headers, body, params, formData } = request;\n\n // Build URL with query params\n let finalUrl = url;\n if (params) {\n const searchParams = new URLSearchParams();\n Object.entries(params).forEach(([key, value]) => {\n if (value !== null && value !== undefined) {\n searchParams.append(key, String(value));\n }\n });\n const queryString = searchParams.toString();\n if (queryString) {\n finalUrl = url.includes('?') ? `${url}&${queryString}` : `${url}?${queryString}`;\n }\n }\n\n // Build headers\n const finalHeaders: Record<string, string> = { ...headers };\n\n // Determine body and content-type\n let requestBody: string | FormData | undefined;\n\n if (formData) {\n // For multipart/form-data, let browser set Content-Type with boundary\n requestBody = formData;\n // Don't set Content-Type - browser will set it with boundary\n } else if (body) {\n // JSON request\n finalHeaders['Content-Type'] = 'application/json';\n requestBody = JSON.stringify(body);\n }\n\n // Make request\n const response = await fetch(finalUrl, {\n method,\n headers: finalHeaders,\n body: requestBody,\n credentials: 'include', // Include Django session cookies\n });\n\n // Parse response\n let data: any = null;\n const contentType = response.headers.get('content-type');\n\n if (response.status !== 204 && contentType?.includes('application/json')) {\n data = await response.json();\n } else if (response.status !== 204) {\n data = await response.text();\n }\n\n // Convert Headers to plain object\n const responseHeaders: Record<string, string> = {};\n response.headers.forEach((value, key) => {\n responseHeaders[key] = value;\n });\n\n return {\n data,\n status: response.status,\n statusText: response.statusText,\n headers: responseHeaders,\n };\n }\n}","// Auto-generated by DjangoCFG - see CLAUDE.md\n/**\n * API Error Classes\n *\n * Typed error classes with Django REST Framework support.\n */\n\n/**\n * HTTP API Error with DRF field-specific validation errors.\n *\n * Usage:\n * ```typescript\n * try {\n * await api.users.create(userData);\n * } catch (error) {\n * if (error instanceof APIError) {\n * if (error.isValidationError) {\n * console.log('Field errors:', error.fieldErrors);\n * // { \"email\": [\"Email already exists\"], \"username\": [\"Required\"] }\n * }\n * }\n * }\n * ```\n */\nexport class APIError extends Error {\n constructor(\n public statusCode: number,\n public statusText: string,\n public response: any,\n public url: string,\n message?: string\n ) {\n super(message || `HTTP ${statusCode}: ${statusText}`);\n this.name = 'APIError';\n }\n\n /**\n * Get error details from response.\n * DRF typically returns: { \"detail\": \"Error message\" } or { \"field\": [\"error1\", \"error2\"] }\n */\n get details(): Record<string, any> | null {\n if (typeof this.response === 'object' && this.response !== null) {\n return this.response;\n }\n return null;\n }\n\n /**\n * Get field-specific validation errors from DRF.\n * Returns: { \"field_name\": [\"error1\", \"error2\"], ... }\n */\n get fieldErrors(): Record<string, string[]> | null {\n const details = this.details;\n if (!details) return null;\n\n // DRF typically returns: { \"field\": [\"error1\", \"error2\"] }\n const fieldErrors: Record<string, string[]> = {};\n for (const [key, value] of Object.entries(details)) {\n if (Array.isArray(value)) {\n fieldErrors[key] = value;\n }\n }\n\n return Object.keys(fieldErrors).length > 0 ? fieldErrors : null;\n }\n\n /**\n * Get single error message from DRF.\n * Checks for \"detail\", \"message\", or first field error.\n */\n get errorMessage(): string {\n const details = this.details;\n if (!details) return this.message;\n\n // Check for \"detail\" field (common in DRF)\n if (details.detail) {\n return Array.isArray(details.detail) ? details.detail.join(', ') : String(details.detail);\n }\n\n // Check for \"message\" field\n if (details.message) {\n return String(details.message);\n }\n\n // Return first field error\n const fieldErrors = this.fieldErrors;\n if (fieldErrors) {\n const firstField = Object.keys(fieldErrors)[0];\n if (firstField) {\n return `${firstField}: ${fieldErrors[firstField]?.join(', ')}`;\n }\n }\n\n return this.message;\n }\n\n // Helper methods for common HTTP status codes\n get isValidationError(): boolean { return this.statusCode === 400; }\n get isAuthError(): boolean { return this.statusCode === 401; }\n get isPermissionError(): boolean { return this.statusCode === 403; }\n get isNotFoundError(): boolean { return this.statusCode === 404; }\n get isServerError(): boolean { return this.statusCode >= 500 && this.statusCode < 600; }\n}\n\n/**\n * Network Error (connection failed, timeout, etc.)\n */\nexport class NetworkError extends Error {\n constructor(\n message: string,\n public url: string,\n public originalError?: Error\n ) {\n super(message);\n this.name = 'NetworkError';\n }\n}","// Auto-generated by DjangoCFG - see CLAUDE.md\n/**\n * API Logger with Consola\n * Beautiful console logging for API requests and responses\n *\n * Installation:\n * npm install consola\n */\n\nimport { type ConsolaInstance, createConsola } from 'consola';\n\n/**\n * Request log data\n */\nexport interface RequestLog {\n method: string;\n url: string;\n headers?: Record<string, string>;\n body?: any;\n timestamp: number;\n}\n\n/**\n * Response log data\n */\nexport interface ResponseLog {\n status: number;\n statusText: string;\n data?: any;\n duration: number;\n timestamp: number;\n}\n\n/**\n * Error log data\n */\nexport interface ErrorLog {\n message: string;\n statusCode?: number;\n fieldErrors?: Record<string, string[]>;\n duration: number;\n timestamp: number;\n}\n\n/**\n * Logger configuration\n */\nexport interface LoggerConfig {\n /** Enable logging */\n enabled: boolean;\n /** Log requests */\n logRequests: boolean;\n /** Log responses */\n logResponses: boolean;\n /** Log errors */\n logErrors: boolean;\n /** Log request/response bodies */\n logBodies: boolean;\n /** Log headers (excluding sensitive ones) */\n logHeaders: boolean;\n /** Custom consola instance */\n consola?: ConsolaInstance;\n}\n\n/**\n * Default logger configuration\n */\nconst DEFAULT_CONFIG: LoggerConfig = {\n enabled: process.env.NODE_ENV !== 'production',\n logRequests: true,\n logResponses: true,\n logErrors: true,\n logBodies: true,\n logHeaders: false,\n};\n\n/**\n * Sensitive header names to filter out\n */\nconst SENSITIVE_HEADERS = [\n 'authorization',\n 'cookie',\n 'set-cookie',\n 'x-api-key',\n 'x-csrf-token',\n];\n\n/**\n * API Logger class\n */\nexport class APILogger {\n private config: LoggerConfig;\n private consola: ConsolaInstance;\n\n constructor(config: Partial<LoggerConfig> = {}) {\n this.config = { ...DEFAULT_CONFIG, ...config };\n this.consola = config.consola || createConsola({\n level: this.config.enabled ? 4 : 0,\n });\n }\n\n /**\n * Enable logging\n */\n enable(): void {\n this.config.enabled = true;\n }\n\n /**\n * Disable logging\n */\n disable(): void {\n this.config.enabled = false;\n }\n\n /**\n * Update configuration\n */\n setConfig(config: Partial<LoggerConfig>): void {\n this.config = { ...this.config, ...config };\n }\n\n /**\n * Filter sensitive headers\n */\n private filterHeaders(headers?: Record<string, string>): Record<string, string> {\n if (!headers) return {};\n\n const filtered: Record<string, string> = {};\n Object.keys(headers).forEach((key) => {\n const lowerKey = key.toLowerCase();\n if (SENSITIVE_HEADERS.includes(lowerKey)) {\n filtered[key] = '***';\n } else {\n filtered[key] = headers[key] || '';\n }\n });\n\n return filtered;\n }\n\n /**\n * Log request\n */\n logRequest(request: RequestLog): void {\n if (!this.config.enabled || !this.config.logRequests) return;\n\n const { method, url, headers, body } = request;\n\n this.consola.start(`${method} ${url}`);\n\n if (this.config.logHeaders && headers) {\n this.consola.debug('Headers:', this.filterHeaders(headers));\n }\n\n if (this.config.logBodies && body) {\n this.consola.debug('Body:', body);\n }\n }\n\n /**\n * Log response\n */\n logResponse(request: RequestLog, response: ResponseLog): void {\n if (!this.config.enabled || !this.config.logResponses) return;\n\n const { method, url } = request;\n const { status, statusText, data, duration } = response;\n\n const statusColor = status >= 500 ? 'red'\n : status >= 400 ? 'yellow'\n : status >= 300 ? 'cyan'\n : 'green';\n\n this.consola.success(\n `${method} ${url} ${status} ${statusText} (${duration}ms)`\n );\n\n if (this.config.logBodies && data) {\n this.consola.debug('Response:', data);\n }\n }\n\n /**\n * Log error\n */\n logError(request: RequestLog, error: ErrorLog): void {\n if (!this.config.enabled || !this.config.logErrors) return;\n\n const { method, url } = request;\n const { message, statusCode, fieldErrors, duration } = error;\n\n this.consola.error(\n `${method} ${url} ${statusCode || 'Network'} Error (${duration}ms)`\n );\n\n this.consola.error('Message:', message);\n\n if (fieldErrors && Object.keys(fieldErrors).length > 0) {\n this.consola.error('Field Errors:');\n Object.entries(fieldErrors).forEach(([field, errors]) => {\n errors.forEach((err) => {\n this.consola.error(` • ${field}: ${err}`);\n });\n });\n }\n }\n\n /**\n * Log general info\n */\n info(message: string, ...args: any[]): void {\n if (!this.config.enabled) return;\n this.consola.info(message, ...args);\n }\n\n /**\n * Log warning\n */\n warn(message: string, ...args: any[]): void {\n if (!this.config.enabled) return;\n this.consola.warn(message, ...args);\n }\n\n /**\n * Log error\n */\n error(message: string, ...args: any[]): void {\n if (!this.config.enabled) return;\n this.consola.error(message, ...args);\n }\n\n /**\n * Log debug\n */\n debug(message: string, ...args: any[]): void {\n if (!this.config.enabled) return;\n this.consola.debug(message, ...args);\n }\n\n /**\n * Log success\n */\n success(message: string, ...args: any[]): void {\n if (!this.config.enabled) return;\n this.consola.success(message, ...args);\n }\n\n /**\n * Create a sub-logger with prefix\n */\n withTag(tag: string): ConsolaInstance {\n return this.consola.withTag(tag);\n }\n}\n\n/**\n * Default logger instance\n */\nexport const defaultLogger = new APILogger();","// Auto-generated by DjangoCFG - see CLAUDE.md\n/**\n * Retry Configuration and Utilities\n *\n * Provides automatic retry logic for failed HTTP requests using p-retry.\n * Retries only on network errors and server errors (5xx), not client errors (4xx).\n */\n\nimport pRetry, { AbortError } from 'p-retry';\nimport { APIError, NetworkError } from './errors';\n\n/**\n * Information about a failed retry attempt.\n */\nexport interface FailedAttemptInfo {\n /** The error that caused the failure */\n error: Error;\n /** The attempt number (1-indexed) */\n attemptNumber: number;\n /** Number of retries left */\n retriesLeft: number;\n}\n\n/**\n * Retry configuration options.\n *\n * Uses exponential backoff with jitter by default to avoid thundering herd.\n */\nexport interface RetryConfig {\n /**\n * Maximum number of retry attempts.\n * @default 3\n */\n retries?: number;\n\n /**\n * Exponential backoff factor.\n * @default 2\n */\n factor?: number;\n\n /**\n * Minimum wait time between retries (ms).\n * @default 1000\n */\n minTimeout?: number;\n\n /**\n * Maximum wait time between retries (ms).\n * @default 60000\n */\n maxTimeout?: number;\n\n /**\n * Add randomness to wait times (jitter).\n * Helps avoid thundering herd problem.\n * @default true\n */\n randomize?: boolean;\n\n /**\n * Callback called on each failed attempt.\n */\n onFailedAttempt?: (info: FailedAttemptInfo) => void;\n}\n\n/**\n * Default retry configuration.\n */\nexport const DEFAULT_RETRY_CONFIG: Required<RetryConfig> = {\n retries: 3,\n factor: 2,\n minTimeout: 1000,\n maxTimeout: 60000,\n randomize: true,\n onFailedAttempt: () => {},\n};\n\n/**\n * Determine if an error should trigger a retry.\n *\n * Retries on:\n * - Network errors (connection refused, timeout, etc.)\n * - Server errors (5xx status codes)\n * - Rate limiting (429 status code)\n *\n * Does NOT retry on:\n * - Client errors (4xx except 429)\n * - Authentication errors (401, 403)\n * - Not found (404)\n *\n * @param error - The error to check\n * @returns true if should retry, false otherwise\n */\nexport function shouldRetry(error: any): boolean {\n // Always retry network errors\n if (error instanceof NetworkError) {\n return true;\n }\n\n // For API errors, check status code\n if (error instanceof APIError) {\n const status = error.statusCode;\n\n // Retry on 5xx server errors\n if (status >= 500 && status < 600) {\n return true;\n }\n\n // Retry on 429 (rate limit)\n if (status === 429) {\n return true;\n }\n\n // Do NOT retry on 4xx client errors\n return false;\n }\n\n // Retry on unknown errors (might be network issues)\n return true;\n}\n\n/**\n * Wrap a function with retry logic.\n *\n * @param fn - Async function to retry\n * @param config - Retry configuration\n * @returns Result of the function\n *\n * @example\n * ```typescript\n * const result = await withRetry(\n * async () => fetch('https://api.example.com/users'),\n * { retries: 5, minTimeout: 2000 }\n * );\n * ```\n */\nexport async function withRetry<T>(\n fn: () => Promise<T>,\n config?: RetryConfig\n): Promise<T> {\n const finalConfig = { ...DEFAULT_RETRY_CONFIG, ...config };\n\n return pRetry(\n async () => {\n try {\n return await fn();\n } catch (error) {\n // Check if we should retry this error\n if (!shouldRetry(error)) {\n // Abort retry immediately for non-retryable errors\n throw new AbortError(error as Error);\n }\n\n // Re-throw error to trigger retry\n throw error;\n }\n },\n {\n retries: finalConfig.retries,\n factor: finalConfig.factor,\n minTimeout: finalConfig.minTimeout,\n maxTimeout: finalConfig.maxTimeout,\n randomize: finalConfig.randomize,\n onFailedAttempt: finalConfig.onFailedAttempt ? (error) => {\n // Adapt p-retry's FailedAttemptError to our FailedAttemptInfo\n const pRetryError = error as any; // p-retry's internal type\n finalConfig.onFailedAttempt!({\n error: pRetryError as Error,\n attemptNumber: pRetryError.attemptNumber,\n retriesLeft: pRetryError.retriesLeft,\n });\n } : undefined,\n }\n );\n}","import { WebPush } from \"./webpush__web_push\";\nimport { HttpClientAdapter, FetchAdapter } from \"./http\";\nimport { APIError, NetworkError } from \"./errors\";\nimport { APILogger, type LoggerConfig } from \"./logger\";\nimport { withRetry, type RetryConfig } from \"./retry\";\n\n\n/**\n * Async API client for Django CFG API.\n *\n * Usage:\n * ```typescript\n * const client = new APIClient('https://api.example.com');\n * const users = await client.users.list();\n * const post = await client.posts.create(newPost);\n *\n * // Custom HTTP adapter (e.g., Axios)\n * const client = new APIClient('https://api.example.com', {\n * httpClient: new AxiosAdapter()\n * });\n * ```\n */\nexport class APIClient {\n private baseUrl: string;\n private httpClient: HttpClientAdapter;\n private logger: APILogger | null = null;\n private retryConfig: RetryConfig | null = null;\n\n // Sub-clients\n public web_push: WebPush;\n\n constructor(\n baseUrl: string,\n options?: {\n httpClient?: HttpClientAdapter;\n loggerConfig?: Partial<LoggerConfig>;\n retryConfig?: RetryConfig;\n }\n ) {\n this.baseUrl = baseUrl.replace(/\\/$/, '');\n this.httpClient = options?.httpClient || new FetchAdapter();\n\n // Initialize logger if config provided\n if (options?.loggerConfig !== undefined) {\n this.logger = new APILogger(options.loggerConfig);\n }\n\n // Store retry configuration\n if (options?.retryConfig !== undefined) {\n this.retryConfig = options.retryConfig;\n }\n\n // Initialize sub-clients\n this.web_push = new WebPush(this);\n }\n\n /**\n * Get CSRF token from cookies (for SessionAuthentication).\n *\n * Returns null if cookie doesn't exist (JWT-only auth).\n */\n getCsrfToken(): string | null {\n const name = 'csrftoken';\n const value = `; ${document.cookie}`;\n const parts = value.split(`; ${name}=`);\n if (parts.length === 2) {\n return parts.pop()?.split(';').shift() || null;\n }\n return null;\n }\n\n /**\n * Make HTTP request with Django CSRF and session handling.\n * Automatically retries on network errors and 5xx server errors.\n */\n async request<T>(\n method: string,\n path: string,\n options?: {\n params?: Record<string, any>;\n body?: any;\n formData?: FormData;\n headers?: Record<string, string>;\n }\n ): Promise<T> {\n // Wrap request in retry logic if configured\n if (this.retryConfig) {\n return withRetry(() => this._makeRequest<T>(method, path, options), {\n ...this.retryConfig,\n onFailedAttempt: (info) => {\n // Log retry attempts\n if (this.logger) {\n this.logger.warn(\n `Retry attempt ${info.attemptNumber}/${info.retriesLeft + info.attemptNumber} ` +\n `for ${method} ${path}: ${info.error.message}`\n );\n }\n // Call user's onFailedAttempt if provided\n this.retryConfig?.onFailedAttempt?.(info);\n },\n });\n }\n\n // No retry configured, make request directly\n return this._makeRequest<T>(method, path, options);\n }\n\n /**\n * Internal request method (without retry wrapper).\n * Used by request() method with optional retry logic.\n */\n private async _makeRequest<T>(\n method: string,\n path: string,\n options?: {\n params?: Record<string, any>;\n body?: any;\n formData?: FormData;\n headers?: Record<string, string>;\n }\n ): Promise<T> {\n // Build URL - handle both absolute and relative paths\n // When baseUrl is empty (static builds), path is used as-is (relative to current origin)\n const url = this.baseUrl ? `${this.baseUrl}${path}` : path;\n const startTime = Date.now();\n\n // Build headers - start with custom headers from options\n const headers: Record<string, string> = {\n ...(options?.headers || {})\n };\n\n // Don't set Content-Type for FormData (browser will set it with boundary)\n if (!options?.formData && !headers['Content-Type']) {\n headers['Content-Type'] = 'application/json';\n }\n\n // CSRF not needed - SessionAuthentication not enabled in DRF config\n // Your API uses JWT/Token authentication (no CSRF required)\n\n // Log request\n if (this.logger) {\n this.logger.logRequest({\n method,\n url: url,\n headers,\n body: options?.formData || options?.body,\n timestamp: startTime,\n });\n }\n\n try {\n // Make request via HTTP adapter\n const response = await this.httpClient.request<T>({\n method,\n url: url,\n headers,\n params: options?.params,\n body: options?.body,\n formData: options?.formData,\n });\n\n const duration = Date.now() - startTime;\n\n // Check for HTTP errors\n if (response.status >= 400) {\n const error = new APIError(\n response.status,\n response.statusText,\n response.data,\n url\n );\n\n // Log error\n if (this.logger) {\n this.logger.logError(\n {\n method,\n url: url,\n headers,\n body: options?.formData || options?.body,\n timestamp: startTime,\n },\n {\n message: error.message,\n statusCode: response.status,\n duration,\n timestamp: Date.now(),\n }\n );\n }\n\n throw error;\n }\n\n // Log successful response\n if (this.logger) {\n this.logger.logResponse(\n {\n method,\n url: url,\n headers,\n body: options?.formData || options?.body,\n timestamp: startTime,\n },\n {\n status: response.status,\n statusText: response.statusText,\n data: response.data,\n duration,\n timestamp: Date.now(),\n }\n );\n }\n\n return response.data as T;\n } catch (error) {\n const duration = Date.now() - startTime;\n\n // Re-throw APIError as-is\n if (error instanceof APIError) {\n throw error;\n }\n\n // Detect CORS errors and dispatch event\n const isCORSError = error instanceof TypeError &&\n (error.message.toLowerCase().includes('cors') ||\n error.message.toLowerCase().includes('failed to fetch') ||\n error.message.toLowerCase().includes('network request failed'));\n\n // Log specific error type first\n if (this.logger) {\n if (isCORSError) {\n this.logger.error(`🚫 CORS Error: ${method} ${url}`);\n this.logger.error(` → ${error instanceof Error ? error.message : String(error)}`);\n this.logger.error(` → Configure security_domains parameter on the server`);\n } else {\n this.logger.error(`⚠️ Network Error: ${method} ${url}`);\n this.logger.error(` → ${error instanceof Error ? error.message : String(error)}`);\n }\n }\n\n // Dispatch browser events\n if (typeof window !== 'undefined') {\n try {\n if (isCORSError) {\n // Dispatch CORS-specific error event\n window.dispatchEvent(new CustomEvent('cors-error', {\n detail: {\n url: url,\n method: method,\n error: error instanceof Error ? error.message : String(error),\n timestamp: new Date(),\n },\n bubbles: true,\n cancelable: false,\n }));\n } else {\n // Dispatch generic network error event\n window.dispatchEvent(new CustomEvent('network-error', {\n detail: {\n url: url,\n method: method,\n error: error instanceof Error ? error.message : String(error),\n timestamp: new Date(),\n },\n bubbles: true,\n cancelable: false,\n }));\n }\n } catch (eventError) {\n // Silently fail - event dispatch should never crash the app\n }\n }\n\n // Wrap other errors as NetworkError\n const networkError = error instanceof Error\n ? new NetworkError(error.message, url, error)\n : new NetworkError('Unknown error', url);\n\n // Detailed logging via logger.logError\n if (this.logger) {\n this.logger.logError(\n {\n method,\n url: url,\n headers,\n body: options?.formData || options?.body,\n timestamp: startTime,\n },\n {\n message: networkError.message,\n duration,\n timestamp: Date.now(),\n }\n );\n }\n\n throw networkError;\n }\n }\n}\n","// Auto-generated by DjangoCFG - see CLAUDE.md\n/**\n * Storage adapters for cross-platform token storage.\n *\n * Supports:\n * - LocalStorage (browser)\n * - Cookies (SSR/browser)\n * - Memory (Node.js/Electron/testing)\n */\n\nimport type { APILogger } from './logger';\n\n/**\n * Storage adapter interface for cross-platform token storage.\n */\nexport interface StorageAdapter {\n getItem(key: string): string | null;\n setItem(key: string, value: string): void;\n removeItem(key: string): void;\n}\n\n/**\n * LocalStorage adapter with safe try-catch for browser environments.\n * Works in modern browsers with localStorage support.\n * \n * Note: This adapter uses window.localStorage and should only be used in browser/client environments.\n * For server-side usage, use MemoryStorageAdapter or CookieStorageAdapter instead.\n */\nexport class LocalStorageAdapter implements StorageAdapter {\n private logger?: APILogger;\n\n constructor(logger?: APILogger) {\n this.logger = logger;\n }\n\n getItem(key: string): string | null {\n try {\n if (typeof window !== 'undefined' && window.localStorage) {\n const value = localStorage.getItem(key);\n this.logger?.debug(`LocalStorage.getItem(\"${key}\"): ${value ? 'found' : 'not found'}`);\n return value;\n }\n this.logger?.warn('LocalStorage not available: window.localStorage is undefined');\n } catch (error) {\n this.logger?.error('LocalStorage.getItem failed:', error);\n }\n return null;\n }\n\n setItem(key: string, value: string): void {\n try {\n if (typeof window !== 'undefined' && window.localStorage) {\n localStorage.setItem(key, value);\n this.logger?.debug(`LocalStorage.setItem(\"${key}\"): success`);\n } else {\n this.logger?.warn('LocalStorage not available: window.localStorage is undefined');\n }\n } catch (error) {\n this.logger?.error('LocalStorage.setItem failed:', error);\n }\n }\n\n removeItem(key: string): void {\n try {\n if (typeof window !== 'undefined' && window.localStorage) {\n localStorage.removeItem(key);\n this.logger?.debug(`LocalStorage.removeItem(\"${key}\"): success`);\n } else {\n this.logger?.warn('LocalStorage not available: window.localStorage is undefined');\n }\n } catch (error) {\n this.logger?.error('LocalStorage.removeItem failed:', error);\n }\n }\n}\n\n/**\n * Cookie-based storage adapter for SSR and browser environments.\n * Useful for Next.js, Nuxt.js, and other SSR frameworks.\n */\nexport class CookieStorageAdapter implements StorageAdapter {\n private logger?: APILogger;\n\n constructor(logger?: APILogger) {\n this.logger = logger;\n }\n\n getItem(key: string): string | null {\n try {\n if (typeof document === 'undefined') {\n this.logger?.warn('Cookies not available: document is undefined (SSR context?)');\n return null;\n }\n const value = `; ${document.cookie}`;\n const parts = value.split(`; ${key}=`);\n if (parts.length === 2) {\n const result = parts.pop()?.split(';').shift() || null;\n this.logger?.debug(`CookieStorage.getItem(\"${key}\"): ${result ? 'found' : 'not found'}`);\n return result;\n }\n this.logger?.debug(`CookieStorage.getItem(\"${key}\"): not found`);\n } catch (error) {\n this.logger?.error('CookieStorage.getItem failed:', error);\n }\n return null;\n }\n\n setItem(key: string, value: string): void {\n try {\n if (typeof document !== 'undefined') {\n document.cookie = `${key}=${value}; path=/; max-age=31536000`;\n this.logger?.debug(`CookieStorage.setItem(\"${key}\"): success`);\n } else {\n this.logger?.warn('Cookies not available: document is undefined (SSR context?)');\n }\n } catch (error) {\n this.logger?.error('CookieStorage.setItem failed:', error);\n }\n }\n\n removeItem(key: string): void {\n try {\n if (typeof document !== 'undefined') {\n document.cookie = `${key}=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT`;\n this.logger?.debug(`CookieStorage.removeItem(\"${key}\"): success`);\n } else {\n this.logger?.warn('Cookies not available: document is undefined (SSR context?)');\n }\n } catch (error) {\n this.logger?.error('CookieStorage.removeItem failed:', error);\n }\n }\n}\n\n/**\n * In-memory storage adapter for Node.js, Electron, and testing environments.\n * Data is stored in RAM and cleared when process exits.\n */\nexport class MemoryStorageAdapter implements StorageAdapter {\n private storage: Map<string, string> = new Map();\n private logger?: APILogger;\n\n constructor(logger?: APILogger) {\n this.logger = logger;\n }\n\n getItem(key: string): string | null {\n const value = this.storage.get(key) || null;\n this.logger?.debug(`MemoryStorage.getItem(\"${key}\"): ${value ? 'found' : 'not found'}`);\n return value;\n }\n\n setItem(key: string, value: string): void {\n this.storage.set(key, value);\n this.logger?.debug(`MemoryStorage.setItem(\"${key}\"): success`);\n }\n\n removeItem(key: string): void {\n this.storage.delete(key);\n this.logger?.debug(`MemoryStorage.removeItem(\"${key}\"): success`);\n }\n}","/**\n * Zod schema for SendPushRequestRequest\n *\n * This schema provides runtime validation and type inference.\n * * Request serializer for sending push notifications.\n * */\nimport { z } from 'zod'\n\n/**\n * Request serializer for sending push notifications.\n */\nexport const SendPushRequestRequestSchema = z.object({\n title: z.string().min(1).max(255),\n body: z.string().min(1),\n icon: z.union([z.url(), z.literal('')]).nullable().optional(),\n url: z.union([z.url(), z.literal('')]).nullable().optional(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type SendPushRequestRequest = z.infer<typeof SendPushRequestRequestSchema>","/**\n * Zod schema for SendPushResponse\n *\n * This schema provides runtime validation and type inference.\n * * Response serializer for send push endpoint.\n * */\nimport { z } from 'zod'\n\n/**\n * Response serializer for send push endpoint.\n */\nexport const SendPushResponseSchema = z.object({\n success: z.boolean(),\n sent_to: z.int(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type SendPushResponse = z.infer<typeof SendPushResponseSchema>","/**\n * Zod schema for SubscribeRequestRequest\n *\n * This schema provides runtime validation and type inference.\n * * Request serializer for subscribing to push notifications.\n * */\nimport { z } from 'zod'\n\n/**\n * Request serializer for subscribing to push notifications.\n */\nexport const SubscribeRequestRequestSchema = z.object({\n endpoint: z.union([z.url(), z.literal('')]),\n keys: z.record(z.string(), z.string().min(1)),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type SubscribeRequestRequest = z.infer<typeof SubscribeRequestRequestSchema>","/**\n * Zod schema for SubscribeResponse\n *\n * This schema provides runtime validation and type inference.\n * * Response serializer for subscription endpoint.\n * */\nimport { z } from 'zod'\n\n/**\n * Response serializer for subscription endpoint.\n */\nexport const SubscribeResponseSchema = z.object({\n success: z.boolean(),\n subscription_id: z.int(),\n created: z.boolean(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type SubscribeResponse = z.infer<typeof SubscribeResponseSchema>","/**\n * Zod schema for VapidPublicKeyResponse\n *\n * This schema provides runtime validation and type inference.\n * * Response serializer for VAPID public key endpoint.\n * */\nimport { z } from 'zod'\n\n/**\n * Response serializer for VAPID public key endpoint.\n */\nexport const VapidPublicKeyResponseSchema = z.object({\n publicKey: z.string(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type VapidPublicKeyResponse = z.infer<typeof VapidPublicKeyResponseSchema>","// Auto-generated by DjangoCFG - see CLAUDE.md\n/**\n * Typed fetchers for Web Push\n *\n * Universal functions that work in any environment:\n * - Next.js (App Router / Pages Router / Server Components)\n * - React Native\n * - Node.js backend\n *\n * These fetchers use Zod schemas for runtime validation.\n *\n * Usage:\n * ```typescript\n * // Configure API once (in your app entry point)\n * import { configureAPI } from '../../api-instance'\n * configureAPI({ baseUrl: 'https://api.example.com' })\n *\n * // Then use fetchers anywhere\n * const users = await getUsers({ page: 1 })\n *\n * // With SWR\n * const { data } = useSWR(['users', params], () => getUsers(params))\n *\n * // With React Query\n * const { data } = useQuery(['users', params], () => getUsers(params))\n *\n * // In Server Component or SSR (pass custom client)\n * import { API } from '../../index'\n * const api = new API('https://api.example.com')\n * const users = await getUsers({ page: 1 }, api)\n * ```\n */\nimport { consola } from 'consola'\nimport { SendPushRequestRequestSchema, type SendPushRequestRequest } from '../schemas/SendPushRequestRequest.schema'\nimport { SendPushResponseSchema, type SendPushResponse } from '../schemas/SendPushResponse.schema'\nimport { SubscribeRequestRequestSchema, type SubscribeRequestRequest } from '../schemas/SubscribeRequestRequest.schema'\nimport { SubscribeResponseSchema, type SubscribeResponse } from '../schemas/SubscribeResponse.schema'\nimport { VapidPublicKeyResponseSchema, type VapidPublicKeyResponse } from '../schemas/VapidPublicKeyResponse.schema'\nimport { getAPIInstance } from '../../api-instance'\n\n/**\n * Send push notification\n *\n * @method POST\n * @path /cfg/webpush/send/\n */\nexport async function createWebpushSendCreate( data: SendPushRequestRequest, client?: any\n): Promise<SendPushResponse> {\n const api = client || getAPIInstance()\n const response = await api.web_push.webpushSendCreate(data)\n try {\n return SendPushResponseSchema.parse(response)\n } catch (error) {\n // Zod validation error - log detailed information\n consola.error('❌ Zod Validation Failed');\n consola.box(`createWebpushSendCreate\\nPath: /cfg/webpush/send/\\nMethod: POST`);\n\n if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {\n consola.error('Validation Issues:');\n (error as any).issues.forEach((issue: any, index: number) => {\n consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);\n consola.error(` ├─ Message: ${issue.message}`);\n if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);\n if (issue.received) consola.error(` └─ Received: ${issue.received}`);\n });\n }\n\n consola.error('Response data:', response);\n\n // Dispatch browser CustomEvent (only if window is defined)\n if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {\n try {\n const event = new CustomEvent('zod-validation-error', {\n detail: {\n operation: 'createWebpushSendCreate',\n path: '/cfg/webpush/send/',\n method: 'POST',\n error: error,\n response: response,\n timestamp: new Date(),\n },\n bubbles: true,\n cancelable: false,\n });\n window.dispatchEvent(event);\n } catch (eventError) {\n // Silently fail - event dispatch should never crash the app\n consola.warn('Failed to dispatch validation error event:', eventError);\n }\n }\n\n // Re-throw the error\n throw error;\n }\n}\n\n\n/**\n * Subscribe to push notifications\n *\n * @method POST\n * @path /cfg/webpush/subscribe/\n */\nexport async function createWebpushSubscribeCreate( data: SubscribeRequestRequest, client?: any\n): Promise<SubscribeResponse> {\n const api = client || getAPIInstance()\n const response = await api.web_push.webpushSubscribeCreate(data)\n try {\n return SubscribeResponseSchema.parse(response)\n } catch (error) {\n // Zod validation error - log detailed information\n consola.error('❌ Zod Validation Failed');\n consola.box(`createWebpushSubscribeCreate\\nPath: /cfg/webpush/subscribe/\\nMethod: POST`);\n\n if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {\n consola.error('Validation Issues:');\n (error as any).issues.forEach((issue: any, index: number) => {\n consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);\n consola.error(` ├─ Message: ${issue.message}`);\n if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);\n if (issue.received) consola.error(` └─ Received: ${issue.received}`);\n });\n }\n\n consola.error('Response data:', response);\n\n // Dispatch browser CustomEvent (only if window is defined)\n if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {\n try {\n const event = new CustomEvent('zod-validation-error', {\n detail: {\n operation: 'createWebpushSubscribeCreate',\n path: '/cfg/webpush/subscribe/',\n method: 'POST',\n error: error,\n response: response,\n timestamp: new Date(),\n },\n bubbles: true,\n cancelable: false,\n });\n window.dispatchEvent(event);\n } catch (eventError) {\n // Silently fail - event dispatch should never crash the app\n consola.warn('Failed to dispatch validation error event:', eventError);\n }\n }\n\n // Re-throw the error\n throw error;\n }\n}\n\n\n/**\n * Get VAPID public key\n *\n * @method GET\n * @path /cfg/webpush/vapid/\n */\nexport async function getWebpushVapidRetrieve( client?: any\n): Promise<VapidPublicKeyResponse> {\n const api = client || getAPIInstance()\n const response = await api.web_push.webpushVapidRetrieve()\n try {\n return VapidPublicKeyResponseSchema.parse(response)\n } catch (error) {\n // Zod validation error - log detailed information\n consola.error('❌ Zod Validation Failed');\n consola.box(`getWebpushVapidRetrieve\\nPath: /cfg/webpush/vapid/\\nMethod: GET`);\n\n if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {\n consola.error('Validation Issues:');\n (error as any).issues.forEach((issue: any, index: number) => {\n consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);\n consola.error(` ├─ Message: ${issue.message}`);\n if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);\n if (issue.received) consola.error(` └─ Received: ${issue.received}`);\n });\n }\n\n consola.error('Response data:', response);\n\n // Dispatch browser CustomEvent (only if window is defined)\n if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {\n try {\n const event = new CustomEvent('zod-validation-error', {\n detail: {\n operation: 'getWebpushVapidRetrieve',\n path: '/cfg/webpush/vapid/',\n method: 'GET',\n error: error,\n response: response,\n timestamp: new Date(),\n },\n bubbles: true,\n cancelable: false,\n });\n window.dispatchEvent(event);\n } catch (eventError) {\n // Silently fail - event dispatch should never crash the app\n consola.warn('Failed to dispatch validation error event:', eventError);\n }\n }\n\n // Re-throw the error\n throw error;\n }\n}\n\n\n","// Auto-generated by DjangoCFG - see CLAUDE.md\n/**\n * Django CFG API - API Client with JWT Management\n *\n * Usage:\n * ```typescript\n * import { API } from './api';\n *\n * const api = new API('https://api.example.com');\n *\n * // Set JWT token\n * api.setToken('your-jwt-token', 'refresh-token');\n *\n * // Use API\n * const posts = await api.posts.list();\n * const user = await api.users.retrieve(1);\n *\n * // Check authentication\n * if (api.isAuthenticated()) {\n * // ...\n * }\n *\n * // Custom storage with logging (for Electron/Node.js)\n * import { MemoryStorageAdapter, APILogger } from './storage';\n * const logger = new APILogger({ enabled: true, logLevel: 'debug' });\n * const api = new API('https://api.example.com', {\n * storage: new MemoryStorageAdapter(logger),\n * loggerConfig: { enabled: true, logLevel: 'debug' }\n * });\n *\n * // Get OpenAPI schema\n * const schema = api.getSchema();\n * ```\n */\n\nimport { APIClient } from \"./client\";\nimport {\n StorageAdapter,\n LocalStorageAdapter,\n CookieStorageAdapter,\n MemoryStorageAdapter\n} from \"./storage\";\nimport type { RetryConfig } from \"./retry\";\nimport type { LoggerConfig } from \"./logger\";\nimport { APILogger } from \"./logger\";\nimport { WebPush } from \"./webpush__web_push/client\";\nexport * as WebPushTypes from \"./webpush__web_push/models\";\n// Note: Direct exports (export * from) are removed to avoid duplicate type conflicts\n// Use namespace exports like CfgAccountsTypes.User or import from specific modules\n\n// Re-export Zod schemas for runtime validation\nexport * as Schemas from \"./_utils/schemas\";\n// Also export all schemas directly for convenience\nexport * from \"./_utils/schemas\";\n\n// Re-export Zod validation events for browser integration\nexport type { ValidationErrorDetail, ValidationErrorEvent } from \"./validation-events\";\nexport { dispatchValidationError, onValidationError, formatZodError } from \"./validation-events\";\n\n// Re-export typed fetchers for universal usage\nexport * as Fetchers from \"./_utils/fetchers\";\nexport * from \"./_utils/fetchers\";\n\n// Re-export API instance configuration functions\nexport {\n configureAPI,\n getAPIInstance,\n reconfigureAPI,\n clearAPITokens,\n resetAPI,\n isAPIConfigured\n} from \"./api-instance\";\n// NOTE: SWR hooks are generated in ./_utils/hooks/ but NOT exported here to keep\n// the main bundle server-safe. Import hooks directly from the hooks directory:\n// import { useUsers } from './_utils/hooks';\n// Or use a separate entry point like '@djangocfg/api/hooks' for client components.\n\n// Re-export core client\nexport { APIClient };\n\n// Re-export storage adapters for convenience\nexport type { StorageAdapter };\nexport { LocalStorageAdapter, CookieStorageAdapter, MemoryStorageAdapter };\n\n// Re-export error classes for convenience\nexport { APIError, NetworkError } from \"./errors\";\n\n// Re-export HTTP adapters for custom implementations\nexport type { HttpClientAdapter, HttpRequest, HttpResponse } from \"./http\";\nexport { FetchAdapter } from \"./http\";\n\n// Re-export logger types and classes\nexport type { LoggerConfig, RequestLog, ResponseLog, ErrorLog } from \"./logger\";\nexport { APILogger } from \"./logger\";\n\n// Re-export retry configuration and utilities\nexport type { RetryConfig, FailedAttemptInfo } from \"./retry\";\nexport { withRetry, shouldRetry, DEFAULT_RETRY_CONFIG } from \"./retry\";\n\nexport const TOKEN_KEY = \"auth_token\";\nexport const REFRESH_TOKEN_KEY = \"refresh_token\";\n\nexport interface APIOptions {\n /** Custom storage adapter (defaults to LocalStorageAdapter) */\n storage?: StorageAdapter;\n /** Retry configuration for failed requests */\n retryConfig?: RetryConfig;\n /** Logger configuration */\n loggerConfig?: Partial<LoggerConfig>;\n}\n\nexport class API {\n private baseUrl: string;\n private _client: APIClient;\n private _token: string | null = null;\n private _refreshToken: string | null = null;\n private storage: StorageAdapter;\n private options?: APIOptions;\n\n // Sub-clients\n public web_push!: WebPush;\n\n constructor(baseUrl: string, options?: APIOptions) {\n this.baseUrl = baseUrl;\n this.options = options;\n\n // Create logger if config provided\n const logger = options?.loggerConfig ? new APILogger(options.loggerConfig) : undefined;\n\n // Initialize storage with logger\n this.storage = options?.storage || new LocalStorageAdapter(logger);\n\n this._loadTokensFromStorage();\n\n // Initialize APIClient\n this._client = new APIClient(this.baseUrl, {\n retryConfig: this.options?.retryConfig,\n loggerConfig: this.options?.loggerConfig,\n });\n\n // Always inject auth header wrapper (reads token dynamically from storage)\n this._injectAuthHeader();\n\n // Initialize sub-clients from APIClient\n this.web_push = this._client.web_push;\n }\n\n private _loadTokensFromStorage(): void {\n this._token = this.storage.getItem(TOKEN_KEY);\n this._refreshToken = this.storage.getItem(REFRESH_TOKEN_KEY);\n }\n\n private _reinitClients(): void {\n this._client = new APIClient(this.baseUrl, {\n retryConfig: this.options?.retryConfig,\n loggerConfig: this.options?.loggerConfig,\n });\n\n // Always inject auth header wrapper (reads token dynamically from storage)\n this._injectAuthHeader();\n\n // Reinitialize sub-clients\n this.web_push = this._client.web_push;\n }\n\n private _injectAuthHeader(): void {\n // Override request method to inject auth header\n const originalRequest = this._client.request.bind(this._client);\n this._client.request = async <T>(\n method: string,\n path: string,\n options?: { params?: Record<string, any>; body?: any; formData?: FormData; headers?: Record<string, string> }\n ): Promise<T> => {\n // Read token from storage dynamically (supports JWT injection after instantiation)\n const token = this.getToken();\n const mergedOptions = {\n ...options,\n headers: {\n ...(options?.headers || {}),\n ...(token ? { 'Authorization': `Bearer ${token}` } : {}),\n },\n };\n\n return originalRequest(method, path, mergedOptions);\n };\n }\n\n /**\n * Get current JWT token\n */\n getToken(): string | null {\n return this.storage.getItem(TOKEN_KEY);\n }\n\n /**\n * Get current refresh token\n */\n getRefreshToken(): string | null {\n return this.storage.getItem(REFRESH_TOKEN_KEY);\n }\n\n /**\n * Set JWT token and refresh token\n * @param token - JWT access token\n * @param refreshToken - JWT refresh token (optional)\n */\n setToken(token: string, refreshToken?: string): void {\n this._token = token;\n this.storage.setItem(TOKEN_KEY, token);\n\n if (refreshToken) {\n this._refreshToken = refreshToken;\n this.storage.setItem(REFRESH_TOKEN_KEY, refreshToken);\n }\n\n // Reinitialize clients with new token\n this._reinitClients();\n }\n\n /**\n * Clear all tokens\n */\n clearTokens(): void {\n this._token = null;\n this._refreshToken = null;\n this.storage.removeItem(TOKEN_KEY);\n this.storage.removeItem(REFRESH_TOKEN_KEY);\n\n // Reinitialize clients without token\n this._reinitClients();\n }\n\n /**\n * Check if user is authenticated\n */\n isAuthenticated(): boolean {\n return !!this.getToken();\n }\n\n /**\n * Update base URL and reinitialize clients\n * @param url - New base URL\n */\n setBaseUrl(url: string): void {\n this.baseUrl = url;\n this._reinitClients();\n }\n\n /**\n * Get current base URL\n */\n getBaseUrl(): string {\n return this.baseUrl;\n }\n\n /**\n * Get OpenAPI schema path\n * @returns Path to the OpenAPI schema JSON file\n *\n * Note: The OpenAPI schema is available in the schema.json file.\n * You can load it dynamically using:\n * ```typescript\n * const schema = await fetch('./schema.json').then(r => r.json());\n * // or using fs in Node.js:\n * // const schema = JSON.parse(fs.readFileSync('./schema.json', 'utf-8'));\n * ```\n */\n getSchemaPath(): string {\n return './schema.json';\n }\n}\n\nexport default API;","/**\n * @djangocfg/api - Shared API Package\n *\n * Core authentication API (cfg_accounts only).\n * Extensions are now in separate packages:\n * - @djangocfg/ext-support\n * - @djangocfg/ext-payments\n * - etc.\n */\n\n// ============================================================================\n// Main API from cfg_accounts (authentication)\n// ============================================================================\nexport * from './generated/cfg_accounts';\nexport { API, LocalStorageAdapter, MemoryStorageAdapter } from './generated/cfg_accounts';\nexport { Schemas, Fetchers, Enums } from './generated/cfg_accounts';\n\n// ============================================================================\n// CFG Accounts Type Namespace\n// ============================================================================\nexport * as CfgAccountsTypes from './generated/cfg_accounts';\n\n// ============================================================================\n// Centrifugo Fetchers (for WebSocket token refresh)\n// ============================================================================\nexport { getCentrifugoAuthTokenRetrieve } from './generated/cfg_centrifugo';\n\n// ============================================================================\n// WebPush API (for push notifications)\n// ============================================================================\nexport { API as WebPushAPI } from './generated/cfg_webpush';\nexport * as WebPushTypes from './generated/cfg_webpush';\n\n/**\n * Base Client for all API services\n *\n * Provides:\n * - Centralized API instance with JWT token management\n * - LocalStorage adapter for browser environments\n * - Singleton pattern for API client\n */\n\nimport { API, LocalStorageAdapter } from './generated/cfg_accounts';\n\n/**\n * Singleton API instance with JWT token management\n * Uses LocalStorage for token persistence\n */\nconst isStaticBuild = process.env.NEXT_PUBLIC_STATIC_BUILD === 'true';\nconst apiUrl = isStaticBuild ? '' : process.env.NEXT_PUBLIC_API_URL || '';\n\nconst api = new API(\n apiUrl,\n {\n storage: new LocalStorageAdapter()\n }\n);\n\n/**\n * Base Client Class\n *\n * Service classes can extend this to access api instance\n */\nexport class BaseClient {\n protected static api = api;\n}\n\n/**\n * Export API instance for direct access\n */\nexport { api };\n","import { createConsola } from 'consola';\n\n/**\n * Universal logger for @djangocfg/api/auth\n * Uses consola for beautiful console logging\n *\n * Log levels:\n * - 0: silent\n * - 1: fatal, error\n * - 2: warn\n * - 3: log, info\n * - 4: debug\n * - 5: trace, verbose\n */\nconst isDevelopment = process.env.NODE_ENV === 'development';\nconst isStaticBuild = process.env.NEXT_PUBLIC_STATIC_BUILD === 'true';\nconst showLogs = isDevelopment || isStaticBuild;\n\nexport const logger = createConsola({\n level: showLogs ? 4 : 1, // dev: debug, production: errors only\n}).withTag('api');\n\n/**\n * Auth-specific logger\n */\nexport const authLogger = logger.withTag('auth');\n\nexport default logger;\n","\"use client\"\n\n/**\n * Base64 Encoding/Decoding Hook\n *\n * Provides base64 encoding/decoding with dev mode detection:\n * - In production: encodes data to base64\n * - In development: returns data as-is (no encoding)\n */\n\nconst isDev = process.env.NODE_ENV === 'development';\n\n/**\n * Encode string to base64\n * @param data - String data to encode\n * @returns Base64 encoded string (or original in dev mode)\n */\nexport function encodeBase64(data: string): string {\n if (isDev) {\n return data;\n }\n\n try {\n // Browser-safe base64 encoding\n if (typeof window !== 'undefined') {\n return btoa(encodeURIComponent(data).replace(/%([0-9A-F]{2})/g, (_, p1) => {\n return String.fromCharCode(parseInt(p1, 16));\n }));\n }\n // Node.js fallback\n return Buffer.from(data, 'utf-8').toString('base64');\n } catch (error) {\n console.error('Base64 encoding error:', error);\n return data; // Return original on error\n }\n}\n\n/**\n * Decode base64 to string\n * @param encoded - Base64 encoded string\n * @returns Decoded string (or original in dev mode)\n */\nexport function decodeBase64(encoded: string): string {\n if (isDev) {\n return encoded;\n }\n\n try {\n // Browser-safe base64 decoding\n if (typeof window !== 'undefined') {\n const binary = atob(encoded);\n const bytes = new Uint8Array(binary.length);\n for (let i = 0; i < binary.length; i++) {\n bytes[i] = binary.charCodeAt(i);\n }\n return decodeURIComponent(\n Array.from(bytes)\n .map(byte => '%' + ('00' + byte.toString(16)).slice(-2))\n .join('')\n );\n }\n // Node.js fallback\n return Buffer.from(encoded, 'base64').toString('utf-8');\n } catch (error) {\n console.error('Base64 decoding error:', error);\n return encoded; // Return original on error\n }\n}\n\n/**\n * Hook for base64 encoding/decoding\n * @returns Object with encode and decode functions\n */\nexport function useBase64() {\n return {\n encode: encodeBase64,\n decode: decodeBase64,\n isDev,\n };\n}\n","\"use client\"\n\n/**\n * Profile Cache Hook\n *\n * Provides localStorage-based caching for user profile with:\n * - TTL (Time To Live) - default 1 hour\n * - Version control for migrations\n * - Automatic invalidation on expiry\n */\n\nimport type { User } from '../../';\nimport { authLogger as profileLogger } from '../utils/logger';\nimport { decodeBase64, encodeBase64 } from './useBase64';\n\n// Cache configuration\nconst CACHE_KEY = 'user_profile_cache';\nconst CACHE_VERSION = 1;\nconst DEFAULT_TTL = 3600000; // 1 hour in milliseconds\n\nexport interface ProfileCacheOptions {\n /** Time to live in milliseconds (default: 1 hour) */\n ttl?: number;\n}\n\ninterface CachedProfile {\n version: number;\n data: User;\n timestamp: number;\n ttl: number;\n}\n\n/**\n * Get cached profile from localStorage\n * @returns User profile if valid cache exists, null otherwise\n */\nexport function getCachedProfile(): User | null {\n try {\n if (typeof window === 'undefined') return null;\n\n const cached = localStorage.getItem(CACHE_KEY);\n if (!cached) {\n profileLogger.debug('No cached profile found');\n return null;\n }\n\n // Decode from base64\n const decoded = decodeBase64(cached);\n const cachedData: CachedProfile = JSON.parse(decoded);\n\n // Version check\n if (cachedData.version !== CACHE_VERSION) {\n profileLogger.warn('Cache version mismatch, clearing cache');\n clearProfileCache();\n return null;\n }\n\n // TTL check\n const now = Date.now();\n const age = now - cachedData.timestamp;\n if (age > cachedData.ttl) {\n profileLogger.info('Cache expired, clearing');\n clearProfileCache();\n return null;\n }\n\n profileLogger.debug('Cache hit, age:', Math.round(age / 1000), 'seconds');\n return cachedData.data;\n } catch (error) {\n profileLogger.error('Error reading cache:', error);\n clearProfileCache();\n return null;\n }\n}\n\n/**\n * Save profile to localStorage cache\n * @param profile - User profile to cache\n * @param options - Cache options (TTL)\n */\nexport function setCachedProfile(profile: User, options?: ProfileCacheOptions): void {\n try {\n if (typeof window === 'undefined') return;\n\n const cachedData: CachedProfile = {\n version: CACHE_VERSION,\n data: profile,\n timestamp: Date.now(),\n ttl: options?.ttl || DEFAULT_TTL,\n };\n\n // Encode to base64\n const encoded = encodeBase64(JSON.stringify(cachedData));\n localStorage.setItem(CACHE_KEY, encoded);\n profileLogger.debug('Profile cached, TTL:', cachedData.ttl / 1000, 'seconds');\n } catch (error) {\n profileLogger.error('Error writing cache:', error);\n }\n}\n\n/**\n * Clear profile cache from localStorage\n */\nexport function clearProfileCache(): void {\n try {\n if (typeof window === 'undefined') return;\n localStorage.removeItem(CACHE_KEY);\n profileLogger.debug('Cache cleared');\n } catch (error) {\n profileLogger.error('Error clearing cache:', error);\n }\n}\n\n/**\n * Check if cached profile is valid (exists and not expired)\n */\nexport function hasValidCache(): boolean {\n return getCachedProfile() !== null;\n}\n\n/**\n * Get cache metadata (age, TTL, etc.)\n */\nexport function getCacheMetadata(): {\n exists: boolean;\n age?: number;\n ttl?: number;\n expiresIn?: number;\n} | null {\n try {\n if (typeof window === 'undefined') return null;\n\n const cached = localStorage.getItem(CACHE_KEY);\n if (!cached) return { exists: false };\n\n // Decode from base64\n const decoded = decodeBase64(cached);\n const cachedData: CachedProfile = JSON.parse(decoded);\n const now = Date.now();\n const age = now - cachedData.timestamp;\n const expiresIn = cachedData.ttl - age;\n\n return {\n exists: true,\n age,\n ttl: cachedData.ttl,\n expiresIn: Math.max(0, expiresIn),\n };\n } catch (error) {\n profileLogger.error('Error reading metadata:', error);\n return null;\n }\n}\n","'use client';\n\nimport { useState } from 'react';\n\nimport { authLogger } from '../utils/logger';\n\n/**\n * Simple sessionStorage hook with better error handling\n * @param key - Storage key\n * @param initialValue - Default value if key doesn't exist\n * @returns [value, setValue, removeValue] - Current value, setter function, and remove function\n */\nexport function useSessionStorage<T>(key: string, initialValue: T) {\n // Get initial value from sessionStorage or use provided initialValue\n const [storedValue, setStoredValue] = useState<T>(() => {\n if (typeof window === 'undefined') {\n return initialValue;\n }\n\n try {\n const item = window.sessionStorage.getItem(key);\n return item ? JSON.parse(item) : initialValue;\n } catch (error) {\n authLogger.error(`Error reading sessionStorage key \"${key}\":`, error);\n return initialValue;\n }\n });\n\n // Check data size and limit\n const checkDataSize = (data: any): boolean => {\n try {\n const jsonString = JSON.stringify(data);\n const sizeInBytes = new Blob([jsonString]).size;\n const sizeInKB = sizeInBytes / 1024;\n \n // Limit to 1MB per item\n if (sizeInKB > 1024) {\n authLogger.warn(`Data size (${sizeInKB.toFixed(2)}KB) exceeds 1MB limit for key \"${key}\"`);\n return false;\n }\n\n return true;\n } catch (error) {\n authLogger.error(`Error checking data size for key \"${key}\":`, error);\n return false;\n }\n };\n\n // Clear old data when sessionStorage is full\n const clearOldData = () => {\n try {\n const keys = Object.keys(sessionStorage).filter(key => key && typeof key === 'string');\n // Remove oldest items if we have more than 50 items\n if (keys.length > 50) {\n const itemsToRemove = Math.ceil(keys.length * 0.2);\n for (let i = 0; i < itemsToRemove; i++) {\n try {\n const key = keys[i];\n if (key) {\n sessionStorage.removeItem(key);\n sessionStorage.removeItem(`${key}_timestamp`);\n }\n } catch {\n // Ignore errors when removing items\n }\n }\n }\n } catch (error) {\n authLogger.error('Error clearing old sessionStorage data:', error);\n }\n };\n\n // Force clear all data if quota is exceeded\n const forceClearAll = () => {\n try {\n const keys = Object.keys(sessionStorage);\n for (const key of keys) {\n try {\n sessionStorage.removeItem(key);\n } catch {\n // Ignore errors when removing items\n }\n }\n } catch (error) {\n authLogger.error('Error force clearing sessionStorage:', error);\n }\n };\n\n // Update sessionStorage when value changes\n const setValue = (value: T | ((val: T) => T)) => {\n try {\n const valueToStore = value instanceof Function ? value(storedValue) : value;\n \n // Check data size before attempting to save\n if (!checkDataSize(valueToStore)) {\n authLogger.warn(`Data size too large for key \"${key}\", removing key`);\n // Remove the key if data is too large\n try {\n window.sessionStorage.removeItem(key);\n window.sessionStorage.removeItem(`${key}_timestamp`);\n } catch {\n // Ignore errors when removing\n }\n // Still update the state\n setStoredValue(valueToStore);\n return;\n }\n \n setStoredValue(valueToStore);\n\n if (typeof window !== 'undefined') {\n // Try to set the value\n try {\n window.sessionStorage.setItem(key, JSON.stringify(valueToStore));\n // Add timestamp for cleanup\n window.sessionStorage.setItem(`${key}_timestamp`, Date.now().toString());\n } catch (storageError: any) {\n // If quota exceeded, clear old data and try again\n if (storageError.name === 'QuotaExceededError' ||\n storageError.code === 22 ||\n storageError.message?.includes('quota')) {\n authLogger.warn('sessionStorage quota exceeded, clearing old data...');\n clearOldData();\n \n // Try again after clearing\n try {\n window.sessionStorage.setItem(key, JSON.stringify(valueToStore));\n window.sessionStorage.setItem(`${key}_timestamp`, Date.now().toString());\n } catch (retryError) {\n authLogger.error(`Failed to set sessionStorage key \"${key}\" after clearing old data:`, retryError);\n // If still fails, force clear all and try one more time\n try {\n forceClearAll();\n window.sessionStorage.setItem(key, JSON.stringify(valueToStore));\n window.sessionStorage.setItem(`${key}_timestamp`, Date.now().toString());\n } catch (finalError) {\n authLogger.error(`Failed to set sessionStorage key \"${key}\" after force clearing:`, finalError);\n // If still fails, just update the state without sessionStorage\n setStoredValue(valueToStore);\n }\n }\n } else {\n throw storageError;\n }\n }\n }\n } catch (error) {\n authLogger.error(`Error setting sessionStorage key \"${key}\":`, error);\n // Still update the state even if sessionStorage fails\n const valueToStore = value instanceof Function ? value(storedValue) : value;\n setStoredValue(valueToStore);\n }\n };\n\n // Remove value from sessionStorage\n const removeValue = () => {\n try {\n setStoredValue(initialValue);\n if (typeof window !== 'undefined') {\n try {\n window.sessionStorage.removeItem(key);\n window.sessionStorage.removeItem(`${key}_timestamp`);\n } catch (removeError: any) {\n // If removal fails due to quota, try to clear some data first\n if (removeError.name === 'QuotaExceededError' ||\n removeError.code === 22 ||\n removeError.message?.includes('quota')) {\n authLogger.warn('sessionStorage quota exceeded during removal, clearing old data...');\n clearOldData();\n \n try {\n window.sessionStorage.removeItem(key);\n window.sessionStorage.removeItem(`${key}_timestamp`);\n } catch (retryError) {\n authLogger.error(`Failed to remove sessionStorage key \"${key}\" after clearing:`, retryError);\n // If still fails, force clear all\n forceClearAll();\n }\n } else {\n throw removeError;\n }\n }\n }\n } catch (error) {\n authLogger.error(`Error removing sessionStorage key \"${key}\":`, error);\n }\n };\n\n return [storedValue, setValue, removeValue] as const;\n}\n","import { useSessionStorage } from './useSessionStorage';\n\nconst AUTH_REDIRECT_KEY = 'auth_redirect_url';\n\nexport interface AuthRedirectOptions {\n fallbackUrl?: string;\n clearOnUse?: boolean;\n}\n\n/**\n * Read redirect URL directly from sessionStorage (bypasses React state)\n * This is needed because different component instances have different React states\n */\nconst getRedirectFromStorage = (): string => {\n if (typeof window === 'undefined') return '';\n try {\n const item = window.sessionStorage.getItem(AUTH_REDIRECT_KEY);\n return item ? JSON.parse(item) : '';\n } catch {\n return '';\n }\n};\n\n/**\n * Clear redirect URL directly from sessionStorage\n */\nconst clearRedirectFromStorage = (): void => {\n if (typeof window === 'undefined') return;\n try {\n window.sessionStorage.removeItem(AUTH_REDIRECT_KEY);\n window.sessionStorage.removeItem(`${AUTH_REDIRECT_KEY}_timestamp`);\n } catch {\n // Ignore errors\n }\n};\n\nexport const useAuthRedirectManager = (options: AuthRedirectOptions = {}) => {\n const { fallbackUrl = '/dashboard', clearOnUse = true } = options;\n const [redirectUrl, setRedirectUrl, removeRedirectUrl] = useSessionStorage<string>(AUTH_REDIRECT_KEY, '');\n\n const setRedirect = (url: string) => {\n setRedirectUrl(url);\n };\n\n const getRedirect = () => {\n // Read directly from storage to get latest value across components\n return getRedirectFromStorage() || redirectUrl;\n };\n\n const clearRedirect = () => {\n removeRedirectUrl();\n clearRedirectFromStorage();\n };\n\n const hasRedirect = () => {\n const stored = getRedirectFromStorage();\n return stored.length > 0 || redirectUrl.length > 0;\n };\n\n const getFinalRedirectUrl = () => {\n // Read directly from storage to get latest value across components\n const stored = getRedirectFromStorage();\n return stored || redirectUrl || fallbackUrl;\n };\n\n const useAndClearRedirect = () => {\n // Read directly from storage to ensure we get the latest saved URL\n // even if it was saved by a different component instance\n const stored = getRedirectFromStorage();\n const finalUrl = stored || redirectUrl || fallbackUrl;\n\n if (clearOnUse) {\n clearRedirect();\n }\n return finalUrl;\n };\n\n return {\n redirectUrl,\n setRedirect,\n getRedirect,\n clearRedirect,\n hasRedirect,\n getFinalRedirectUrl,\n useAndClearRedirect\n };\n}; ","/**\n * Analytics stub for @djangocfg/api/auth\n * Provides minimal analytics interface without external dependencies\n *\n * If you need full analytics, install @djangocfg/layouts and use its Analytics module\n */\n\nexport enum AnalyticsEvent {\n AUTH_OTP_REQUEST = 'auth_otp_request',\n AUTH_LOGIN_SUCCESS = 'auth_login_success',\n AUTH_OTP_VERIFY_FAIL = 'auth_otp_verify_fail',\n AUTH_SESSION_EXPIRED = 'auth_session_expired',\n AUTH_TOKEN_REFRESH = 'auth_token_refresh',\n AUTH_TOKEN_REFRESH_FAIL = 'auth_token_refresh_fail',\n AUTH_LOGOUT = 'auth_logout',\n AUTH_OAUTH_START = 'auth_oauth_start',\n AUTH_OAUTH_FAIL = 'auth_oauth_fail',\n}\n\nexport enum AnalyticsCategory {\n AUTH = 'auth',\n}\n\nexport type AnalyticsEventType = `${AnalyticsEvent}`;\nexport type AnalyticsCategoryType = `${AnalyticsCategory}`;\n\ninterface AnalyticsEventParams {\n category?: AnalyticsCategoryType;\n label?: string;\n value?: number;\n [key: string]: any;\n}\n\n/**\n * Minimal analytics implementation\n * Logs to console in development, silent in production\n */\nexport const Analytics = {\n /**\n * Track an analytics event\n */\n event(eventName: AnalyticsEventType, params?: AnalyticsEventParams) {\n if (process.env.NODE_ENV === 'development') {\n console.log('[Analytics]', eventName, params);\n }\n\n // You can extend this to send to your analytics service\n // Example: window.gtag?.('event', eventName, params);\n },\n\n /**\n * Set user ID for tracking\n */\n setUser(userId: string) {\n if (process.env.NODE_ENV === 'development') {\n console.log('[Analytics] Set user:', userId);\n }\n\n // You can extend this to send to your analytics service\n // Example: window.gtag?.('set', { user_id: userId });\n },\n};\n","/**\n * Accounts Context\n *\n * Manages user authentication and profile operations using generated SWR hooks\n *\n * Features:\n * - OTP-based authentication\n * - User profile management\n * - Avatar upload\n * - Profile updates\n * - localStorage cache with TTL (1 hour)\n */\n\n\"use client\";\n\nimport {\n createContext, ReactNode, useCallback, useContext, useEffect, useRef, useState\n} from 'react';\n\n// Import API instance and fetcher\nimport { api as apiAccounts, getAccountsProfileRetrieve } from '../../';\n// Import schema\nimport { PatchedUserProfileUpdateRequestSchema } from '../../generated/cfg_accounts';\n// Import hooks from generated API hooks\nimport {\n useCreateAccountsOtpRequestCreate, useCreateAccountsOtpVerifyCreate,\n useCreateAccountsProfileAvatarCreate, useCreateAccountsTokenRefreshCreate,\n usePartialUpdateAccountsProfilePartialUpdate, useUpdateAccountsProfileUpdateUpdate\n} from '../../generated/cfg_accounts/_utils/hooks';\nimport { clearProfileCache, getCachedProfile, setCachedProfile } from '../hooks/useProfileCache';\nimport { authLogger } from '../utils/logger';\n\n// Import types from generated API\nimport type {\n User,\n UserProfileUpdateRequest,\n PatchedUserProfileUpdateRequest,\n OTPRequestRequest,\n OTPVerifyRequest,\n OTPRequestResponse,\n OTPVerifyResponse,\n TokenRefresh,\n API,\n} from '../../generated/cfg_accounts';\n// Re-export schemas for external use\nexport { PatchedUserProfileUpdateRequestSchema };\nexport type { PatchedUserProfileUpdateRequest };\n\n// ─────────────────────────────────────────────────────────────────────────\n// Context Type\n// ─────────────────────────────────────────────────────────────────────────\n\nexport interface AccountsContextValue {\n // Current user profile\n profile?: User;\n isLoadingProfile: boolean;\n profileError: Error | null;\n\n // Profile operations\n updateProfile: (data: UserProfileUpdateRequest) => Promise<User>;\n partialUpdateProfile: (data: PatchedUserProfileUpdateRequest) => Promise<User>;\n uploadAvatar: (formData: FormData) => Promise<User>;\n refreshProfile: (callerId?: string) => Promise<User | undefined>;\n\n // Authentication\n requestOTP: (data: OTPRequestRequest) => Promise<OTPRequestResponse>;\n verifyOTP: (data: OTPVerifyRequest) => Promise<OTPVerifyResponse>;\n refreshToken: (refresh: string) => Promise<TokenRefresh>;\n logout: () => void;\n}\n\n// ─────────────────────────────────────────────────────────────────────────\n// Context\n// ─────────────────────────────────────────────────────────────────────────\n\nconst AccountsContext = createContext<AccountsContextValue | undefined>(undefined);\n\n// ─────────────────────────────────────────────────────────────────────────\n// Provider Component\n// ─────────────────────────────────────────────────────────────────────────\n\ninterface AccountsProviderProps {\n children: ReactNode;\n}\n\nexport function AccountsProvider({ children }: AccountsProviderProps) {\n // State management with localStorage cache\n const [profile, setProfile] = useState<User | undefined>(() => {\n // Initialize from cache on mount\n const cached = getCachedProfile();\n return cached || undefined;\n });\n const [isLoadingProfile, setIsLoadingProfile] = useState(false);\n const [profileError, setProfileError] = useState<Error | null>(null);\n\n // Use refs to access current state without adding to dependencies\n const profileRef = useRef<User | undefined>(profile);\n const isLoadingRef = useRef(false);\n\n // Keep refs in sync with state\n useEffect(() => {\n profileRef.current = profile;\n }, [profile]);\n\n useEffect(() => {\n isLoadingRef.current = isLoadingProfile;\n }, [isLoadingProfile]);\n\n // Mutation hooks\n const updateMutation = useUpdateAccountsProfileUpdateUpdate();\n const partialUpdateMutation = usePartialUpdateAccountsProfilePartialUpdate();\n const avatarMutation = useCreateAccountsProfileAvatarCreate();\n const otpRequestMutation = useCreateAccountsOtpRequestCreate();\n const otpVerifyMutation = useCreateAccountsOtpVerifyCreate();\n const tokenRefreshMutation = useCreateAccountsTokenRefreshCreate();\n\n // Refresh profile - fetch and cache with stable callback\n const refreshProfile = useCallback(async (callerId?: string): Promise<User | undefined> => {\n // Use refs to check current state without creating dependency\n const currentProfile = profileRef.current;\n const currentLoading = isLoadingRef.current;\n\n // Prevent duplicate calls if profile is already loaded and not loading\n if (currentProfile && !currentLoading) {\n authLogger.debug(`Profile already loaded, returning cached (caller: ${callerId})`);\n return currentProfile;\n }\n\n setIsLoadingProfile(true);\n isLoadingRef.current = true;\n setProfileError(null);\n try {\n // Log caller for debugging excessive API calls using consola logger\n if (callerId) {\n authLogger.debug(`Profile refresh called by: ${callerId}`);\n }\n const result = await getAccountsProfileRetrieve(apiAccounts);\n setProfile(result);\n profileRef.current = result;\n // Save to cache with 1 hour TTL\n setCachedProfile(result);\n return result;\n } catch (error) {\n const err = error instanceof Error ? error : new Error('Failed to fetch profile');\n setProfileError(err);\n throw err;\n } finally {\n setIsLoadingProfile(false);\n isLoadingRef.current = false;\n }\n }, []); // Empty dependencies - callback is stable\n\n // Update profile (full)\n const updateProfile = async (data: UserProfileUpdateRequest): Promise<User> => {\n const result = await updateMutation(data, apiAccounts);\n await refreshProfile('AccountsContext.updateProfile');\n return result as User;\n };\n\n // Partial update profile\n const partialUpdateProfile = async (data: PatchedUserProfileUpdateRequest): Promise<User> => {\n const result = await partialUpdateMutation(data, apiAccounts);\n await refreshProfile('AccountsContext.partialUpdateProfile');\n return result as User;\n };\n\n // Upload avatar\n const uploadAvatar = async (formData: FormData): Promise<User> => {\n const result = await avatarMutation(formData, apiAccounts);\n await refreshProfile('AccountsContext.uploadAvatar');\n return result as User;\n };\n\n // Request OTP\n const requestOTP = async (data: OTPRequestRequest): Promise<OTPRequestResponse> => {\n const result = await otpRequestMutation(data, apiAccounts);\n return result as OTPRequestResponse;\n };\n\n // Verify OTP\n const verifyOTP = async (data: OTPVerifyRequest): Promise<OTPVerifyResponse> => {\n const result = await otpVerifyMutation(data, apiAccounts);\n\n // Automatically save tokens after successful verification\n if (result.access && result.refresh) {\n apiAccounts.setToken(result.access, result.refresh);\n // Refresh profile to load user data with new token\n await refreshProfile('AccountsContext.verifyOTP');\n }\n\n return result as OTPVerifyResponse;\n };\n\n // Refresh token\n const refreshToken = async (refresh: string): Promise<TokenRefresh> => {\n const result = await tokenRefreshMutation({ refresh }, apiAccounts);\n\n // Automatically save new access token\n if (result.access) {\n apiAccounts.setToken(result.access, refresh);\n }\n\n return result as TokenRefresh;\n };\n\n // Logout - clear tokens, profile state, and cache\n const logout = useCallback(() => {\n apiAccounts.clearTokens();\n setProfile(undefined);\n setProfileError(null);\n clearProfileCache();\n }, []);\n\n const value: AccountsContextValue = {\n profile,\n isLoadingProfile,\n profileError,\n updateProfile,\n partialUpdateProfile,\n uploadAvatar,\n refreshProfile,\n requestOTP,\n verifyOTP,\n refreshToken,\n logout,\n };\n\n return (\n <AccountsContext.Provider value={value}>\n {children}\n </AccountsContext.Provider>\n );\n}\n\n// ─────────────────────────────────────────────────────────────────────────\n// Hook\n// ─────────────────────────────────────────────────────────────────────────\n\nexport function useAccountsContext(): AccountsContextValue {\n const context = useContext(AccountsContext);\n if (!context) {\n throw new Error('useAccountsContext must be used within AccountsProvider');\n }\n return context;\n}\n","// Auto-generated by DjangoCFG - see CLAUDE.md\n'use client';\n\n/**\n * SWR Hooks for Auth\n *\n * React hooks powered by SWR for data fetching with automatic caching,\n * revalidation, and optimistic updates.\n *\n * Usage:\n * ```typescript\n * // Query hooks (GET)\n * const { data, error, isLoading } = useUsers({ page: 1 })\n *\n * // Mutation hooks (POST/PUT/PATCH/DELETE)\n * const createUser = useCreateUser()\n * await createUser({ name: 'John', email: 'john@example.com' })\n * ```\n */\nimport { useSWRConfig } from 'swr'\nimport * as Fetchers from '../fetchers/accounts__auth'\nimport type { API } from '../../index'\nimport type { TokenRefresh } from '../schemas/TokenRefresh.schema'\nimport type { TokenRefreshRequest } from '../schemas/TokenRefreshRequest.schema'\n\n/**\n * API operation\n *\n * @method POST\n * @path /cfg/accounts/token/refresh/\n */\nexport function useCreateAccountsTokenRefreshCreate() {\n const { mutate } = useSWRConfig()\n\n return async (data: TokenRefreshRequest, client?: API): Promise<TokenRefresh> => {\n const result = await Fetchers.createAccountsTokenRefreshCreate(data, client)\n // Revalidate related queries\n mutate('cfg-accounts-token-refresh')\n return result\n }\n}\n\n\n","// Auto-generated by DjangoCFG - see CLAUDE.md\n'use client';\n\n/**\n * SWR Hooks for Oauth\n *\n * React hooks powered by SWR for data fetching with automatic caching,\n * revalidation, and optimistic updates.\n *\n * Usage:\n * ```typescript\n * // Query hooks (GET)\n * const { data, error, isLoading } = useUsers({ page: 1 })\n *\n * // Mutation hooks (POST/PUT/PATCH/DELETE)\n * const createUser = useCreateUser()\n * await createUser({ name: 'John', email: 'john@example.com' })\n * ```\n */\nimport useSWR from 'swr'\nimport { useSWRConfig } from 'swr'\nimport * as Fetchers from '../fetchers/accounts__oauth'\nimport type { API } from '../../index'\nimport type { OAuthAuthorizeRequestRequest } from '../schemas/OAuthAuthorizeRequestRequest.schema'\nimport type { OAuthAuthorizeResponse } from '../schemas/OAuthAuthorizeResponse.schema'\nimport type { OAuthCallbackRequestRequest } from '../schemas/OAuthCallbackRequestRequest.schema'\nimport type { OAuthDisconnectRequestRequest } from '../schemas/OAuthDisconnectRequestRequest.schema'\nimport type { OAuthProvidersResponse } from '../schemas/OAuthProvidersResponse.schema'\nimport type { OAuthTokenResponse } from '../schemas/OAuthTokenResponse.schema'\n\n/**\n * List OAuth connections\n *\n * @method GET\n * @path /cfg/accounts/oauth/connections/\n */\nexport function useAccountsOauthConnectionsList(client?: API): ReturnType<typeof useSWR<any>> {\n return useSWR<any>(\n 'cfg-accounts-oauth-connections',\n () => Fetchers.getAccountsOauthConnectionsList(client)\n )\n}\n\n\n/**\n * Disconnect OAuth provider\n *\n * @method POST\n * @path /cfg/accounts/oauth/disconnect/\n */\nexport function useCreateAccountsOauthDisconnectCreate() {\n const { mutate } = useSWRConfig()\n\n return async (data: OAuthDisconnectRequestRequest, client?: API): Promise<any> => {\n const result = await Fetchers.createAccountsOauthDisconnectCreate(data, client)\n // Revalidate related queries\n mutate('cfg-accounts-oauth-disconnect')\n return result\n }\n}\n\n\n/**\n * Start GitHub OAuth\n *\n * @method POST\n * @path /cfg/accounts/oauth/github/authorize/\n */\nexport function useCreateAccountsOauthGithubAuthorizeCreate() {\n const { mutate } = useSWRConfig()\n\n return async (data: OAuthAuthorizeRequestRequest, client?: API): Promise<OAuthAuthorizeResponse> => {\n const result = await Fetchers.createAccountsOauthGithubAuthorizeCreate(data, client)\n // Revalidate related queries\n mutate('cfg-accounts-oauth-github-authorize')\n return result\n }\n}\n\n\n/**\n * Complete GitHub OAuth\n *\n * @method POST\n * @path /cfg/accounts/oauth/github/callback/\n */\nexport function useCreateAccountsOauthGithubCallbackCreate() {\n const { mutate } = useSWRConfig()\n\n return async (data: OAuthCallbackRequestRequest, client?: API): Promise<OAuthTokenResponse> => {\n const result = await Fetchers.createAccountsOauthGithubCallbackCreate(data, client)\n // Revalidate related queries\n mutate('cfg-accounts-oauth-github-callback')\n return result\n }\n}\n\n\n/**\n * List OAuth providers\n *\n * @method GET\n * @path /cfg/accounts/oauth/providers/\n */\nexport function useAccountsOauthProvidersRetrieve(client?: API): ReturnType<typeof useSWR<OAuthProvidersResponse>> {\n return useSWR<OAuthProvidersResponse>(\n 'cfg-accounts-oauth-provider',\n () => Fetchers.getAccountsOauthProvidersRetrieve(client)\n )\n}\n\n\n","// Auto-generated by DjangoCFG - see CLAUDE.md\n'use client';\n\n/**\n * SWR Hooks for User Profile\n *\n * React hooks powered by SWR for data fetching with automatic caching,\n * revalidation, and optimistic updates.\n *\n * Usage:\n * ```typescript\n * // Query hooks (GET)\n * const { data, error, isLoading } = useUsers({ page: 1 })\n *\n * // Mutation hooks (POST/PUT/PATCH/DELETE)\n * const createUser = useCreateUser()\n * await createUser({ name: 'John', email: 'john@example.com' })\n * ```\n */\nimport useSWR from 'swr'\nimport { useSWRConfig } from 'swr'\nimport * as Fetchers from '../fetchers/accounts__user_profile'\nimport type { API } from '../../index'\nimport type { PatchedUserProfileUpdateRequest } from '../schemas/PatchedUserProfileUpdateRequest.schema'\nimport type { User } from '../schemas/User.schema'\nimport type { UserProfileUpdateRequest } from '../schemas/UserProfileUpdateRequest.schema'\n\n/**\n * Get current user profile\n *\n * @method GET\n * @path /cfg/accounts/profile/\n */\nexport function useAccountsProfileRetrieve(client?: API): ReturnType<typeof useSWR<User>> {\n return useSWR<User>(\n 'cfg-accounts-profile',\n () => Fetchers.getAccountsProfileRetrieve(client)\n )\n}\n\n\n/**\n * Upload user avatar\n *\n * @method POST\n * @path /cfg/accounts/profile/avatar/\n */\nexport function useCreateAccountsProfileAvatarCreate() {\n const { mutate } = useSWRConfig()\n\n return async (data: any, client?: API): Promise<User> => {\n const result = await Fetchers.createAccountsProfileAvatarCreate(data, client)\n // Revalidate related queries\n mutate('cfg-accounts-profile-avatar')\n return result\n }\n}\n\n\n/**\n * Partial update user profile\n *\n * @method PUT\n * @path /cfg/accounts/profile/partial/\n */\nexport function usePartialUpdateAccountsProfilePartialUpdate() {\n const { mutate } = useSWRConfig()\n\n return async (data: UserProfileUpdateRequest, client?: API): Promise<User> => {\n const result = await Fetchers.partialUpdateAccountsProfilePartialUpdate(data, client)\n // Revalidate related queries\n mutate('cfg-accounts-profile-partial')\n return result\n }\n}\n\n\n/**\n * Partial update user profile\n *\n * @method PATCH\n * @path /cfg/accounts/profile/partial/\n */\nexport function usePartialUpdateAccountsProfilePartialPartialUpdate() {\n const { mutate } = useSWRConfig()\n\n return async (data?: PatchedUserProfileUpdateRequest, client?: API): Promise<User> => {\n const result = await Fetchers.partialUpdateAccountsProfilePartialPartialUpdate(data, client)\n // Revalidate related queries\n mutate('cfg-accounts-profile-partial-partial')\n return result\n }\n}\n\n\n/**\n * Update user profile\n *\n * @method PUT\n * @path /cfg/accounts/profile/update/\n */\nexport function useUpdateAccountsProfileUpdateUpdate() {\n const { mutate } = useSWRConfig()\n\n return async (data: UserProfileUpdateRequest, client?: API): Promise<User> => {\n const result = await Fetchers.updateAccountsProfileUpdateUpdate(data, client)\n // Revalidate related queries\n mutate('cfg-accounts-profile')\n return result\n }\n}\n\n\n/**\n * Update user profile\n *\n * @method PATCH\n * @path /cfg/accounts/profile/update/\n */\nexport function usePartialUpdateAccountsProfileUpdatePartialUpdate() {\n const { mutate } = useSWRConfig()\n\n return async (data?: PatchedUserProfileUpdateRequest, client?: API): Promise<User> => {\n const result = await Fetchers.partialUpdateAccountsProfileUpdatePartialUpdate(data, client)\n // Revalidate related queries\n mutate('cfg-accounts-profile-partial')\n return result\n }\n}\n\n\n","// Auto-generated by DjangoCFG - see CLAUDE.md\n'use client';\n\n/**\n * SWR Hooks for Accounts\n *\n * React hooks powered by SWR for data fetching with automatic caching,\n * revalidation, and optimistic updates.\n *\n * Usage:\n * ```typescript\n * // Query hooks (GET)\n * const { data, error, isLoading } = useUsers({ page: 1 })\n *\n * // Mutation hooks (POST/PUT/PATCH/DELETE)\n * const createUser = useCreateUser()\n * await createUser({ name: 'John', email: 'john@example.com' })\n * ```\n */\nimport { useSWRConfig } from 'swr'\nimport * as Fetchers from '../fetchers/accounts'\nimport type { API } from '../../index'\nimport type { OTPRequestRequest } from '../schemas/OTPRequestRequest.schema'\nimport type { OTPRequestResponse } from '../schemas/OTPRequestResponse.schema'\nimport type { OTPVerifyRequest } from '../schemas/OTPVerifyRequest.schema'\nimport type { OTPVerifyResponse } from '../schemas/OTPVerifyResponse.schema'\n\n/**\n * API operation\n *\n * @method POST\n * @path /cfg/accounts/otp/request/\n */\nexport function useCreateAccountsOtpRequestCreate() {\n const { mutate } = useSWRConfig()\n\n return async (data: OTPRequestRequest, client?: API): Promise<OTPRequestResponse> => {\n const result = await Fetchers.createAccountsOtpRequestCreate(data, client)\n // Revalidate related queries\n mutate('cfg-accounts-otp-request')\n return result\n }\n}\n\n\n/**\n * API operation\n *\n * @method POST\n * @path /cfg/accounts/otp/verify/\n */\nexport function useCreateAccountsOtpVerifyCreate() {\n const { mutate } = useSWRConfig()\n\n return async (data: OTPVerifyRequest, client?: API): Promise<OTPVerifyResponse> => {\n const result = await Fetchers.createAccountsOtpVerifyCreate(data, client)\n // Revalidate related queries\n mutate('cfg-accounts-otp-verify')\n return result\n }\n}\n\n\n","\"use client\"\n\nimport { useEffect, useState } from 'react';\n\nimport { useCfgRouter } from '@djangocfg/ui-nextjs/hooks';\n\nimport { useAuth } from '../context';\n\ninterface UseAuthGuardOptions {\n redirectTo?: string;\n requireAuth?: boolean;\n /** Whether to save current URL for redirect after auth (default: true) */\n saveRedirectUrl?: boolean;\n}\n\nexport const useAuthGuard = (options: UseAuthGuardOptions = {}) => {\n const { redirectTo = '/auth', requireAuth = true, saveRedirectUrl: shouldSaveUrl = true } = options;\n const { isAuthenticated, isLoading, saveRedirectUrl } = useAuth();\n const router = useCfgRouter();\n const [isRedirecting, setIsRedirecting] = useState(false);\n\n useEffect(() => {\n if (!isLoading && requireAuth && !isAuthenticated && !isRedirecting) {\n // Save current URL before redirecting\n if (shouldSaveUrl && typeof window !== 'undefined') {\n const currentUrl = window.location.pathname + window.location.search;\n saveRedirectUrl(currentUrl);\n }\n\n setIsRedirecting(true);\n router.push(redirectTo);\n }\n }, [isAuthenticated, isLoading, router, redirectTo, requireAuth, isRedirecting, shouldSaveUrl, saveRedirectUrl]);\n\n return { isAuthenticated, isLoading, isRedirecting };\n}; ","'use client';\n\nimport { useEffect, useState } from 'react';\n\nimport { authLogger } from '../utils/logger';\n\n/**\n * Simple localStorage hook with better error handling\n * @param key - Storage key\n * @param initialValue - Default value if key doesn't exist\n * @returns [value, setValue, removeValue] - Current value, setter function, and remove function\n */\nexport function useLocalStorage<T>(key: string, initialValue: T) {\n // Get initial value from localStorage or use provided initialValue\n const [storedValue, setStoredValue] = useState<T>(() => {\n if (typeof window === 'undefined') {\n return initialValue;\n }\n\n try {\n const item = window.localStorage.getItem(key);\n if (item === null) {\n return initialValue;\n }\n \n // Try to parse as JSON first, fallback to string\n try {\n return JSON.parse(item);\n } catch {\n // If JSON.parse fails, return as string\n return item as T;\n }\n } catch (error) {\n authLogger.error(`Error reading localStorage key \"${key}\":`, error);\n return initialValue;\n }\n });\n\n // Check data size and limit\n const checkDataSize = (data: any): boolean => {\n try {\n const jsonString = JSON.stringify(data);\n const sizeInBytes = new Blob([jsonString]).size;\n const sizeInKB = sizeInBytes / 1024;\n \n // Limit to 1MB per item\n if (sizeInKB > 1024) {\n authLogger.warn(`Data size (${sizeInKB.toFixed(2)}KB) exceeds 1MB limit for key \"${key}\"`);\n return false;\n }\n\n return true;\n } catch (error) {\n authLogger.error(`Error checking data size for key \"${key}\":`, error);\n return false;\n }\n };\n\n // Clear old data when localStorage is full\n const clearOldData = () => {\n try {\n const keys = Object.keys(localStorage).filter(key => key && typeof key === 'string');\n // Remove oldest items if we have more than 50 items\n if (keys.length > 50) {\n const itemsToRemove = Math.ceil(keys.length * 0.2);\n for (let i = 0; i < itemsToRemove; i++) {\n try {\n const key = keys[i];\n if (key) {\n localStorage.removeItem(key);\n localStorage.removeItem(`${key}_timestamp`);\n }\n } catch {\n // Ignore errors when removing items\n }\n }\n }\n } catch (error) {\n authLogger.error('Error clearing old localStorage data:', error);\n }\n };\n\n // Force clear all data if quota is exceeded\n const forceClearAll = () => {\n try {\n const keys = Object.keys(localStorage);\n for (const key of keys) {\n try {\n localStorage.removeItem(key);\n } catch {\n // Ignore errors when removing items\n }\n }\n } catch (error) {\n authLogger.error('Error force clearing localStorage:', error);\n }\n };\n\n // Update localStorage when value changes\n const setValue = (value: T | ((val: T) => T)) => {\n try {\n const valueToStore = value instanceof Function ? value(storedValue) : value;\n \n // Check data size before attempting to save\n if (!checkDataSize(valueToStore)) {\n authLogger.warn(`Data size too large for key \"${key}\", removing key`);\n // Remove the key if data is too large\n try {\n window.localStorage.removeItem(key);\n window.localStorage.removeItem(`${key}_timestamp`);\n } catch {\n // Ignore errors when removing\n }\n // Still update the state\n setStoredValue(valueToStore);\n return;\n }\n \n setStoredValue(valueToStore);\n\n if (typeof window !== 'undefined') {\n // Try to set the value\n try {\n // For strings, store directly without JSON.stringify\n if (typeof valueToStore === 'string') {\n window.localStorage.setItem(key, valueToStore);\n } else {\n window.localStorage.setItem(key, JSON.stringify(valueToStore));\n }\n // Add timestamp for cleanup\n window.localStorage.setItem(`${key}_timestamp`, Date.now().toString());\n } catch (storageError: any) {\n // If quota exceeded, clear old data and try again\n if (storageError.name === 'QuotaExceededError' ||\n storageError.code === 22 ||\n storageError.message?.includes('quota')) {\n authLogger.warn('localStorage quota exceeded, clearing old data...');\n clearOldData();\n \n // Try again after clearing\n try {\n // For strings, store directly without JSON.stringify\n if (typeof valueToStore === 'string') {\n window.localStorage.setItem(key, valueToStore);\n } else {\n window.localStorage.setItem(key, JSON.stringify(valueToStore));\n }\n window.localStorage.setItem(`${key}_timestamp`, Date.now().toString());\n } catch (retryError) {\n authLogger.error(`Failed to set localStorage key \"${key}\" after clearing old data:`, retryError);\n // If still fails, force clear all and try one more time\n try {\n forceClearAll();\n // For strings, store directly without JSON.stringify\n if (typeof valueToStore === 'string') {\n window.localStorage.setItem(key, valueToStore);\n } else {\n window.localStorage.setItem(key, JSON.stringify(valueToStore));\n }\n window.localStorage.setItem(`${key}_timestamp`, Date.now().toString());\n } catch (finalError) {\n authLogger.error(`Failed to set localStorage key \"${key}\" after force clearing:`, finalError);\n // If still fails, just update the state without localStorage\n setStoredValue(valueToStore);\n }\n }\n } else {\n throw storageError;\n }\n }\n }\n } catch (error) {\n authLogger.error(`Error setting localStorage key \"${key}\":`, error);\n // Still update the state even if localStorage fails\n const valueToStore = value instanceof Function ? value(storedValue) : value;\n setStoredValue(valueToStore);\n }\n };\n\n // Remove value from localStorage\n const removeValue = () => {\n try {\n setStoredValue(initialValue);\n if (typeof window !== 'undefined') {\n try {\n window.localStorage.removeItem(key);\n window.localStorage.removeItem(`${key}_timestamp`);\n } catch (removeError: any) {\n // If removal fails due to quota, try to clear some data first\n if (removeError.name === 'QuotaExceededError' ||\n removeError.code === 22 ||\n removeError.message?.includes('quota')) {\n authLogger.warn('localStorage quota exceeded during removal, clearing old data...');\n clearOldData();\n \n try {\n window.localStorage.removeItem(key);\n window.localStorage.removeItem(`${key}_timestamp`);\n } catch (retryError) {\n authLogger.error(`Failed to remove localStorage key \"${key}\" after clearing:`, retryError);\n // If still fails, force clear all\n forceClearAll();\n }\n } else {\n throw removeError;\n }\n }\n }\n } catch (error) {\n authLogger.error(`Error removing localStorage key \"${key}\":`, error);\n }\n };\n\n return [storedValue, setValue, removeValue] as const;\n}\n","\"use client\"\n\nimport { useCallback, useEffect, useState } from 'react';\n\nimport { useAuth } from '../context';\nimport { authLogger } from '../utils/logger';\nimport { useAutoAuth } from './useAutoAuth';\nimport { useLocalStorage } from './useLocalStorage';\n\nexport interface AuthFormState {\n identifier: string; // Email or phone number\n channel: 'email' | 'phone';\n otp: string;\n isLoading: boolean;\n acceptedTerms: boolean;\n step: 'identifier' | 'otp';\n error: string;\n}\n\nexport interface AuthFormHandlers {\n setIdentifier: (identifier: string) => void;\n setChannel: (channel: 'email' | 'phone') => void;\n setOtp: (otp: string) => void;\n setAcceptedTerms: (accepted: boolean) => void;\n setError: (error: string) => void;\n clearError: () => void;\n handleIdentifierSubmit: (e: React.FormEvent) => Promise<void>;\n handleOTPSubmit: (e: React.FormEvent) => Promise<void>;\n handleResendOTP: () => Promise<void>;\n handleBackToIdentifier: () => void;\n forceOTPStep: () => void;\n // Utility methods\n detectChannelFromIdentifier: (identifier: string) => 'email' | 'phone' | null;\n validateIdentifier: (identifier: string, channel?: 'email' | 'phone') => boolean;\n}\n\nexport interface UseAuthFormOptions {\n onIdentifierSuccess?: (identifier: string, channel: 'email' | 'phone') => void;\n onOTPSuccess?: () => void;\n onError?: (message: string) => void;\n sourceUrl: string;\n /** URL to redirect after successful OTP verification */\n redirectUrl?: string;\n /** If true, user must accept terms before submitting. Default: false */\n requireTermsAcceptance?: boolean;\n /** Path to auth page for auto-OTP detection. Default: '/auth' */\n authPath?: string;\n}\n\nexport const useAuthForm = (options: UseAuthFormOptions): AuthFormState & AuthFormHandlers => {\n const { onIdentifierSuccess, onOTPSuccess, onError, sourceUrl, redirectUrl, requireTermsAcceptance = false, authPath = '/auth' } = options;\n \n // Form state\n const [identifier, setIdentifier] = useState('');\n const [channel, setChannel] = useState<'email' | 'phone'>('email');\n const [otp, setOtp] = useState('');\n const [isLoading, setIsLoading] = useState(false);\n const [acceptedTerms, setAcceptedTerms] = useState(false);\n const [step, setStep] = useState<'identifier' | 'otp'>('identifier');\n const [error, setError] = useState('');\n \n\n \n // Auth hooks\n const { requestOTP, verifyOTP, getSavedEmail, saveEmail, getSavedPhone, savePhone } = useAuth();\n const [savedTermsAccepted, setSavedTermsAccepted] = useLocalStorage('auth_terms_accepted', false);\n const [savedEmail, setSavedEmail] = useLocalStorage('auth_email', '');\n const [savedPhone, setSavedPhone] = useLocalStorage('auth_phone', '');\n\n // Utility functions\n const detectChannelFromIdentifier = useCallback((identifier: string): 'email' | 'phone' | null => {\n if (!identifier) return null;\n \n // Email detection\n if (identifier.includes('@')) {\n return 'email';\n }\n \n // Phone detection (starts with + and contains digits)\n if (identifier.startsWith('+') && /^\\+[1-9]\\d{6,14}$/.test(identifier)) {\n return 'phone';\n }\n \n return null;\n }, []);\n\n const validateIdentifier = useCallback((identifier: string, channelType?: 'email' | 'phone'): boolean => {\n if (!identifier) return false;\n \n const detectedChannel = channelType || detectChannelFromIdentifier(identifier);\n \n if (detectedChannel === 'email') {\n // Basic email validation\n return /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(identifier);\n } else if (detectedChannel === 'phone') {\n // E.164 phone validation\n return /^\\+[1-9]\\d{6,14}$/.test(identifier);\n }\n \n return false;\n }, [detectChannelFromIdentifier]);\n\n // Load saved data on mount\n useEffect(() => {\n const authSavedEmail = getSavedEmail();\n const authSavedPhone = getSavedPhone();\n \n // Prioritize phone over email if both exist\n if (authSavedPhone) {\n setIdentifier(authSavedPhone);\n setChannel('phone');\n } else if (authSavedEmail) {\n setIdentifier(authSavedEmail);\n setChannel('email');\n }\n \n if (savedTermsAccepted) {\n setAcceptedTerms(savedTermsAccepted);\n }\n }, [getSavedEmail, getSavedPhone, savedTermsAccepted]);\n\n // Auto-detect channel when identifier changes\n useEffect(() => {\n if (identifier) {\n const detectedChannel = detectChannelFromIdentifier(identifier);\n if (detectedChannel && detectedChannel !== channel) {\n setChannel(detectedChannel);\n }\n }\n }, [identifier, channel, detectChannelFromIdentifier]);\n\n\n\n const clearError = useCallback(() => setError(''), []);\n\n const handleIdentifierSubmit = useCallback(async (e: React.FormEvent) => {\n e.preventDefault();\n \n if (!identifier) {\n const message = channel === 'phone' ? 'Please enter your phone number' : 'Please enter your email address';\n setError(message);\n onError?.(message);\n return;\n }\n\n // Validate identifier format\n if (!validateIdentifier(identifier, channel)) {\n const message = channel === 'phone' \n ? 'Please enter a valid phone number (e.g., +1234567890)' \n : 'Please enter a valid email address';\n setError(message);\n onError?.(message);\n return;\n }\n\n if (requireTermsAcceptance && !acceptedTerms) {\n const message = 'Please accept the Terms of Service and Privacy Policy';\n setError(message);\n onError?.(message);\n return;\n }\n\n setIsLoading(true);\n clearError();\n \n try {\n const result = await requestOTP(identifier, channel, sourceUrl);\n \n if (result.success) {\n // Save identifier and terms acceptance on successful request, clear opposite channel\n if (channel === 'email') {\n saveEmail(identifier);\n setSavedPhone(''); // Clear phone storage\n } else if (channel === 'phone') {\n savePhone(identifier);\n setSavedEmail(''); // Clear email storage\n }\n setSavedTermsAccepted(true);\n setStep('otp');\n onIdentifierSuccess?.(identifier, channel);\n } else {\n setError(result.message);\n onError?.(result.message);\n }\n } catch (error) {\n const message = 'An unexpected error occurred';\n setError(message);\n onError?.(message);\n } finally {\n setIsLoading(false);\n }\n }, [identifier, channel, acceptedTerms, validateIdentifier, requestOTP, saveEmail, clearError, setSavedTermsAccepted, onIdentifierSuccess, onError, sourceUrl]);\n\n const handleOTPSubmit = useCallback(async (e: React.FormEvent) => {\n e.preventDefault();\n\n if (!otp || otp.length < 6) {\n const message = 'Please enter the 6-digit verification code';\n setError(message);\n onError?.(message);\n return;\n }\n\n setIsLoading(true);\n clearError();\n\n try {\n const result = await verifyOTP(identifier, otp, channel, sourceUrl, redirectUrl);\n\n if (result.success) {\n // Save identifier on successful login, clear opposite channel\n if (channel === 'email') {\n setSavedEmail(identifier);\n setSavedPhone(''); // Clear phone storage\n } else if (channel === 'phone') {\n setSavedPhone(identifier);\n setSavedEmail(''); // Clear email storage\n }\n onOTPSuccess?.();\n } else {\n setError(result.message);\n onError?.(result.message);\n }\n } catch (error) {\n const message = 'An unexpected error occurred';\n setError(message);\n onError?.(message);\n } finally {\n setIsLoading(false);\n }\n }, [identifier, otp, channel, verifyOTP, clearError, setSavedEmail, onOTPSuccess, onError, sourceUrl, redirectUrl]);\n\n const handleResendOTP = useCallback(async () => {\n setIsLoading(true);\n clearError();\n \n try {\n const result = await requestOTP(identifier, channel, sourceUrl);\n \n if (result.success) {\n // Save identifier and clear OTP input, clear opposite channel\n if (channel === 'email') {\n saveEmail(identifier);\n setSavedPhone(''); // Clear phone storage\n } else if (channel === 'phone') {\n savePhone(identifier);\n setSavedEmail(''); // Clear email storage\n }\n setOtp('');\n } else {\n setError(result.message);\n onError?.(result.message);\n }\n } catch (error) {\n const message = 'Failed to resend verification code';\n setError(message);\n onError?.(message);\n } finally {\n setIsLoading(false);\n }\n }, [identifier, channel, requestOTP, saveEmail, clearError, setOtp, onError, sourceUrl]);\n\n const handleBackToIdentifier = useCallback(() => {\n setStep('identifier');\n clearError();\n }, [clearError]);\n\n const forceOTPStep = useCallback(() => {\n setStep('otp');\n clearError();\n }, [clearError]);\n\n const handleAcceptedTermsChange = useCallback((checked: boolean) => {\n setAcceptedTerms(checked);\n setSavedTermsAccepted(checked);\n }, [setSavedTermsAccepted]);\n\n // Auto-detect OTP from URL query parameters (only on auth page)\n useAutoAuth({\n allowedPaths: [authPath],\n onOTPDetected: (otp: string) => {\n authLogger.info('OTP detected, auto-submitting');\n\n // Get saved identifier from auth context\n const savedEmail = getSavedEmail();\n const savedPhone = getSavedPhone();\n\n // Prioritize phone over email if both exist\n if (savedPhone) {\n setIdentifier(savedPhone);\n setChannel('phone');\n } else if (savedEmail) {\n setIdentifier(savedEmail);\n setChannel('email');\n }\n\n // Set OTP and force OTP step\n setOtp(otp);\n setStep('otp');\n\n // Auto-submit after a short delay to ensure state is updated\n setTimeout(() => {\n const fakeEvent = { preventDefault: () => {} } as React.FormEvent;\n handleOTPSubmit(fakeEvent);\n }, 200);\n },\n cleanupUrl: true,\n });\n\n return {\n // Form state\n identifier,\n channel,\n otp,\n isLoading,\n acceptedTerms,\n step,\n error,\n \n // Form handlers\n setIdentifier,\n setChannel,\n setOtp,\n setAcceptedTerms: handleAcceptedTermsChange,\n setError,\n clearError,\n \n // Auth handlers\n handleIdentifierSubmit,\n handleOTPSubmit,\n handleResendOTP,\n handleBackToIdentifier,\n forceOTPStep,\n \n // Utility methods\n detectChannelFromIdentifier,\n validateIdentifier,\n };\n}; ","'use client';\n\nimport { usePathname } from 'next/navigation';\nimport { useEffect } from 'react';\n\nimport { useCfgRouter, useQueryParams } from '@djangocfg/ui-nextjs/hooks';\n\nimport { authLogger } from '../utils/logger';\n\nexport interface UseAutoAuthOptions {\n onOTPDetected?: (otp: string) => void;\n cleanupUrl?: boolean;\n /** Paths where auto-auth should be active. Default: ['/auth'] */\n allowedPaths?: string[];\n}\n\n/**\n * Hook for automatic authentication from URL query parameters\n * Detects OTP from URL and triggers callback\n */\nexport const useAutoAuth = (options: UseAutoAuthOptions = {}) => {\n const { onOTPDetected, cleanupUrl = true, allowedPaths = ['/auth'] } = options;\n const queryParams = useQueryParams();\n const pathname = usePathname();\n const router = useCfgRouter();\n\n // Check if current path is in allowed paths\n const isAllowedPath = allowedPaths.some(path => pathname === path || pathname?.startsWith(path + '/'));\n\n const hasOTP = !!(queryParams.get('otp'));\n const isReady = !!pathname && hasOTP && isAllowedPath;\n\n useEffect(() => {\n if (!isReady) return;\n\n const queryOtp = queryParams.get('otp') as string;\n\n // Handle OTP detection - only on allowed paths to avoid conflicts with other pages\n // (e.g., /dashboard/device uses ?otp= for device authorization, not user auth)\n if (queryOtp && typeof queryOtp === 'string' && queryOtp.length === 6) {\n authLogger.info('OTP detected in URL on auth page:', queryOtp);\n onOTPDetected?.(queryOtp);\n }\n\n // Clean up URL to remove sensitive params for security\n if (cleanupUrl && queryOtp) {\n const cleanQuery = Object.fromEntries(queryParams.entries());\n delete cleanQuery.otp;\n const queryString = new URLSearchParams(cleanQuery).toString();\n router.push(queryString ? `${pathname}?${queryString}` : pathname);\n }\n }, [pathname, queryParams, onOTPDetected, cleanupUrl, router, isReady]);\n\n return {\n isReady,\n hasOTP,\n isAllowedPath,\n };\n};\n","'use client';\n\nimport { useCallback, useState } from 'react';\n\nimport { useCfgRouter } from '@djangocfg/ui-nextjs/hooks';\n\nimport { apiAccounts } from '../../clients';\nimport { Analytics, AnalyticsCategory, AnalyticsEvent } from '../utils/analytics';\nimport { authLogger } from '../utils/logger';\n\nexport interface UseGithubAuthOptions {\n sourceUrl?: string;\n onSuccess?: (user: any, isNewUser: boolean) => void;\n onError?: (error: string) => void;\n redirectUrl?: string;\n}\n\nexport interface UseGithubAuthReturn {\n isLoading: boolean;\n error: string | null;\n startGithubAuth: () => Promise<void>;\n handleGithubCallback: (code: string, state: string) => Promise<void>;\n}\n\n/**\n * Hook for GitHub OAuth authentication flow.\n *\n * Usage:\n * 1. Call startGithubAuth() to redirect user to GitHub\n * 2. After GitHub redirects back, call handleGithubCallback(code, state)\n *\n * @example\n * ```tsx\n * const { isLoading, error, startGithubAuth } = useGithubAuth({\n * onSuccess: (user) => router.push('/dashboard'),\n * onError: (error) => console.error(error),\n * });\n *\n * <Button onClick={startGithubAuth} disabled={isLoading}>\n * Continue with GitHub\n * </Button>\n * ```\n */\nexport const useGithubAuth = (options: UseGithubAuthOptions = {}): UseGithubAuthReturn => {\n const { sourceUrl, onSuccess, onError, redirectUrl } = options;\n const router = useCfgRouter();\n\n const [isLoading, setIsLoading] = useState(false);\n const [error, setError] = useState<string | null>(null);\n\n /**\n * Start GitHub OAuth flow - redirects user to GitHub authorization page.\n */\n const startGithubAuth = useCallback(async () => {\n setIsLoading(true);\n setError(null);\n\n try {\n authLogger.info('Starting GitHub OAuth flow...');\n\n // Track OAuth start\n Analytics.event(AnalyticsEvent.AUTH_OAUTH_START, {\n category: AnalyticsCategory.AUTH,\n label: 'github',\n });\n\n // Call API to get authorization URL\n // The API will auto-generate redirect_uri from config if not provided\n const response = await apiAccounts.oauth.accountsOauthGithubAuthorizeCreate({\n source_url: sourceUrl || (typeof window !== 'undefined' ? window.location.href : ''),\n });\n\n if (!response.authorization_url) {\n throw new Error('Failed to get authorization URL');\n }\n\n authLogger.info('Redirecting to GitHub...', response.authorization_url);\n\n // Store state in sessionStorage for verification on callback\n if (typeof window !== 'undefined') {\n sessionStorage.setItem('oauth_state', response.state);\n sessionStorage.setItem('oauth_provider', 'github');\n }\n\n // Redirect to GitHub\n window.location.href = response.authorization_url;\n\n } catch (err) {\n const errorMessage = err instanceof Error ? err.message : 'Failed to start GitHub authentication';\n authLogger.error('GitHub OAuth start error:', err);\n setError(errorMessage);\n onError?.(errorMessage);\n\n // Track OAuth error\n Analytics.event(AnalyticsEvent.AUTH_OAUTH_FAIL, {\n category: AnalyticsCategory.AUTH,\n label: 'github',\n });\n } finally {\n setIsLoading(false);\n }\n }, [sourceUrl, onError]);\n\n /**\n * Handle GitHub OAuth callback - exchanges code for JWT tokens.\n *\n * @param code - Authorization code from GitHub callback\n * @param state - State token for CSRF verification\n */\n const handleGithubCallback = useCallback(async (code: string, state: string) => {\n setIsLoading(true);\n setError(null);\n\n try {\n authLogger.info('Processing GitHub OAuth callback...');\n\n // Verify state matches what we stored\n if (typeof window !== 'undefined') {\n const storedState = sessionStorage.getItem('oauth_state');\n if (storedState && storedState !== state) {\n throw new Error('Invalid OAuth state - possible CSRF attack');\n }\n // Clear stored state\n sessionStorage.removeItem('oauth_state');\n sessionStorage.removeItem('oauth_provider');\n }\n\n // Exchange code for tokens\n // The API will auto-generate redirect_uri from config if not provided\n const response = await apiAccounts.oauth.accountsOauthGithubCallbackCreate({\n code,\n state,\n });\n\n if (!response.access || !response.refresh) {\n throw new Error('Invalid response from OAuth callback');\n }\n\n authLogger.info('GitHub OAuth successful, user:', response.user);\n\n // Save tokens using API client\n apiAccounts.setToken(response.access, response.refresh);\n\n // Track successful OAuth\n Analytics.event(AnalyticsEvent.AUTH_LOGIN_SUCCESS, {\n category: AnalyticsCategory.AUTH,\n label: 'github',\n });\n\n // Set user ID for future tracking\n if (response.user?.id) {\n Analytics.setUser(String(response.user.id));\n }\n\n // Call success callback\n onSuccess?.(response.user, response.is_new_user || false);\n\n // Redirect to dashboard or specified URL\n // Use hardPush for full page reload - ensures all React contexts reinitialize\n const finalRedirectUrl = redirectUrl || '/dashboard';\n router.hardPush(finalRedirectUrl);\n\n } catch (err) {\n const errorMessage = err instanceof Error ? err.message : 'GitHub authentication failed';\n authLogger.error('GitHub OAuth callback error:', err);\n setError(errorMessage);\n onError?.(errorMessage);\n\n // Track OAuth error\n Analytics.event(AnalyticsEvent.AUTH_OAUTH_FAIL, {\n category: AnalyticsCategory.AUTH,\n label: 'github',\n });\n } finally {\n setIsLoading(false);\n }\n }, [onSuccess, onError, redirectUrl, router]);\n\n return {\n isLoading,\n error,\n startGithubAuth,\n handleGithubCallback,\n };\n};\n","// Auto-generated by DjangoCFG - see CLAUDE.md\n'use client';\n\n/**\n * SWR Hooks for Web Push\n *\n * React hooks powered by SWR for data fetching with automatic caching,\n * revalidation, and optimistic updates.\n *\n * Usage:\n * ```typescript\n * // Query hooks (GET)\n * const { data, error, isLoading } = useUsers({ page: 1 })\n *\n * // Mutation hooks (POST/PUT/PATCH/DELETE)\n * const createUser = useCreateUser()\n * await createUser({ name: 'John', email: 'john@example.com' })\n * ```\n */\nimport useSWR from 'swr'\nimport { useSWRConfig } from 'swr'\nimport * as Fetchers from '../fetchers/webpush__web_push'\nimport type { API } from '../../index'\nimport type { SendPushRequestRequest } from '../schemas/SendPushRequestRequest.schema'\nimport type { SendPushResponse } from '../schemas/SendPushResponse.schema'\nimport type { SubscribeRequestRequest } from '../schemas/SubscribeRequestRequest.schema'\nimport type { SubscribeResponse } from '../schemas/SubscribeResponse.schema'\nimport type { VapidPublicKeyResponse } from '../schemas/VapidPublicKeyResponse.schema'\n\n/**\n * Send push notification\n *\n * @method POST\n * @path /cfg/webpush/send/\n */\nexport function useCreateWebpushSendCreate() {\n const { mutate } = useSWRConfig()\n\n return async (data: SendPushRequestRequest, client?: API): Promise<SendPushResponse> => {\n const result = await Fetchers.createWebpushSendCreate(data, client)\n // Revalidate related queries\n mutate('cfg-webpush-send')\n return result\n }\n}\n\n\n/**\n * Subscribe to push notifications\n *\n * @method POST\n * @path /cfg/webpush/subscribe/\n */\nexport function useCreateWebpushSubscribeCreate() {\n const { mutate } = useSWRConfig()\n\n return async (data: SubscribeRequestRequest, client?: API): Promise<SubscribeResponse> => {\n const result = await Fetchers.createWebpushSubscribeCreate(data, client)\n // Revalidate related queries\n mutate('cfg-webpush-subscribe')\n return result\n }\n}\n\n\n/**\n * Get VAPID public key\n *\n * @method GET\n * @path /cfg/webpush/vapid/\n */\nexport function useWebpushVapidRetrieve(client?: API): ReturnType<typeof useSWR<VapidPublicKeyResponse>> {\n return useSWR<VapidPublicKeyResponse>(\n 'cfg-webpush-vapid',\n () => Fetchers.getWebpushVapidRetrieve(client)\n )\n}\n\n\n","// Auto-generated by DjangoCFG - see CLAUDE.md\n'use client';\n\n/**\n * SWR Hooks for Centrifugo Admin API\n *\n * React hooks powered by SWR for data fetching with automatic caching,\n * revalidation, and optimistic updates.\n *\n * Usage:\n * ```typescript\n * // Query hooks (GET)\n * const { data, error, isLoading } = useUsers({ page: 1 })\n *\n * // Mutation hooks (POST/PUT/PATCH/DELETE)\n * const createUser = useCreateUser()\n * await createUser({ name: 'John', email: 'john@example.com' })\n * ```\n */\nimport { useSWRConfig } from 'swr'\nimport * as Fetchers from '../fetchers/centrifugo__centrifugo_admin_api'\nimport type { API } from '../../index'\nimport type { CentrifugoChannelsRequestRequest } from '../schemas/CentrifugoChannelsRequestRequest.schema'\nimport type { CentrifugoChannelsResponse } from '../schemas/CentrifugoChannelsResponse.schema'\nimport type { CentrifugoHistoryRequestRequest } from '../schemas/CentrifugoHistoryRequestRequest.schema'\nimport type { CentrifugoHistoryResponse } from '../schemas/CentrifugoHistoryResponse.schema'\nimport type { CentrifugoInfoResponse } from '../schemas/CentrifugoInfoResponse.schema'\nimport type { CentrifugoPresenceRequestRequest } from '../schemas/CentrifugoPresenceRequestRequest.schema'\nimport type { CentrifugoPresenceResponse } from '../schemas/CentrifugoPresenceResponse.schema'\nimport type { CentrifugoPresenceStatsRequestRequest } from '../schemas/CentrifugoPresenceStatsRequestRequest.schema'\nimport type { CentrifugoPresenceStatsResponse } from '../schemas/CentrifugoPresenceStatsResponse.schema'\n\n/**\n * Get connection token for dashboard\n *\n * @method POST\n * @path /cfg/centrifugo/server/auth/token/\n */\nexport function useCreateCentrifugoServerAuthTokenCreate() {\n const { mutate } = useSWRConfig()\n\n return async (client?: API): Promise<any> => {\n const result = await Fetchers.createCentrifugoServerAuthTokenCreate(client)\n // Revalidate related queries\n mutate('cfg-centrifugo-server-auth-token')\n return result\n }\n}\n\n\n/**\n * List active channels\n *\n * @method POST\n * @path /cfg/centrifugo/server/channels/\n */\nexport function useCreateCentrifugoServerChannelsCreate() {\n const { mutate } = useSWRConfig()\n\n return async (data: CentrifugoChannelsRequestRequest, client?: API): Promise<CentrifugoChannelsResponse> => {\n const result = await Fetchers.createCentrifugoServerChannelsCreate(data, client)\n // Revalidate related queries\n mutate('cfg-centrifugo-server-channels')\n return result\n }\n}\n\n\n/**\n * Get channel history\n *\n * @method POST\n * @path /cfg/centrifugo/server/history/\n */\nexport function useCreateCentrifugoServerHistoryCreate() {\n const { mutate } = useSWRConfig()\n\n return async (data: CentrifugoHistoryRequestRequest, client?: API): Promise<CentrifugoHistoryResponse> => {\n const result = await Fetchers.createCentrifugoServerHistoryCreate(data, client)\n // Revalidate related queries\n mutate('cfg-centrifugo-server-history')\n return result\n }\n}\n\n\n/**\n * Get Centrifugo server info\n *\n * @method POST\n * @path /cfg/centrifugo/server/info/\n */\nexport function useCreateCentrifugoServerInfoCreate() {\n const { mutate } = useSWRConfig()\n\n return async (client?: API): Promise<CentrifugoInfoResponse> => {\n const result = await Fetchers.createCentrifugoServerInfoCreate(client)\n // Revalidate related queries\n mutate('cfg-centrifugo-server-info')\n return result\n }\n}\n\n\n/**\n * Get channel presence\n *\n * @method POST\n * @path /cfg/centrifugo/server/presence/\n */\nexport function useCreateCentrifugoServerPresenceCreate() {\n const { mutate } = useSWRConfig()\n\n return async (data: CentrifugoPresenceRequestRequest, client?: API): Promise<CentrifugoPresenceResponse> => {\n const result = await Fetchers.createCentrifugoServerPresenceCreate(data, client)\n // Revalidate related queries\n mutate('cfg-centrifugo-server-presence')\n return result\n }\n}\n\n\n/**\n * Get channel presence statistics\n *\n * @method POST\n * @path /cfg/centrifugo/server/presence-stats/\n */\nexport function useCreateCentrifugoServerPresenceStatsCreate() {\n const { mutate } = useSWRConfig()\n\n return async (data: CentrifugoPresenceStatsRequestRequest, client?: API): Promise<CentrifugoPresenceStatsResponse> => {\n const result = await Fetchers.createCentrifugoServerPresenceStatsCreate(data, client)\n // Revalidate related queries\n mutate('cfg-centrifugo-server-presence-stats')\n return result\n }\n}\n\n\n","// Auto-generated by DjangoCFG - see CLAUDE.md\n'use client';\n\n/**\n * SWR Hooks for Centrifugo Auth\n *\n * React hooks powered by SWR for data fetching with automatic caching,\n * revalidation, and optimistic updates.\n *\n * Usage:\n * ```typescript\n * // Query hooks (GET)\n * const { data, error, isLoading } = useUsers({ page: 1 })\n *\n * // Mutation hooks (POST/PUT/PATCH/DELETE)\n * const createUser = useCreateUser()\n * await createUser({ name: 'John', email: 'john@example.com' })\n * ```\n */\nimport useSWR from 'swr'\nimport * as Fetchers from '../fetchers/centrifugo__centrifugo_auth'\nimport type { API } from '../../index'\nimport type { ConnectionTokenResponse } from '../schemas/ConnectionTokenResponse.schema'\n\n/**\n * Get Centrifugo connection token\n *\n * @method GET\n * @path /cfg/centrifugo/auth/token/\n */\nexport function useCentrifugoAuthTokenRetrieve(client?: API): ReturnType<typeof useSWR<ConnectionTokenResponse>> {\n return useSWR<ConnectionTokenResponse>(\n 'cfg-centrifugo-auth-token',\n () => Fetchers.getCentrifugoAuthTokenRetrieve(client)\n )\n}\n\n\n","// Auto-generated by DjangoCFG - see CLAUDE.md\n'use client';\n\n/**\n * SWR Hooks for Centrifugo Monitoring\n *\n * React hooks powered by SWR for data fetching with automatic caching,\n * revalidation, and optimistic updates.\n *\n * Usage:\n * ```typescript\n * // Query hooks (GET)\n * const { data, error, isLoading } = useUsers({ page: 1 })\n *\n * // Mutation hooks (POST/PUT/PATCH/DELETE)\n * const createUser = useCreateUser()\n * await createUser({ name: 'John', email: 'john@example.com' })\n * ```\n */\nimport useSWR from 'swr'\nimport * as Fetchers from '../fetchers/centrifugo__centrifugo_monitoring'\nimport type { API } from '../../index'\nimport type { CentrifugoHealthCheck } from '../schemas/CentrifugoHealthCheck.schema'\nimport type { CentrifugoOverviewStats } from '../schemas/CentrifugoOverviewStats.schema'\nimport type { ChannelList } from '../schemas/ChannelList.schema'\nimport type { PaginatedPublishList } from '../schemas/PaginatedPublishList.schema'\nimport type { TimelineResponse } from '../schemas/TimelineResponse.schema'\n\n/**\n * Get channel statistics\n *\n * @method GET\n * @path /cfg/centrifugo/monitor/channels/\n */\nexport function useCentrifugoMonitorChannelsRetrieve(params?: { hours?: number }, client?: API): ReturnType<typeof useSWR<ChannelList>> {\n return useSWR<ChannelList>(\n params ? ['cfg-centrifugo-monitor-channel', params] : 'cfg-centrifugo-monitor-channel',\n () => Fetchers.getCentrifugoMonitorChannelsRetrieve(params, client)\n )\n}\n\n\n/**\n * Get Centrifugo health status\n *\n * @method GET\n * @path /cfg/centrifugo/monitor/health/\n */\nexport function useCentrifugoMonitorHealthRetrieve(client?: API): ReturnType<typeof useSWR<CentrifugoHealthCheck>> {\n return useSWR<CentrifugoHealthCheck>(\n 'cfg-centrifugo-monitor-health',\n () => Fetchers.getCentrifugoMonitorHealthRetrieve(client)\n )\n}\n\n\n/**\n * Get overview statistics\n *\n * @method GET\n * @path /cfg/centrifugo/monitor/overview/\n */\nexport function useCentrifugoMonitorOverviewRetrieve(params?: { hours?: number }, client?: API): ReturnType<typeof useSWR<CentrifugoOverviewStats>> {\n return useSWR<CentrifugoOverviewStats>(\n params ? ['cfg-centrifugo-monitor-overview', params] : 'cfg-centrifugo-monitor-overview',\n () => Fetchers.getCentrifugoMonitorOverviewRetrieve(params, client)\n )\n}\n\n\n/**\n * Get recent publishes\n *\n * @method GET\n * @path /cfg/centrifugo/monitor/publishes/\n */\nexport function useCentrifugoMonitorPublishesList(params?: { channel?: string; page?: number; page_size?: number; status?: string }, client?: API): ReturnType<typeof useSWR<PaginatedPublishList>> {\n return useSWR<PaginatedPublishList>(\n params ? ['cfg-centrifugo-monitor-publishes', params] : 'cfg-centrifugo-monitor-publishes',\n () => Fetchers.getCentrifugoMonitorPublishesList(params, client)\n )\n}\n\n\n/**\n * Get publish timeline\n *\n * @method GET\n * @path /cfg/centrifugo/monitor/timeline/\n */\nexport function useCentrifugoMonitorTimelineRetrieve(params?: { hours?: number; interval?: string }, client?: API): ReturnType<typeof useSWR<TimelineResponse>> {\n return useSWR<TimelineResponse>(\n params ? ['cfg-centrifugo-monitor-timeline', params] : 'cfg-centrifugo-monitor-timeline',\n () => Fetchers.getCentrifugoMonitorTimelineRetrieve(params, client)\n )\n}\n\n\n","// Auto-generated by DjangoCFG - see CLAUDE.md\n'use client';\n\n/**\n * SWR Hooks for Centrifugo Testing\n *\n * React hooks powered by SWR for data fetching with automatic caching,\n * revalidation, and optimistic updates.\n *\n * Usage:\n * ```typescript\n * // Query hooks (GET)\n * const { data, error, isLoading } = useUsers({ page: 1 })\n *\n * // Mutation hooks (POST/PUT/PATCH/DELETE)\n * const createUser = useCreateUser()\n * await createUser({ name: 'John', email: 'john@example.com' })\n * ```\n */\nimport { useSWRConfig } from 'swr'\nimport * as Fetchers from '../fetchers/centrifugo__centrifugo_testing'\nimport type { API } from '../../index'\nimport type { ManualAckRequestRequest } from '../schemas/ManualAckRequestRequest.schema'\nimport type { ManualAckResponse } from '../schemas/ManualAckResponse.schema'\nimport type { PublishTestRequestRequest } from '../schemas/PublishTestRequestRequest.schema'\nimport type { PublishTestResponse } from '../schemas/PublishTestResponse.schema'\n\n/**\n * Publish test message\n *\n * @method POST\n * @path /cfg/centrifugo/testing/publish-test/\n */\nexport function useCreateCentrifugoTestingPublishTestCreate() {\n const { mutate } = useSWRConfig()\n\n return async (data: PublishTestRequestRequest, client?: API): Promise<PublishTestResponse> => {\n const result = await Fetchers.createCentrifugoTestingPublishTestCreate(data, client)\n // Revalidate related queries\n mutate('cfg-centrifugo-testing-publish-test')\n return result\n }\n}\n\n\n/**\n * Publish with database logging\n *\n * @method POST\n * @path /cfg/centrifugo/testing/publish-with-logging/\n */\nexport function useCreateCentrifugoTestingPublishWithLoggingCreate() {\n const { mutate } = useSWRConfig()\n\n return async (data: PublishTestRequestRequest, client?: API): Promise<PublishTestResponse> => {\n const result = await Fetchers.createCentrifugoTestingPublishWithLoggingCreate(data, client)\n // Revalidate related queries\n mutate('cfg-centrifugo-testing-publish-with-logging')\n return result\n }\n}\n\n\n/**\n * Send manual ACK\n *\n * @method POST\n * @path /cfg/centrifugo/testing/send-ack/\n */\nexport function useCreateCentrifugoTestingSendAckCreate() {\n const { mutate } = useSWRConfig()\n\n return async (data: ManualAckRequestRequest, client?: API): Promise<ManualAckResponse> => {\n const result = await Fetchers.createCentrifugoTestingSendAckCreate(data, client)\n // Revalidate related queries\n mutate('cfg-centrifugo-testing-send-ack')\n return result\n }\n}\n\n\n","/**\n * @djangocfg/api - Pre-configured API Clients\n *\n * Ready-to-use API instances for accounts, webpush, and centrifugo.\n *\n * Usage:\n * import { apiAccounts, apiWebPush, apiCentrifugo } from '@djangocfg/api/clients';\n * import { useAccountsOauthGithubCallbackCreate } from '@djangocfg/api/clients';\n */\n\nimport { API as AccountsAPIClass, LocalStorageAdapter } from './generated/cfg_accounts';\nimport { API as CentrifugoAPIClass } from './generated/cfg_centrifugo';\nimport { API as WebPushAPIClass } from './generated/cfg_webpush';\n\n// ============================================================================\n// Pre-configured API instances (for hooks and direct usage)\n// ============================================================================\nconst isStaticBuild = process.env.NEXT_PUBLIC_STATIC_BUILD === 'true';\nconst apiUrl = isStaticBuild ? '' : process.env.NEXT_PUBLIC_API_URL || '';\nconst storage = new LocalStorageAdapter();\n\nexport const apiAccounts = new AccountsAPIClass(apiUrl, { storage });\nexport const apiWebPush = new WebPushAPIClass(apiUrl, { storage });\nexport const apiCentrifugo = new CentrifugoAPIClass(apiUrl, { storage });\n\n// ============================================================================\n// Enums (re-export from accounts)\n// ============================================================================\nexport * as Enums from './generated/cfg_accounts/enums';\n\n// ============================================================================\n// CFG Accounts (primary exports - includes shared types)\n// ============================================================================\nexport * from './generated/cfg_accounts/_utils/hooks';\nexport * from './generated/cfg_accounts/_utils/fetchers';\nexport * from './generated/cfg_accounts/_utils/schemas';\n\n// ============================================================================\n// CFG WebPush (namespaced to avoid conflicts)\n// ============================================================================\nexport * as WebPushHooks from './generated/cfg_webpush/_utils/hooks';\nexport * as WebPushFetchers from './generated/cfg_webpush/_utils/fetchers';\nexport * as WebPushTypes from './generated/cfg_webpush/_utils/schemas';\n\n// ============================================================================\n// CFG Centrifugo (namespaced to avoid conflicts)\n// ============================================================================\nexport * as CentrifugoHooks from './generated/cfg_centrifugo/_utils/hooks';\nexport * as CentrifugoFetchers from './generated/cfg_centrifugo/_utils/fetchers';\nexport * as CentrifugoTypes from './generated/cfg_centrifugo/_utils/schemas';\n\n// ============================================================================\n// API Classes (for creating custom instances)\n// ============================================================================\nexport { API as AccountsAPI } from './generated/cfg_accounts';\nexport { API as WebPushAPI } from './generated/cfg_webpush';\nexport { API as CentrifugoAPI } from './generated/cfg_centrifugo';\n","/**\n * Email validation utility\n */\nexport const validateEmail = (email: string): boolean => {\n const emailRegex = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/;\n return emailRegex.test(email);\n};\n","/**\n * Format authentication error for display\n */\nexport const formatAuthError = (error: any): string => {\n if (typeof error === 'string') {\n return error;\n }\n\n if (error?.message) {\n return error.message;\n }\n\n if (error?.detail) {\n return error.detail;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;AAG/D,kBAAY,SAAS,SAAS,QAAQ,SAAS,OAAO;AAGtD,gBAAU,qDAAyC;AAAA,QACjD;AAAA,QACA,OAAO;AAAA,MACT,CAAC;AAGD,UAAI,SAAS,MAAM,IAAI;AACrB,kBAAU,QAAQ,OAAO,SAAS,KAAK,EAAE,CAAC;AAAA,MAC5C;AAGA,kBAAY,SAAS,MAAM,SAAS,eAAe,KAAK;AAIxD,YAAM,mBAAmB,eAAe;AACxC,aAAO,SAAS,gBAAgB;AAAA,IAElC,SAAS,KAAK;AACZ,YAAM,eAAe,eAAe,QAAQ,IAAI,UAAU;AAC1D,iBAAW,MAAM,gCAAgC,GAAG;AACpD,eAAS,YAAY;AACrB,gBAAU,YAAY;AAGtB,gBAAU,+CAAsC;AAAA,QAC9C;AAAA,QACA,OAAO;AAAA,MACT,CAAC;AAAA,IACH,UAAE;AACA,mBAAa,KAAK;AAAA,IACpB;AAAA,EACF,GAAG,CAAC,WAAW,SAAS,aAAa,MAAM,CAAC;AAE5C,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF,GA7I6B;;;AOxCtB,IAAM,gBAAgB,wBAAC,UAA2B;AACvD,QAAM,aAAa;AACnB,SAAO,WAAW,KAAK,KAAK;AAC9B,GAH6B;;;ACAtB,IAAM,kBAAkB,wBAAC,UAAuB;AACrD,MAAI,OAAO,UAAU,UAAU;AAC7B,WAAO;AAAA,EACT;AAEA,MAAI,OAAO,SAAS;AAClB,WAAO,MAAM;AAAA,EACf;AAEA,MAAI,OAAO,QAAQ;AACjB,WAAO,MAAM;AAAA,EACf;AAEA,MAAI,OAAO,UAAU,MAAM,QAAQ;AACjC,WAAO,MAAM,SAAS,KAAK;AAAA,EAC7B;AAEA,SAAO;AACT,GAlB+B;","names":["useLocalStorage","import_react","import_hooks","pRetry","logger","OAuthConnectionProvider","OAuthDisconnectRequestRequestProvider","OTPRequestRequestChannel","OTPVerifyRequestChannel","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_consola","api","import_consola","api","import_consola","import_consola","api","api","logger","FetchAdapter","APIError","NetworkError","import_consola","DEFAULT_CONFIG","SENSITIVE_HEADERS","APILogger","defaultLogger","import_p_retry","DEFAULT_RETRY_CONFIG","shouldRetry","NetworkError","APIError","withRetry","pRetry","APIClient","FetchAdapter","APILogger","withRetry","APIError","NetworkError","LocalStorageAdapter","logger","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_consola","import_consola","import_consola","import_consola","TOKEN_KEY","REFRESH_TOKEN_KEY","API","logger","APILogger","LocalStorageAdapter","APIClient","FetchAdapter","APIError","NetworkError","import_consola","DEFAULT_CONFIG","SENSITIVE_HEADERS","APILogger","defaultLogger","import_p_retry","DEFAULT_RETRY_CONFIG","shouldRetry","NetworkError","APIError","withRetry","pRetry","APIClient","FetchAdapter","APILogger","withRetry","APIError","NetworkError","LocalStorageAdapter","logger","import_zod","import_zod","import_zod","import_zod","import_zod","import_consola","TOKEN_KEY","REFRESH_TOKEN_KEY","API","logger","APILogger","LocalStorageAdapter","APIClient","import_consola","isStaticBuild","key","AnalyticsEvent","AnalyticsCategory","import_react","import_swr","import_swr","import_swr","import_jsx_runtime","refreshToken","import_react","import_hooks","import_react","useLocalStorage","key","import_react","import_navigation","import_react","import_hooks","useLocalStorage","identifier","error","otp","savedEmail","savedPhone","import_react","import_hooks","import_swr","import_swr","import_swr","import_swr","import_swr","isStaticBuild","apiUrl","API"]}
|