- Changed TypeScript target and library settings in tsconfig files to align with ESNext standards. - Updated pnpm version in GitHub workflows for better dependency management. - Modified Dockerfile to reflect the updated pnpm version. - Adjusted import statements across various domain modules to include file extensions for consistency and compatibility. - Cleaned up TypeScript configuration files for improved clarity and organization.
101 lines
3.1 KiB
TypeScript
101 lines
3.1 KiB
TypeScript
/**
|
|
* Customer Domain
|
|
*
|
|
* Main exports:
|
|
* - User: API response type
|
|
* - UserAuth: Portal DB auth state
|
|
* - Address: Address structure (follows billing/subscriptions pattern)
|
|
*
|
|
* Pattern matches billing and subscriptions domains.
|
|
*
|
|
* Types are derived from Zod schemas (Schema-First Approach)
|
|
*/
|
|
|
|
// ============================================================================
|
|
// Constants
|
|
// ============================================================================
|
|
|
|
export { USER_ROLE, type UserRoleValue } from "./contract.js";
|
|
|
|
// ============================================================================
|
|
// Domain Types (Clean Names - Public API)
|
|
// ============================================================================
|
|
|
|
export type {
|
|
User, // API response type (normalized camelCase)
|
|
UserAuth, // Portal DB auth state
|
|
UserRole, // "USER" | "ADMIN"
|
|
Address, // Address structure (not "CustomerAddress")
|
|
AddressFormData, // Address form validation
|
|
ProfileEditFormData, // Profile edit form data
|
|
ProfileDisplayData, // Profile display data (alias)
|
|
UserProfile, // Alias for User
|
|
AuthenticatedUser, // Alias for authenticated user
|
|
WhmcsClient, // Provider-normalized WHMCS client shape
|
|
} from "./schema.js";
|
|
|
|
// ============================================================================
|
|
// Schemas
|
|
// ============================================================================
|
|
|
|
export {
|
|
userSchema,
|
|
userAuthSchema,
|
|
addressSchema,
|
|
addressFormSchema,
|
|
profileEditFormSchema,
|
|
profileDisplayDataSchema,
|
|
|
|
// Helper functions
|
|
combineToUser, // Domain helper: UserAuth + WhmcsClient → User
|
|
addressFormToRequest,
|
|
profileFormToRequest,
|
|
} from "./schema.js";
|
|
|
|
// ============================================================================
|
|
// Provider Namespace
|
|
// ============================================================================
|
|
|
|
/**
|
|
* Providers namespace contains provider-specific implementations
|
|
*
|
|
* Access as:
|
|
* - Providers.Whmcs.Client (full WHMCS type)
|
|
* - Providers.Whmcs.transformWhmcsClientResponse()
|
|
* - Providers.Portal.mapPrismaUserToUserAuth()
|
|
*/
|
|
export * as Providers from "./providers/index.js";
|
|
|
|
// ============================================================================
|
|
// Provider Raw Response Types (Selective Exports)
|
|
// ============================================================================
|
|
|
|
/**
|
|
* WHMCS API raw types (request and response)
|
|
* Only exported for BFF integration convenience
|
|
*/
|
|
export type {
|
|
// Request params
|
|
WhmcsAddClientParams,
|
|
WhmcsValidateLoginParams,
|
|
WhmcsCreateSsoTokenParams,
|
|
// Response types
|
|
WhmcsClientResponse,
|
|
WhmcsAddClientResponse,
|
|
WhmcsValidateLoginResponse,
|
|
WhmcsSsoResponse,
|
|
} from "./providers/whmcs/raw.types.js";
|
|
|
|
// ============================================================================
|
|
// Provider-Specific Types (For Integrations)
|
|
// ============================================================================
|
|
|
|
/**
|
|
* Salesforce integration types
|
|
* Provider-specific, not validated at runtime
|
|
*/
|
|
export type {
|
|
SalesforceAccountFieldMap,
|
|
SalesforceAccountRecord,
|
|
} from "./contract.js";
|