All files / src/lib/api index.ts

100% Statements 61/61
100% Branches 11/11
44% Functions 11/25
100% Lines 61/61

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 621x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x  
/**
 * API Utilities
 *
 * Centralized exports for API response helpers, error handling, and middleware.
 *
 * @example
 * import {
 *   successResponse,
 *   ApiError,
 *   withErrorHandling,
 *   withAuth,
 *   withAdmin,
 * } from "@/lib/api";
 */
 
// Response helpers
export {
  successResponse,
  createdResponse,
  paginatedResponse,
  noContentResponse,
  errorResponse,
  validationErrorResponse,
  unauthorizedResponse,
  forbiddenResponse,
  notFoundResponse,
  conflictResponse,
  rateLimitResponse,
  internalErrorResponse,
  type ApiSuccessResponse,
  type ApiErrorResponse,
  type ApiResponse,
  type PaginationMeta,
  type ResponseOptions } from "./responses";
 
// Error handling
export {
  ERROR_CODES,
  ApiError,
  handleApiError,
  withErrorHandling,
  isApiError,
  type ErrorCode } from "./errors";
 
// Middleware
export {
  withAuth,
  withUser,
  withAdmin,
  withValidation,
  withLogging,
  parseBody,
  compose,
  pipe,
  type RouteHandler,
  type RouteContext,
  type AuthenticatedHandler,
  type AuthenticatedUserHandler,
  type AuthenticatedUser,
  type ValidatedHandler,
  type Middleware } from "./middleware";