- Adjusted .prettierrc to ensure consistent formatting with a newline at the end of the file. - Reformatted eslint.config.mjs for improved readability by aligning array elements. - Updated pnpm-lock.yaml to use single quotes for consistency across dependencies. - Simplified worktree setup in .cursor/worktrees.json for cleaner configuration. - Enhanced documentation in .cursor/plans to clarify architecture refactoring. - Refactored various service files for improved readability and maintainability, including rate-limiting and auth services. - Updated imports and exports across multiple files for consistency and clarity. - Improved error handling and logging in service methods to enhance debugging capabilities. - Streamlined utility functions for better performance and maintainability across the domain packages.
68 lines
1.8 KiB
TypeScript
68 lines
1.8 KiB
TypeScript
/**
|
|
* SIM Domain - Contract
|
|
*
|
|
* Constants and types for the SIM domain.
|
|
* All validated types are derived from schemas (see schema.ts).
|
|
*/
|
|
|
|
// ============================================================================
|
|
// SIM Status Constants
|
|
// ============================================================================
|
|
|
|
export const SIM_STATUS = {
|
|
ACTIVE: "active",
|
|
SUSPENDED: "suspended",
|
|
CANCELLED: "cancelled",
|
|
PENDING: "pending",
|
|
} as const;
|
|
|
|
// ============================================================================
|
|
// SIM Type Constants
|
|
// ============================================================================
|
|
|
|
export const SIM_TYPE = {
|
|
STANDARD: "standard",
|
|
NANO: "nano",
|
|
MICRO: "micro",
|
|
ESIM: "esim",
|
|
} as const;
|
|
|
|
// ============================================================================
|
|
// SIM Plan Codes (frontend-safe subset; authoritative list lives in WHMCS)
|
|
// ============================================================================
|
|
|
|
export const SIM_PLAN_CODES = ["PASI_5G", "PASI_10G", "PASI_25G", "PASI_50G"] as const;
|
|
|
|
export type SimPlanCode = (typeof SIM_PLAN_CODES)[number];
|
|
|
|
export const SIM_PLAN_LABELS: Record<SimPlanCode, string> = {
|
|
PASI_5G: "5GB",
|
|
PASI_10G: "10GB",
|
|
PASI_25G: "25GB",
|
|
PASI_50G: "50GB",
|
|
};
|
|
|
|
// ============================================================================
|
|
// Re-export Types from Schema (Schema-First Approach)
|
|
// ============================================================================
|
|
|
|
export type {
|
|
SimStatus,
|
|
SimType,
|
|
SimDetails,
|
|
RecentDayUsage,
|
|
SimUsage,
|
|
SimTopUpHistoryEntry,
|
|
SimTopUpHistory,
|
|
// Request types
|
|
SimTopUpRequest,
|
|
SimPlanChangeRequest,
|
|
SimCancelRequest,
|
|
SimTopUpHistoryRequest,
|
|
SimFeaturesUpdateRequest,
|
|
// Activation types
|
|
SimOrderActivationRequest,
|
|
SimOrderActivationMnp,
|
|
SimOrderActivationAddons,
|
|
} from "./schema.js";
|