/** * Business Error Codes * * Custom error codes for business logic. These codes provide more specific * information about what went wrong beyond HTTP status codes. * * Code Ranges: * - 0-99: Success codes * - 1xxx: Authentication & Authorization errors * - 2xxx: User-related errors * - 3xxx: Validation errors * - 4xxx: Resource errors * - 5xxx: Server/System errors * - 6xxx: External service errors * - 7xxx: Business logic errors * * @example * ```typescript * import { BusinessCode, getBusinessCodeMessage } from '@tchil/business-codes'; * * throw new BusinessException(BusinessCode.USER_NOT_FOUND, 'User does not exist'); * ``` */ export declare const BusinessCode: { /** Operation completed successfully */ readonly SUCCESS: 0; /** Resource created successfully */ readonly CREATED: 1; /** Resource updated successfully */ readonly UPDATED: 2; /** Resource deleted successfully */ readonly DELETED: 3; /** Operation accepted for processing */ readonly ACCEPTED: 4; /** No changes were made */ readonly NO_CHANGE: 5; /** Authentication failed */ readonly AUTH_FAILED: 1001; /** Access token has expired */ readonly TOKEN_EXPIRED: 1002; /** Access token is invalid */ readonly TOKEN_INVALID: 1003; /** Access token is missing */ readonly TOKEN_MISSING: 1004; /** Refresh token has expired */ readonly REFRESH_TOKEN_EXPIRED: 1005; /** Refresh token is invalid */ readonly REFRESH_TOKEN_INVALID: 1006; /** Insufficient permissions for this action */ readonly PERMISSION_DENIED: 1007; /** Account is locked */ readonly ACCOUNT_LOCKED: 1008; /** Account is not verified */ readonly ACCOUNT_NOT_VERIFIED: 1009; /** Session has expired */ readonly SESSION_EXPIRED: 1010; /** Invalid API key */ readonly INVALID_API_KEY: 1011; /** Rate limit exceeded for authentication */ readonly AUTH_RATE_LIMITED: 1012; /** Two-factor authentication required */ readonly TWO_FACTOR_REQUIRED: 1013; /** Two-factor authentication failed */ readonly TWO_FACTOR_FAILED: 1014; /** OAuth authentication failed */ readonly OAUTH_FAILED: 1015; /** OAuth provider error */ readonly OAUTH_PROVIDER_ERROR: 1016; /** User not found */ readonly USER_NOT_FOUND: 2001; /** User already exists */ readonly USER_ALREADY_EXISTS: 2002; /** User account is inactive */ readonly USER_INACTIVE: 2003; /** Invalid credentials provided */ readonly INVALID_CREDENTIALS: 2004; /** User account is suspended */ readonly USER_SUSPENDED: 2005; /** User account is deleted */ readonly USER_DELETED: 2006; /** Email already in use */ readonly EMAIL_ALREADY_EXISTS: 2007; /** Username already in use */ readonly USERNAME_ALREADY_EXISTS: 2008; /** Phone number already in use */ readonly PHONE_ALREADY_EXISTS: 2009; /** Invalid email format */ readonly INVALID_EMAIL: 2010; /** Password too weak */ readonly WEAK_PASSWORD: 2011; /** Password mismatch */ readonly PASSWORD_MISMATCH: 2012; /** Old password is incorrect */ readonly INCORRECT_OLD_PASSWORD: 2013; /** Profile not complete */ readonly PROFILE_INCOMPLETE: 2014; /** General validation error */ readonly VALIDATION_ERROR: 3001; /** Invalid input provided */ readonly INVALID_INPUT: 3002; /** Required field is missing */ readonly MISSING_REQUIRED_FIELD: 3003; /** Field value is out of range */ readonly VALUE_OUT_OF_RANGE: 3004; /** Invalid format */ readonly INVALID_FORMAT: 3005; /** Field is too long */ readonly FIELD_TOO_LONG: 3006; /** Field is too short */ readonly FIELD_TOO_SHORT: 3007; /** Invalid date format */ readonly INVALID_DATE_FORMAT: 3008; /** Date is in the past */ readonly DATE_IN_PAST: 3009; /** Date is in the future */ readonly DATE_IN_FUTURE: 3010; /** Invalid file type */ readonly INVALID_FILE_TYPE: 3011; /** File size too large */ readonly FILE_TOO_LARGE: 3012; /** Invalid JSON format */ readonly INVALID_JSON: 3013; /** Invalid UUID format */ readonly INVALID_UUID: 3014; /** Invalid phone number format */ readonly INVALID_PHONE_NUMBER: 3015; /** Duplicate entry */ readonly DUPLICATE_ENTRY: 3016; /** Resource not found */ readonly RESOURCE_NOT_FOUND: 4001; /** Resource already exists */ readonly RESOURCE_ALREADY_EXISTS: 4002; /** Resource is locked */ readonly RESOURCE_LOCKED: 4003; /** Resource has been deleted */ readonly RESOURCE_DELETED: 4004; /** Resource is expired */ readonly RESOURCE_EXPIRED: 4005; /** Resource limit reached */ readonly RESOURCE_LIMIT_REACHED: 4006; /** Resource is not available */ readonly RESOURCE_UNAVAILABLE: 4007; /** Resource conflict */ readonly RESOURCE_CONFLICT: 4008; /** Resource version mismatch */ readonly VERSION_MISMATCH: 4009; /** Cannot delete resource with dependencies */ readonly HAS_DEPENDENCIES: 4010; /** Internal server error */ readonly INTERNAL_ERROR: 5001; /** Database error */ readonly DATABASE_ERROR: 5002; /** External service error */ readonly EXTERNAL_SERVICE_ERROR: 5003; /** Service temporarily unavailable */ readonly SERVICE_UNAVAILABLE: 5004; /** Configuration error */ readonly CONFIG_ERROR: 5005; /** Cache error */ readonly CACHE_ERROR: 5006; /** File system error */ readonly FILE_SYSTEM_ERROR: 5007; /** Memory limit exceeded */ readonly MEMORY_LIMIT_EXCEEDED: 5008; /** Timeout error */ readonly TIMEOUT_ERROR: 5009; /** Queue error */ readonly QUEUE_ERROR: 5010; /** Third-party API error */ readonly THIRD_PARTY_API_ERROR: 6001; /** Payment gateway error */ readonly PAYMENT_GATEWAY_ERROR: 6002; /** Email service error */ readonly EMAIL_SERVICE_ERROR: 6003; /** SMS service error */ readonly SMS_SERVICE_ERROR: 6004; /** Storage service error */ readonly STORAGE_SERVICE_ERROR: 6005; /** Search service error */ readonly SEARCH_SERVICE_ERROR: 6006; /** Notification service error */ readonly NOTIFICATION_SERVICE_ERROR: 6007; /** Analytics service error */ readonly ANALYTICS_SERVICE_ERROR: 6008; /** Operation not allowed */ readonly OPERATION_NOT_ALLOWED: 7001; /** Insufficient balance */ readonly INSUFFICIENT_BALANCE: 7002; /** Transaction failed */ readonly TRANSACTION_FAILED: 7003; /** Order cannot be cancelled */ readonly ORDER_CANNOT_CANCEL: 7004; /** Order cannot be modified */ readonly ORDER_CANNOT_MODIFY: 7005; /** Item out of stock */ readonly OUT_OF_STOCK: 7006; /** Coupon invalid */ readonly COUPON_INVALID: 7007; /** Coupon expired */ readonly COUPON_EXPIRED: 7008; /** Minimum order not met */ readonly MINIMUM_ORDER_NOT_MET: 7009; /** Maximum quantity exceeded */ readonly MAX_QUANTITY_EXCEEDED: 7010; /** Subscription required */ readonly SUBSCRIPTION_REQUIRED: 7011; /** Subscription expired */ readonly SUBSCRIPTION_EXPIRED: 7012; /** Feature not available */ readonly FEATURE_NOT_AVAILABLE: 7013; /** Quota exceeded */ readonly QUOTA_EXCEEDED: 7014; /** Rate limit exceeded */ readonly RATE_LIMIT_EXCEEDED: 7015; }; /** * Type representing all valid business code values */ export type BusinessCodeValue = (typeof BusinessCode)[keyof typeof BusinessCode]; /** * Get the default message for a business code * * @param code - The business code * @returns The default message for the code * * @example * ```typescript * getBusinessCodeMessage(BusinessCode.USER_NOT_FOUND); // 'User not found' * ``` */ export declare function getBusinessCodeMessage(code: number): string; /** * Check if a business code indicates success */ export declare function isSuccessCode(code: number): boolean; /** * Check if a business code indicates an authentication error */ export declare function isAuthError(code: number): boolean; /** * Check if a business code indicates a user error */ export declare function isUserError(code: number): boolean; /** * Check if a business code indicates a validation error */ export declare function isValidationError(code: number): boolean; /** * Check if a business code indicates a resource error */ export declare function isResourceError(code: number): boolean; /** * Check if a business code indicates a server error */ export declare function isSystemError(code: number): boolean; /** * Check if a business code indicates an external service error */ export declare function isExternalError(code: number): boolean; /** * Check if a business code indicates a business logic error */ export declare function isBusinessLogicError(code: number): boolean; //# sourceMappingURL=business-codes.d.ts.map