/** * API Utility Functions * @module api/utils * * Helper functions for API client operations */ /** * Calculate delay with exponential backoff and jitter * * @param attempt - Current attempt number (0-indexed) * @param baseDelay - Base delay in milliseconds (default: 1000) * @returns Delay in milliseconds (capped at 30000) */ export declare function calculateBackoff(attempt: number, baseDelay?: number): number; /** * Generate anonymous ID for telemetry using cryptographic randomness. * Returns a UUID v4 format string (e.g., "550e8400-e29b-41d4-a716-446655440000"). * * Note: This generates a fresh ID per session - it is NOT stored persistently. * For persistent anonymous IDs, the caller must handle storage. */ export declare function generateAnonymousId(): string; /** * Build request headers for API calls. * * SMI-4971: This sets only the Supabase gateway `apikey` header (always the * anon key) plus `Content-Type` / `x-request-id`. It deliberately does NOT set * `Authorization` — that header is the caller's per-auth-mode responsibility: * - JWT mode → `Authorization: Bearer ` * - API-key mode → `X-API-Key: `, no `Authorization` * - anonymous mode → `Authorization: Bearer ` * * Previously this set `Authorization: Bearer ` unconditionally, which * left a stale cross-project anon JWT on API-key requests and broke downstream * edge-function signature validation. * * @param anonKey - Optional Supabase anon key for the gateway `apikey` header * @returns Headers object (no `Authorization` — see above) */ export declare function buildRequestHeaders(anonKey?: string): Record; /** * Production API URL for Skillsmith registry. * This is the public API endpoint that all users should use. */ export declare const PRODUCTION_API_URL = "https://api.skillsmith.app/functions/v1"; /** * Production Supabase anon key for authenticated API access. * This key is safe to expose - it only provides RLS-based access, not admin access. * Without this, users hit the 10-request trial limit and get 0 results. * * SMI-1949: SMI-1948 fix was incomplete - added URL but not anon key. */ export declare const PRODUCTION_ANON_KEY = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InZyY256cG1uZHRyb3F4eG9xa3p5Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3Njc4MzgwNzQsImV4cCI6MjA4MzQxNDA3NH0.WNK5jaNG3twxApOva5A1ZlCaZb5hVqBYtNJezRrR4t8"; /** * Default base URL for API client. * * Priority order: * 1. SKILLSMITH_API_URL env var (for custom deployments) * 2. SUPABASE_URL env var (for development with local Supabase) * 3. Production API URL (default for all users) * * SMI-1948: Previously fell back to undefined, causing offline mode for all users. */ export declare const DEFAULT_BASE_URL: string; //# sourceMappingURL=utils.d.ts.map