80 lines
2.3 KiB
TypeScript
80 lines
2.3 KiB
TypeScript
/**
|
|
* Auth Domain - Contract
|
|
*
|
|
* Constants and types for the authentication domain.
|
|
* All validated types are derived from schemas (see schema.ts).
|
|
*/
|
|
|
|
// ============================================================================
|
|
// Authentication Error Codes
|
|
// ============================================================================
|
|
|
|
export const AUTH_ERROR_CODE = {
|
|
INVALID_CREDENTIALS: "INVALID_CREDENTIALS",
|
|
EMAIL_NOT_VERIFIED: "EMAIL_NOT_VERIFIED",
|
|
ACCOUNT_LOCKED: "ACCOUNT_LOCKED",
|
|
MFA_REQUIRED: "MFA_REQUIRED",
|
|
INVALID_TOKEN: "INVALID_TOKEN",
|
|
TOKEN_EXPIRED: "TOKEN_EXPIRED",
|
|
PASSWORD_TOO_WEAK: "PASSWORD_TOO_WEAK",
|
|
EMAIL_ALREADY_EXISTS: "EMAIL_ALREADY_EXISTS",
|
|
WHMCS_ACCOUNT_NOT_FOUND: "WHMCS_ACCOUNT_NOT_FOUND",
|
|
SALESFORCE_ACCOUNT_NOT_FOUND: "SALESFORCE_ACCOUNT_NOT_FOUND",
|
|
LINKING_FAILED: "LINKING_FAILED",
|
|
} as const;
|
|
|
|
export type AuthErrorCode = (typeof AUTH_ERROR_CODE)[keyof typeof AUTH_ERROR_CODE];
|
|
|
|
// ============================================================================
|
|
// Token Type Constants
|
|
// ============================================================================
|
|
|
|
export const TOKEN_TYPE = {
|
|
BEARER: "Bearer",
|
|
} as const;
|
|
|
|
export type TokenTypeValue = (typeof TOKEN_TYPE)[keyof typeof TOKEN_TYPE];
|
|
|
|
// ============================================================================
|
|
// Gender Constants
|
|
// ============================================================================
|
|
|
|
export const GENDER = {
|
|
MALE: "male",
|
|
FEMALE: "female",
|
|
OTHER: "other",
|
|
} as const;
|
|
|
|
export type GenderValue = (typeof GENDER)[keyof typeof GENDER];
|
|
|
|
// ============================================================================
|
|
// Re-export Types from Schema (Schema-First Approach)
|
|
// ============================================================================
|
|
|
|
export type {
|
|
// Request types
|
|
LoginRequest,
|
|
SignupRequest,
|
|
PasswordResetRequest,
|
|
ResetPasswordRequest,
|
|
SetPasswordRequest,
|
|
ChangePasswordRequest,
|
|
LinkWhmcsRequest,
|
|
ValidateSignupRequest,
|
|
UpdateCustomerProfileRequest,
|
|
AccountStatusRequest,
|
|
SsoLinkRequest,
|
|
CheckPasswordNeededRequest,
|
|
RefreshTokenRequest,
|
|
// Token types
|
|
AuthTokens,
|
|
// Response types
|
|
AuthResponse,
|
|
SignupResult,
|
|
PasswordChangeResult,
|
|
SsoLinkResponse,
|
|
CheckPasswordNeededResponse,
|
|
// Error types
|
|
AuthError,
|
|
} from './schema';
|