/** * API Error Codes * * Standardized error codes used across API responses. * Backend sets these in createApiError(), frontend detects them in ApiError. */ export declare const API_ERROR_CODES: { /** Role-based permission check failed (checkPermission) */ readonly PERMISSION_DENIED: "PERMISSION_DENIED"; /** API key scope check failed (hasRequiredScope) */ readonly INSUFFICIENT_SCOPE: "INSUFFICIENT_SCOPE"; }; export type ApiErrorCode = typeof API_ERROR_CODES[keyof typeof API_ERROR_CODES]; /** * API Error Class * * Custom error class that preserves API response metadata like error codes. * Used for proper error handling in TanStack Query mutations. */ export declare class ApiError extends Error { code?: string; status?: number; details?: unknown; constructor(message: string, options?: { code?: string; status?: number; details?: unknown; }); /** * Check if this is a permission denied error */ isPermissionDenied(): boolean; /** * Parse API error from fetch response * Handles both flat and nested error structures: * - Flat: { error: "msg", code: "CODE" } * - Nested: { error: { message: "msg", code: "CODE" } } */ static fromResponse(response: Response, fallbackMessage: string): Promise; } //# sourceMappingURL=api-error.d.ts.map