TypeScript Types
Complete type definitions for next-api-layer.
Core Types#
AuthProxyConfig#
Main configuration for createAuthProxy.
ApiClientConfig#
Configuration for createApiClient.
DebugConfig#
Configuration for debug logging (v0.2.2+).
Security Types#
CsrfConfig#
RateLimitConfig#
AuditConfig#
Access Control Types#
AccessConfig#
Response Types#
ApiResponse#
Standard API response wrapper.
AuthResult#
Result from authentication validation.
TokenInfo#
Token validation result.
Cookie Types#
CookieOptions#
Sanitization Types#
SanitizationConfig#
Response Mappers#
ResponseMappers#
Custom parsers for different backend formats.
Client-Side Types#
AuthContextValue#
Returned by useAuth() and provided by AuthProvider.
AuthResult#
Returned by login() / register().
LoginCredentials / RegisterData#
UseAuthOptions#
Options for useAuth(options?) (also used by useRequireAuth / useRedirectIfAuth).
AuthProviderProps#
I18n Types#
I18nConfig#
Error Types#
The library provides a comprehensive error class hierarchy for better error handling. Everything extends ApiError; status-bearing errors extend HttpError.
ApiError (Base)#
Base class for all API layer errors.
HttpError#
HTTP response errors (non-2xx). Base class for TimeoutError, AuthError, and RateLimitError.
TimeoutError#
Request timeout (HTTP 408). Extends HttpError.
NetworkError#
Network connectivity error (no response received). Extends ApiError.
AuthError#
Authentication error (HTTP 401). Extends HttpError.
ValidationError#
Validation error with field-level details. Extends ApiError.
RateLimitError#
Rate limit exceeded (HTTP 429). Extends HttpError.