/** * Shared Constants */ /** Token refresh interval in milliseconds (30 minutes) */ export const TOKEN_REFRESH_INTERVAL_MS = 30 * 60 * 1000; /** Buffer before token expiry to trigger refresh (15 minutes) */ export const TOKEN_EXPIRY_BUFFER_MS = 15 * 60 * 1000; /** Token TTL in cache (1 hour) */ export const TOKEN_TTL_SECONDS = 3600; /** Refresh token TTL in cache (30 days) */ export const REFRESH_TOKEN_TTL_SECONDS = 30 * 24 * 60 * 60; /** API request timeout in milliseconds */ export const API_TIMEOUT_MS = 30000; /** Cache key prefixes */ export const CACHE_KEYS = { TOKEN_PB: (userId: string) => `tokens:${userId}:pb`, TOKEN_GRAPH: (userId: string) => `tokens:${userId}:graph`, REFRESH_PB: (userId: string) => `tokens:${userId}:refresh_pb`, REFRESH_GRAPH: (userId: string) => `tokens:${userId}:refresh_graph`, JOB_FILES: (jobId: string) => `jobs:${jobId}:files`, ACTIVE_USERS: 'active_users', } as const; /** Local storage keys */ export const STORAGE_KEYS = { PB_TOKEN: 'job-info:pb_token', GRAPH_TOKEN: 'job-info:graph_token', USER: 'job-info:user', EXPIRES_AT: 'job-info:expires_at', LAST_SYNC: 'job-info:last_sync', JOBS_CACHE: 'job-info:jobs', } as const; /** API endpoints */ export const API_ENDPOINTS = { LOGIN_CALLBACK: '/api/auth/login-callback', LOGOUT: '/api/auth/logout', REFRESH_TOKEN: '/api/auth/refresh-token', JOBS: '/api/jobs', FILES: '/api/files', HEALTH: '/api/health', } as const;