Refactor module type settings and import paths across the application to enhance consistency and maintainability. Changed package types from 'module' to 'commonjs' in package.json files, updated TypeScript configuration for module resolution, and streamlined import paths by removing file extensions. This improves clarity and aligns with the updated module structure throughout the codebase.

This commit is contained in:
barsa 2025-10-08 18:35:05 +09:00
parent 5eebd11668
commit 7b7d736aaf
59 changed files with 192 additions and 192 deletions

View File

@ -1,7 +1,7 @@
{ {
"name": "@customer-portal/bff", "name": "@customer-portal/bff",
"version": "1.0.0", "version": "1.0.0",
"type": "module", "type": "commonjs",
"description": "Backend for Frontend API", "description": "Backend for Frontend API",
"author": "", "author": "",
"private": true, "private": true,

View File

@ -9,10 +9,9 @@
import type { User as PrismaUser } from "@prisma/client"; import type { User as PrismaUser } from "@prisma/client";
import type { UserAuth } from "@customer-portal/domain/customer"; import type { UserAuth } from "@customer-portal/domain/customer";
import { import { Providers as CustomerProviders } from "@customer-portal/domain/customer";
mapPrismaUserToUserAuth,
type PrismaUserRaw type PrismaUserRaw = Parameters<typeof CustomerProviders.Portal.mapPrismaUserToUserAuth>[0];
} from "@customer-portal/domain/customer/providers/portal";
/** /**
* Maps Prisma User entity to Domain UserAuth type * Maps Prisma User entity to Domain UserAuth type
@ -40,6 +39,6 @@ export function mapPrismaUserToDomain(user: PrismaUser): UserAuth {
}; };
// Use domain provider mapper // Use domain provider mapper
return mapPrismaUserToUserAuth(prismaUserRaw); return CustomerProviders.Portal.mapPrismaUserToUserAuth(prismaUserRaw);
} }

View File

@ -1,8 +1,8 @@
{ {
"extends": "../../tsconfig.base.json", "extends": "../../tsconfig.base.json",
"compilerOptions": { "compilerOptions": {
"module": "Node16", "module": "commonjs",
"moduleResolution": "node16", "moduleResolution": "node",
"lib": ["ES2022"], "lib": ["ES2022"],
"noEmit": true, "noEmit": true,
"baseUrl": ".", "baseUrl": ".",
@ -27,13 +27,14 @@
"typeRoots": ["./node_modules/@types"], "typeRoots": ["./node_modules/@types"],
"emitDecoratorMetadata": true, "emitDecoratorMetadata": true,
"experimentalDecorators": true, "experimentalDecorators": true,
"strictPropertyInitialization": false "strictPropertyInitialization": false,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true
}, },
"ts-node": { "ts-node": {
"transpileOnly": true, "transpileOnly": true,
"esm": true,
"compilerOptions": { "compilerOptions": {
"module": "Node16" "module": "commonjs"
} }
}, },
"include": ["src/**/*", "scripts/**/*", "src/types/**/*"], "include": ["src/**/*", "scripts/**/*", "src/types/**/*"],

View File

@ -20,7 +20,7 @@ export {
type AuthErrorCode, type AuthErrorCode,
type TokenTypeValue, type TokenTypeValue,
type GenderValue, type GenderValue,
} from "./contract.js"; } from "./contract";
export type { export type {
// Request types // Request types
@ -47,7 +47,7 @@ export type {
CheckPasswordNeededResponse, CheckPasswordNeededResponse,
// Error types // Error types
AuthError, AuthError,
} from "./contract.js"; } from "./contract";
// ============================================================================ // ============================================================================
// Schemas (for validation) // Schemas (for validation)
@ -81,4 +81,4 @@ export {
passwordChangeResultSchema, passwordChangeResultSchema,
ssoLinkResponseSchema, ssoLinkResponseSchema,
checkPasswordNeededResponseSchema, checkPasswordNeededResponseSchema,
} from "./schema.js"; } from "./schema";

View File

@ -12,8 +12,8 @@
import { z } from "zod"; import { z } from "zod";
import { emailSchema, nameSchema, passwordSchema, phoneSchema } from "../common/schema.js"; import { emailSchema, nameSchema, passwordSchema, phoneSchema } from "../common/schema";
import { addressSchema, userSchema } from "../customer/schema.js"; import { addressSchema, userSchema } from "../customer/schema";
// ============================================================================ // ============================================================================
// Authentication Request Schemas // Authentication Request Schemas

View File

@ -7,11 +7,11 @@
*/ */
// Constants // Constants
export { INVOICE_STATUS } from "./contract.js"; export { INVOICE_STATUS } from "./contract";
export * from "./constants.js"; export * from "./constants";
// Schemas (includes derived types) // Schemas (includes derived types)
export * from "./schema.js"; export * from "./schema";
// Re-export types for convenience // Re-export types for convenience
export type { export type {
@ -28,7 +28,7 @@ export type {
} from './schema'; } from './schema';
// Provider adapters // Provider adapters
export * as Providers from "./providers/index.js"; export * as Providers from "./providers/index";
// Re-export provider raw types (request and response) // Re-export provider raw types (request and response)
export type { export type {
@ -45,4 +45,4 @@ export type {
WhmcsCapturePaymentResponse, WhmcsCapturePaymentResponse,
WhmcsCurrency, WhmcsCurrency,
WhmcsCurrenciesResponse, WhmcsCurrenciesResponse,
} from "./providers/whmcs/raw.types.js"; } from "./providers/whmcs/raw.types";

View File

@ -2,8 +2,8 @@
* Billing Domain - Providers * Billing Domain - Providers
*/ */
import * as WhmcsMapper from "./whmcs/mapper.js"; import * as WhmcsMapper from "./whmcs/mapper";
import * as WhmcsRaw from "./whmcs/raw.types.js"; import * as WhmcsRaw from "./whmcs/raw.types";
export const Whmcs = { export const Whmcs = {
...WhmcsMapper, ...WhmcsMapper,
@ -12,5 +12,5 @@ export const Whmcs = {
}; };
export { WhmcsMapper, WhmcsRaw }; export { WhmcsMapper, WhmcsRaw };
export * from "./whmcs/mapper.js"; export * from "./whmcs/mapper";
export * from "./whmcs/raw.types.js"; export * from "./whmcs/raw.types";

View File

@ -1,2 +1,2 @@
export * from "./mapper.js"; export * from "./mapper";
export * from "./raw.types.js"; export * from "./raw.types";

View File

@ -4,14 +4,14 @@
* Transforms raw WHMCS invoice data into normalized billing domain types. * Transforms raw WHMCS invoice data into normalized billing domain types.
*/ */
import type { Invoice, InvoiceItem } from "../../contract.js"; import type { Invoice, InvoiceItem } from "../../contract";
import { invoiceSchema } from "../../schema.js"; import { invoiceSchema } from "../../schema";
import { import {
type WhmcsInvoiceRaw, type WhmcsInvoiceRaw,
whmcsInvoiceRawSchema, whmcsInvoiceRawSchema,
type WhmcsInvoiceItemsRaw, type WhmcsInvoiceItemsRaw,
whmcsInvoiceItemsRawSchema, whmcsInvoiceItemsRawSchema,
} from "./raw.types.js"; } from "./raw.types";
export interface TransformInvoiceOptions { export interface TransformInvoiceOptions {
defaultCurrencyCode?: string; defaultCurrencyCode?: string;

View File

@ -7,10 +7,10 @@
*/ */
// Provider-specific types // Provider-specific types
export { type SalesforceProductFieldMap } from "./contract.js"; export { type SalesforceProductFieldMap } from "./contract";
// Schemas (includes derived types) // Schemas (includes derived types)
export * from "./schema.js"; export * from "./schema";
// Re-export types for convenience // Re-export types for convenience
export type { export type {
@ -29,16 +29,16 @@ export type {
VpnCatalogProduct, VpnCatalogProduct,
// Union type // Union type
CatalogProduct, CatalogProduct,
} from './schema.js'; } from './schema';
// Provider adapters // Provider adapters
export * as Providers from "./providers/index.js"; export * as Providers from "./providers/index";
// Re-export provider raw types for convenience // Re-export provider raw types for convenience
export * from "./providers/salesforce/raw.types.js"; export * from "./providers/salesforce/raw.types";
// Re-export WHMCS provider types // Re-export WHMCS provider types
export type { export type {
WhmcsCatalogProduct, WhmcsCatalogProduct,
WhmcsCatalogProductListResponse, WhmcsCatalogProductListResponse,
} from "./providers/whmcs/raw.types.js"; } from "./providers/whmcs/raw.types";

View File

@ -2,9 +2,9 @@
* Catalog Domain - Providers * Catalog Domain - Providers
*/ */
import * as SalesforceMapper from "./salesforce/mapper.js"; import * as SalesforceMapper from "./salesforce/mapper";
import * as SalesforceRaw from "./salesforce/raw.types.js"; import * as SalesforceRaw from "./salesforce/raw.types";
import * as WhmcsRaw from "./whmcs/raw.types.js"; import * as WhmcsRaw from "./whmcs/raw.types";
export const Salesforce = { export const Salesforce = {
...SalesforceMapper, ...SalesforceMapper,
@ -17,6 +17,6 @@ export const Whmcs = {
}; };
export { SalesforceMapper, SalesforceRaw, WhmcsRaw }; export { SalesforceMapper, SalesforceRaw, WhmcsRaw };
export * from "./salesforce/mapper.js"; export * from "./salesforce/mapper";
export * from "./salesforce/raw.types.js"; export * from "./salesforce/raw.types";
export * from "./whmcs/raw.types.js"; export * from "./whmcs/raw.types";

View File

@ -1,2 +1,2 @@
export * from "./mapper.js"; export * from "./mapper";
export * from "./raw.types.js"; export * from "./raw.types";

View File

@ -13,11 +13,11 @@ import type {
SimCatalogProduct, SimCatalogProduct,
SimActivationFeeCatalogItem, SimActivationFeeCatalogItem,
VpnCatalogProduct, VpnCatalogProduct,
} from "../../contract.js"; } from "../../contract";
import type { import type {
SalesforceProduct2WithPricebookEntries, SalesforceProduct2WithPricebookEntries,
SalesforcePricebookEntryRecord, SalesforcePricebookEntryRecord,
} from "./raw.types.js"; } from "./raw.types";
// ============================================================================ // ============================================================================
// Tier Templates (Hardcoded Product Metadata) // Tier Templates (Hardcoded Product Metadata)

View File

@ -1,2 +1,2 @@
export * from "./raw.types.js"; export * from "./raw.types";

View File

@ -4,14 +4,14 @@
* Shared types and utilities used across all domains. * Shared types and utilities used across all domains.
*/ */
export * from "./types.js"; export * from "./types";
export * from "./schema.js"; export * from "./schema";
export * from "./validation.js"; export * from "./validation";
// Common provider types (generic wrappers used across domains) // Common provider types (generic wrappers used across domains)
export * as CommonProviders from "./providers/index.js"; export * as CommonProviders from "./providers/index";
// Re-export provider types for convenience // Re-export provider types for convenience
export type { WhmcsResponse, WhmcsErrorResponse } from "./providers/whmcs.js"; export type { WhmcsResponse, WhmcsErrorResponse } from "./providers/whmcs";
export type { SalesforceResponse } from "./providers/salesforce.js"; export type { SalesforceResponse } from "./providers/salesforce";

View File

@ -4,5 +4,5 @@
* Generic provider-specific response structures used across multiple domains. * Generic provider-specific response structures used across multiple domains.
*/ */
export * as Whmcs from "./whmcs.js"; export * as Whmcs from "./whmcs";
export * as Salesforce from "./salesforce/index.js"; export * as Salesforce from "./salesforce/index";

View File

@ -1,2 +1,2 @@
export * from "./raw.types.js"; export * from "./raw.types";

View File

@ -15,7 +15,7 @@
// Constants // Constants
// ============================================================================ // ============================================================================
export { USER_ROLE, type UserRoleValue } from "./contract.js"; export { USER_ROLE, type UserRoleValue } from "./contract";
// ============================================================================ // ============================================================================
// Domain Types (Clean Names - Public API) // Domain Types (Clean Names - Public API)
@ -27,7 +27,7 @@ export type {
UserRole, // "USER" | "ADMIN" UserRole, // "USER" | "ADMIN"
Address, // Address structure (not "CustomerAddress") Address, // Address structure (not "CustomerAddress")
AddressFormData, // Address form validation AddressFormData, // Address form validation
} from "./schema.js"; } from "./schema";
// ============================================================================ // ============================================================================
// Schemas // Schemas
@ -42,7 +42,7 @@ export {
// Helper functions // Helper functions
combineToUser, // Domain helper: UserAuth + WhmcsClient → User combineToUser, // Domain helper: UserAuth + WhmcsClient → User
addressFormToRequest, addressFormToRequest,
} from "./schema.js"; } from "./schema";
// ============================================================================ // ============================================================================
// Provider Namespace // Provider Namespace
@ -56,7 +56,7 @@ export {
* - Providers.Whmcs.transformWhmcsClientResponse() * - Providers.Whmcs.transformWhmcsClientResponse()
* - Providers.Portal.mapPrismaUserToUserAuth() * - Providers.Portal.mapPrismaUserToUserAuth()
*/ */
export * as Providers from "./providers/index.js"; export * as Providers from "./providers/index";
// ============================================================================ // ============================================================================
// Provider Raw Response Types (Selective Exports) // Provider Raw Response Types (Selective Exports)
@ -76,7 +76,7 @@ export type {
WhmcsAddClientResponse, WhmcsAddClientResponse,
WhmcsValidateLoginResponse, WhmcsValidateLoginResponse,
WhmcsSsoResponse, WhmcsSsoResponse,
} from "./providers/whmcs/raw.types.js"; } from "./providers/whmcs/raw.types";
// ============================================================================ // ============================================================================
// Provider-Specific Types (For Integrations) // Provider-Specific Types (For Integrations)
@ -89,4 +89,4 @@ export type {
export type { export type {
SalesforceAccountFieldMap, SalesforceAccountFieldMap,
SalesforceAccountRecord, SalesforceAccountRecord,
} from "./contract.js"; } from "./contract";

View File

@ -6,5 +6,5 @@
* - Whmcs: WHMCS API WhmcsClient * - Whmcs: WHMCS API WhmcsClient
*/ */
export * as Portal from "./portal/index.js"; export * as Portal from "./portal/index";
export * as Whmcs from "./whmcs/index.js"; export * as Whmcs from "./whmcs/index";

View File

@ -4,6 +4,6 @@
* Handles mapping from Prisma (portal database) to UserAuth domain type * Handles mapping from Prisma (portal database) to UserAuth domain type
*/ */
export * from "./mapper.js"; export * from "./mapper";
export * from "./types.js"; export * from "./types";

View File

@ -4,9 +4,9 @@
* Maps Prisma user data to UserAuth domain type using schema validation * Maps Prisma user data to UserAuth domain type using schema validation
*/ */
import { userAuthSchema } from "../../schema.js"; import { userAuthSchema } from "../../schema";
import type { PrismaUserRaw } from "./types.js"; import type { PrismaUserRaw } from "./types";
import type { UserAuth } from "../../schema.js"; import type { UserAuth } from "../../schema";
/** /**
* Maps raw Prisma user data to UserAuth domain type * Maps raw Prisma user data to UserAuth domain type

View File

@ -5,7 +5,7 @@
* Domain doesn't depend on @prisma/client directly. * Domain doesn't depend on @prisma/client directly.
*/ */
import type { UserRole } from "../../schema.js"; import type { UserRole } from "../../schema";
/** /**
* Raw Prisma user data from portal database * Raw Prisma user data from portal database

View File

@ -5,8 +5,8 @@
* Exports transformation functions and raw API types (request/response). * Exports transformation functions and raw API types (request/response).
*/ */
export * from "./mapper.js"; export * from "./mapper";
export * from "./raw.types.js"; export * from "./raw.types";
// Re-export domain types for provider namespace convenience // Re-export domain types for provider namespace convenience
export type { WhmcsClient, EmailPreferences, SubUser, Stats } from "../../schema.js"; export type { WhmcsClient, EmailPreferences, SubUser, Stats } from "../../schema";

View File

@ -7,14 +7,14 @@
import { z } from "zod"; import { z } from "zod";
import type { WhmcsClient, Address } from "../../schema.js"; import type { WhmcsClient, Address } from "../../schema";
import { whmcsClientSchema, addressSchema } from "../../schema.js"; import { whmcsClientSchema, addressSchema } from "../../schema";
import { import {
whmcsClientSchema as whmcsRawClientSchema, whmcsClientSchema as whmcsRawClientSchema,
whmcsClientResponseSchema, whmcsClientResponseSchema,
type WhmcsClient as WhmcsRawClient, type WhmcsClient as WhmcsRawClient,
type WhmcsClientResponse, type WhmcsClientResponse,
} from "./raw.types.js"; } from "./raw.types";
/** /**
* Parse and validate WHMCS client response * Parse and validate WHMCS client response

View File

@ -12,7 +12,7 @@
import { z } from "zod"; import { z } from "zod";
import { countryCodeSchema } from "../common/schema.js"; import { countryCodeSchema } from "../common/schema";
// ============================================================================ // ============================================================================
// Helper Schemas // Helper Schemas

View File

@ -4,8 +4,8 @@
* Shared types for dashboard summaries, activity feeds, and related data. * Shared types for dashboard summaries, activity feeds, and related data.
*/ */
import type { IsoDateTimeString } from "../common/types.js"; import type { IsoDateTimeString } from "../common/types";
import type { Invoice } from "../billing/contract.js"; import type { Invoice } from "../billing/contract";
export type ActivityType = export type ActivityType =
| "invoice_created" | "invoice_created"

View File

@ -2,4 +2,4 @@
* Dashboard Domain * Dashboard Domain
*/ */
export * from "./contract.js"; export * from "./contract";

View File

@ -4,15 +4,15 @@
*/ */
// Re-export domain modules // Re-export domain modules
export * as Billing from "./billing/index.js"; export * as Billing from "./billing/index";
export * as Subscriptions from "./subscriptions/index.js"; export * as Subscriptions from "./subscriptions/index";
export * as Payments from "./payments/index.js"; export * as Payments from "./payments/index";
export * as Sim from "./sim/index.js"; export * as Sim from "./sim/index";
export * as Orders from "./orders/index.js"; export * as Orders from "./orders/index";
export * as Catalog from "./catalog/index.js"; export * as Catalog from "./catalog/index";
export * as Common from "./common/index.js"; export * as Common from "./common/index";
export * as Toolkit from "./toolkit/index.js"; export * as Toolkit from "./toolkit/index";
export * as Auth from "./auth/index.js"; export * as Auth from "./auth/index";
export * as Customer from "./customer/index.js"; export * as Customer from "./customer/index";
export * as Mappings from "./mappings/index.js"; export * as Mappings from "./mappings/index";
export * as Dashboard from "./dashboard/index.js"; export * as Dashboard from "./dashboard/index";

View File

@ -4,7 +4,7 @@
* Normalized types for mapping portal users to external systems. * Normalized types for mapping portal users to external systems.
*/ */
import type { IsoDateTimeString } from "../common/types.js"; import type { IsoDateTimeString } from "../common/types";
export interface UserIdMapping { export interface UserIdMapping {
id: string; id: string;

View File

@ -2,9 +2,9 @@
* ID Mapping Domain * ID Mapping Domain
*/ */
export * from "./contract.js"; export * from "./contract";
export * from "./schema.js"; export * from "./schema";
export * from "./validation.js"; export * from "./validation";
// Re-export types for convenience // Re-export types for convenience
export type { export type {
@ -12,5 +12,5 @@ export type {
MappingStats, MappingStats,
BulkMappingOperation, BulkMappingOperation,
BulkMappingResult, BulkMappingResult,
} from "./schema.js"; } from "./schema";
export type { MappingValidationResult } from "./contract.js"; export type { MappingValidationResult } from "./contract";

View File

@ -7,7 +7,7 @@ import type {
CreateMappingRequest, CreateMappingRequest,
UpdateMappingRequest, UpdateMappingRequest,
UserIdMapping, UserIdMapping,
} from "./contract.js"; } from "./contract";
export const createMappingRequestSchema: z.ZodType<CreateMappingRequest> = z.object({ export const createMappingRequestSchema: z.ZodType<CreateMappingRequest> = z.object({
userId: z.string().uuid(), userId: z.string().uuid(),

View File

@ -10,13 +10,13 @@ import {
createMappingRequestSchema, createMappingRequestSchema,
updateMappingRequestSchema, updateMappingRequestSchema,
userIdMappingSchema, userIdMappingSchema,
} from "./schema.js"; } from "./schema";
import type { import type {
CreateMappingRequest, CreateMappingRequest,
UpdateMappingRequest, UpdateMappingRequest,
UserIdMapping, UserIdMapping,
MappingValidationResult, MappingValidationResult,
} from "./contract.js"; } from "./contract";
/** /**
* Check if a mapping request has optional Salesforce account ID * Check if a mapping request has optional Salesforce account ID

View File

@ -5,9 +5,9 @@
* Validated types are derived from schemas (see schema.ts). * Validated types are derived from schemas (see schema.ts).
*/ */
import type { SalesforceProductFieldMap } from "../catalog/contract.js"; import type { SalesforceProductFieldMap } from "../catalog/contract";
import type { SalesforceAccountFieldMap } from "../customer/index.js"; import type { SalesforceAccountFieldMap } from "../customer/index";
import type { UserIdMapping } from "../mappings/contract.js"; import type { UserIdMapping } from "../mappings/contract";
// ============================================================================ // ============================================================================
// Order Type Constants // Order Type Constants

View File

@ -19,13 +19,13 @@ export {
SIM_TYPE, SIM_TYPE,
ORDER_FULFILLMENT_ERROR_CODE, ORDER_FULFILLMENT_ERROR_CODE,
type OrderFulfillmentErrorCode, type OrderFulfillmentErrorCode,
} from "./contract.js"; } from "./contract";
// Schemas (includes derived types) // Schemas (includes derived types)
export * from "./schema.js"; export * from "./schema";
// Validation (extended business rules) // Validation (extended business rules)
export * from "./validation.js"; export * from "./validation";
// Re-export types for convenience // Re-export types for convenience
export type { export type {
@ -45,8 +45,8 @@ export type {
} from './schema'; } from './schema';
// Provider adapters // Provider adapters
export * as Providers from "./providers/index.js"; export * as Providers from "./providers/index";
// Re-export provider types for convenience // Re-export provider types for convenience
export * from "./providers/whmcs/raw.types.js"; export * from "./providers/whmcs/raw.types";
export * from "./providers/salesforce/raw.types.js"; export * from "./providers/salesforce/raw.types";

View File

@ -2,10 +2,10 @@
* Orders Domain - Providers * Orders Domain - Providers
*/ */
import * as WhmcsMapper from "./whmcs/mapper.js"; import * as WhmcsMapper from "./whmcs/mapper";
import * as WhmcsRaw from "./whmcs/raw.types.js"; import * as WhmcsRaw from "./whmcs/raw.types";
import * as SalesforceMapper from "./salesforce/mapper.js"; import * as SalesforceMapper from "./salesforce/mapper";
import * as SalesforceRaw from "./salesforce/raw.types.js"; import * as SalesforceRaw from "./salesforce/raw.types";
export const Whmcs = { export const Whmcs = {
...WhmcsMapper, ...WhmcsMapper,
@ -25,7 +25,7 @@ export {
SalesforceMapper, SalesforceMapper,
SalesforceRaw, SalesforceRaw,
}; };
export * from "./whmcs/mapper.js"; export * from "./whmcs/mapper";
export * from "./whmcs/raw.types.js"; export * from "./whmcs/raw.types";
export * from "./salesforce/mapper.js"; export * from "./salesforce/mapper";
export * from "./salesforce/raw.types.js"; export * from "./salesforce/raw.types";

View File

@ -1,2 +1,2 @@
export * from "./raw.types.js"; export * from "./raw.types";
export * from "./mapper.js"; export * from "./mapper";

View File

@ -9,12 +9,12 @@ import type {
OrderItemDetails, OrderItemDetails,
OrderItemSummary, OrderItemSummary,
OrderSummary, OrderSummary,
} from "../../contract.js"; } from "../../contract";
import { orderDetailsSchema, orderSummarySchema, orderItemDetailsSchema } from "../../schema.js"; import { orderDetailsSchema, orderSummarySchema, orderItemDetailsSchema } from "../../schema";
import type { import type {
SalesforceOrderItemRecord, SalesforceOrderItemRecord,
SalesforceOrderRecord, SalesforceOrderRecord,
} from "./raw.types.js"; } from "./raw.types";
/** /**
* Transform a Salesforce OrderItem record into domain details + summary. * Transform a Salesforce OrderItem record into domain details + summary.

View File

@ -1,2 +1,2 @@
export * from "./mapper.js"; export * from "./mapper";
export * from "./raw.types.js"; export * from "./raw.types";

View File

@ -4,12 +4,12 @@
* Transforms normalized order data to WHMCS API format. * Transforms normalized order data to WHMCS API format.
*/ */
import type { OrderDetails, OrderItemDetails } from "../../contract.js"; import type { OrderDetails, OrderItemDetails } from "../../contract";
import { import {
type WhmcsOrderItem, type WhmcsOrderItem,
type WhmcsAddOrderParams, type WhmcsAddOrderParams,
type WhmcsAddOrderPayload, type WhmcsAddOrderPayload,
} from "./raw.types.js"; } from "./raw.types";
export interface OrderItemMappingResult { export interface OrderItemMappingResult {
whmcsItems: WhmcsOrderItem[]; whmcsItems: WhmcsOrderItem[];

View File

@ -6,7 +6,7 @@
*/ */
import { z } from "zod"; import { z } from "zod";
import { orderBusinessValidationSchema } from "./schema.js"; import { orderBusinessValidationSchema } from "./schema";
// ============================================================================ // ============================================================================
// SKU Business Rules Helpers // SKU Business Rules Helpers

View File

@ -1,7 +1,7 @@
{ {
"name": "@customer-portal/domain", "name": "@customer-portal/domain",
"version": "1.0.0", "version": "1.0.0",
"type": "module", "type": "commonjs",
"description": "Unified domain layer with contracts, schemas, and provider mappers", "description": "Unified domain layer with contracts, schemas, and provider mappers",
"main": "./dist/index.js", "main": "./dist/index.js",
"types": "./dist/index.d.ts", "types": "./dist/index.d.ts",

View File

@ -7,10 +7,10 @@
*/ */
// Constants // Constants
export { PAYMENT_METHOD_TYPE, PAYMENT_GATEWAY_TYPE, type InvoicePaymentLink } from "./contract.js"; export { PAYMENT_METHOD_TYPE, PAYMENT_GATEWAY_TYPE, type InvoicePaymentLink } from "./contract";
// Schemas (includes derived types) // Schemas (includes derived types)
export * from "./schema.js"; export * from "./schema";
// Re-export types for convenience // Re-export types for convenience
export type { export type {
@ -20,10 +20,10 @@ export type {
PaymentGatewayType, PaymentGatewayType,
PaymentGateway, PaymentGateway,
PaymentGatewayList, PaymentGatewayList,
} from './schema.js'; } from './schema';
// Provider adapters // Provider adapters
export * as Providers from "./providers/index.js"; export * as Providers from "./providers/index";
// Re-export provider raw types (request and response) // Re-export provider raw types (request and response)
export type { export type {
@ -34,4 +34,4 @@ export type {
WhmcsPaymentMethodListResponse, WhmcsPaymentMethodListResponse,
WhmcsPaymentGateway, WhmcsPaymentGateway,
WhmcsPaymentGatewayListResponse, WhmcsPaymentGatewayListResponse,
} from "./providers/whmcs/raw.types.js"; } from "./providers/whmcs/raw.types";

View File

@ -2,8 +2,8 @@
* Payments Domain - Providers * Payments Domain - Providers
*/ */
import * as WhmcsMapper from "./whmcs/mapper.js"; import * as WhmcsMapper from "./whmcs/mapper";
import * as WhmcsRaw from "./whmcs/raw.types.js"; import * as WhmcsRaw from "./whmcs/raw.types";
export const Whmcs = { export const Whmcs = {
...WhmcsMapper, ...WhmcsMapper,
@ -12,5 +12,5 @@ export const Whmcs = {
}; };
export { WhmcsMapper, WhmcsRaw }; export { WhmcsMapper, WhmcsRaw };
export * from "./whmcs/mapper.js"; export * from "./whmcs/mapper";
export * from "./whmcs/raw.types.js"; export * from "./whmcs/raw.types";

View File

@ -1,2 +1,2 @@
export * from "./mapper.js"; export * from "./mapper";
export * from "./raw.types.js"; export * from "./raw.types";

View File

@ -2,14 +2,14 @@
* WHMCS Payments Provider - Mapper * WHMCS Payments Provider - Mapper
*/ */
import type { PaymentMethod, PaymentGateway } from "../../contract.js"; import type { PaymentMethod, PaymentGateway } from "../../contract";
import { paymentMethodSchema, paymentGatewaySchema } from "../../schema.js"; import { paymentMethodSchema, paymentGatewaySchema } from "../../schema";
import { import {
type WhmcsPaymentMethodRaw, type WhmcsPaymentMethodRaw,
type WhmcsPaymentGatewayRaw, type WhmcsPaymentGatewayRaw,
whmcsPaymentMethodRawSchema, whmcsPaymentMethodRawSchema,
whmcsPaymentGatewayRawSchema, whmcsPaymentGatewayRawSchema,
} from "./raw.types.js"; } from "./raw.types";
const PAYMENT_TYPE_MAP: Record<string, PaymentMethod["type"]> = { const PAYMENT_TYPE_MAP: Record<string, PaymentMethod["type"]> = {
creditcard: "CreditCard", creditcard: "CreditCard",

View File

@ -7,13 +7,13 @@
*/ */
// Constants // Constants
export { SIM_STATUS, SIM_TYPE } from "./contract.js"; export { SIM_STATUS, SIM_TYPE } from "./contract";
// Schemas (includes derived types) // Schemas (includes derived types)
export * from "./schema.js"; export * from "./schema";
// Validation functions // Validation functions
export * from "./validation.js"; export * from "./validation";
// Re-export types for convenience // Re-export types for convenience
export type { export type {
@ -34,7 +34,7 @@ export type {
SimOrderActivationRequest, SimOrderActivationRequest,
SimOrderActivationMnp, SimOrderActivationMnp,
SimOrderActivationAddons, SimOrderActivationAddons,
} from './schema.js'; } from './schema';
// Provider adapters // Provider adapters
export * as Providers from "./providers/index.js"; export * as Providers from "./providers/index";

View File

@ -1,7 +1,7 @@
import * as Mapper from "./mapper.js"; import * as Mapper from "./mapper";
import * as RawTypes from "./raw.types.js"; import * as RawTypes from "./raw.types";
import * as Requests from "./requests.js"; import * as Requests from "./requests";
import * as Utils from "./utils.js"; import * as Utils from "./utils";
export const schemas = { export const schemas = {
accountDetails: Requests.freebitAccountDetailsRequestSchema, accountDetails: Requests.freebitAccountDetailsRequestSchema,
@ -51,10 +51,10 @@ export type EsimAddAccountResponse = ReturnType<typeof Mapper.transformFreebitEs
export type EsimActivationResponse = ReturnType<typeof Mapper.transformFreebitEsimActivationResponse>; export type EsimActivationResponse = ReturnType<typeof Mapper.transformFreebitEsimActivationResponse>;
export type AuthResponse = ReturnType<typeof Mapper.transformFreebitAuthResponse>; export type AuthResponse = ReturnType<typeof Mapper.transformFreebitAuthResponse>;
export * from "./mapper.js"; export * from "./mapper";
export * from "./raw.types.js"; export * from "./raw.types";
export * from "./requests.js"; export * from "./requests";
export * from "./utils.js"; export * from "./utils";
export const Freebit = { export const Freebit = {
...Mapper, ...Mapper,

View File

@ -2,8 +2,8 @@
* Freebit SIM Provider - Mapper * Freebit SIM Provider - Mapper
*/ */
import type { SimDetails, SimUsage, SimTopUpHistory, SimType, SimStatus } from "../../contract.js"; import type { SimDetails, SimUsage, SimTopUpHistory, SimType, SimStatus } from "../../contract";
import { simDetailsSchema, simUsageSchema, simTopUpHistorySchema } from "../../schema.js"; import { simDetailsSchema, simUsageSchema, simTopUpHistorySchema } from "../../schema";
import { import {
type FreebitAccountDetailsRaw, type FreebitAccountDetailsRaw,
type FreebitTrafficInfoRaw, type FreebitTrafficInfoRaw,
@ -27,8 +27,8 @@ import {
freebitCancelAccountRawSchema, freebitCancelAccountRawSchema,
freebitEsimReissueRawSchema, freebitEsimReissueRawSchema,
freebitEsimAddAccountRawSchema, freebitEsimAddAccountRawSchema,
} from "./raw.types.js"; } from "./raw.types";
import { normalizeAccount } from "./utils.js"; import { normalizeAccount } from "./utils";
function asString(value: unknown): string { function asString(value: unknown): string {
if (typeof value === "string") return value; if (typeof value === "string") return value;

View File

@ -2,9 +2,9 @@
* SIM Domain - Providers * SIM Domain - Providers
*/ */
import { Freebit as FreebitAggregated } from "./freebit/index.js"; import { Freebit as FreebitAggregated } from "./freebit/index";
import * as FreebitModule from "./freebit/index.js"; import * as FreebitModule from "./freebit/index";
export const Freebit = FreebitAggregated; export const Freebit = FreebitAggregated;
export { FreebitModule }; export { FreebitModule };
export * from "./freebit/index.js"; export * from "./freebit/index";

View File

@ -5,7 +5,7 @@
* These functions contain no infrastructure dependencies. * These functions contain no infrastructure dependencies.
*/ */
import type { Subscription } from "../subscriptions/schema.js"; import type { Subscription } from "../subscriptions/schema";
/** /**
* Check if a subscription is a SIM service * Check if a subscription is a SIM service

View File

@ -7,10 +7,10 @@
*/ */
// Constants // Constants
export { SUBSCRIPTION_STATUS, SUBSCRIPTION_CYCLE } from "./contract.js"; export { SUBSCRIPTION_STATUS, SUBSCRIPTION_CYCLE } from "./contract";
// Schemas (includes derived types) // Schemas (includes derived types)
export * from "./schema.js"; export * from "./schema";
// Re-export types for convenience // Re-export types for convenience
export type { export type {
@ -23,10 +23,10 @@ export type {
SubscriptionStats, SubscriptionStats,
SimActionResponse, SimActionResponse,
SimPlanChangeResult, SimPlanChangeResult,
} from './schema.js'; } from './schema';
// Provider adapters // Provider adapters
export * as Providers from "./providers/index.js"; export * as Providers from "./providers/index";
// Re-export provider raw types (request and response) // Re-export provider raw types (request and response)
export type { export type {

View File

@ -2,8 +2,8 @@
* Subscriptions Domain - Providers * Subscriptions Domain - Providers
*/ */
import * as WhmcsMapper from "./whmcs/mapper.js"; import * as WhmcsMapper from "./whmcs/mapper";
import * as WhmcsRaw from "./whmcs/raw.types.js"; import * as WhmcsRaw from "./whmcs/raw.types";
export const Whmcs = { export const Whmcs = {
...WhmcsMapper, ...WhmcsMapper,
@ -12,5 +12,5 @@ export const Whmcs = {
}; };
export { WhmcsMapper, WhmcsRaw }; export { WhmcsMapper, WhmcsRaw };
export * from "./whmcs/mapper.js"; export * from "./whmcs/mapper";
export * from "./whmcs/raw.types.js"; export * from "./whmcs/raw.types";

View File

@ -1,2 +1,2 @@
export * from "./mapper.js"; export * from "./mapper";
export * from "./raw.types.js"; export * from "./raw.types";

View File

@ -4,13 +4,13 @@
* Transforms raw WHMCS product/service data into normalized subscription types. * Transforms raw WHMCS product/service data into normalized subscription types.
*/ */
import type { Subscription, SubscriptionStatus, SubscriptionCycle } from "../../contract.js"; import type { Subscription, SubscriptionStatus, SubscriptionCycle } from "../../contract";
import { subscriptionSchema } from "../../schema.js"; import { subscriptionSchema } from "../../schema";
import { import {
type WhmcsProductRaw, type WhmcsProductRaw,
whmcsProductRawSchema, whmcsProductRawSchema,
whmcsCustomFieldsContainerSchema, whmcsCustomFieldsContainerSchema,
} from "./raw.types.js"; } from "./raw.types";
export interface TransformSubscriptionOptions { export interface TransformSubscriptionOptions {
defaultCurrencyCode?: string; defaultCurrencyCode?: string;

View File

@ -4,8 +4,8 @@
* Formatting utilities for currency, dates, phone numbers, etc. * Formatting utilities for currency, dates, phone numbers, etc.
*/ */
export * from "./currency.js"; export * from "./currency";
export * from "./date.js"; export * from "./date";
export * from "./phone.js"; export * from "./phone";
export * from "./text.js"; export * from "./text";

View File

@ -4,7 +4,7 @@
* Utility functions and helpers used across all domain packages. * Utility functions and helpers used across all domain packages.
*/ */
export * as Formatting from "./formatting/index.js"; export * as Formatting from "./formatting/index";
export * as Validation from "./validation/index.js"; export * as Validation from "./validation/index";
export * as Typing from "./typing/index.js"; export * as Typing from "./typing/index";

View File

@ -4,7 +4,7 @@
* TypeScript type utilities and runtime type checking. * TypeScript type utilities and runtime type checking.
*/ */
export * from "./guards.js"; export * from "./guards";
export * from "./assertions.js"; export * from "./assertions";
export * from "./helpers.js"; export * from "./helpers";

View File

@ -4,9 +4,9 @@
* Validation utilities for common data types. * Validation utilities for common data types.
*/ */
export * from "./email.js"; export * from "./email";
export * from "./url.js"; export * from "./url";
export * from "./string.js"; export * from "./string";
export * from "./helpers.js"; export * from "./helpers";

View File

@ -1,7 +1,7 @@
{ {
"compilerOptions": { "compilerOptions": {
"target": "ES2022", "target": "ES2022",
"module": "ESNext", "module": "commonjs",
"lib": ["ES2022"], "lib": ["ES2022"],
"declaration": true, "declaration": true,
"declarationMap": true, "declarationMap": true,