diff --git a/apps/bff/package.json b/apps/bff/package.json index 440b6440..087e1bec 100644 --- a/apps/bff/package.json +++ b/apps/bff/package.json @@ -1,6 +1,7 @@ { "name": "@customer-portal/bff", "version": "1.0.0", + "type": "module", "description": "Backend for Frontend API", "author": "", "private": true, diff --git a/apps/bff/tsconfig.json b/apps/bff/tsconfig.json index a30fcc97..44837be1 100644 --- a/apps/bff/tsconfig.json +++ b/apps/bff/tsconfig.json @@ -31,8 +31,9 @@ }, "ts-node": { "transpileOnly": true, + "esm": true, "compilerOptions": { - "module": "CommonJS" + "module": "Node16" } }, "include": ["src/**/*", "scripts/**/*", "src/types/**/*"], diff --git a/packages/domain/auth/schema.ts b/packages/domain/auth/schema.ts index 70d910cf..1e56c91d 100644 --- a/packages/domain/auth/schema.ts +++ b/packages/domain/auth/schema.ts @@ -12,8 +12,8 @@ import { z } from "zod"; -import { emailSchema, nameSchema, passwordSchema, phoneSchema } from "../common/schema"; -import { addressSchema, userSchema } from "../customer/schema"; +import { emailSchema, nameSchema, passwordSchema, phoneSchema } from "../common/schema.js"; +import { addressSchema, userSchema } from "../customer/schema.js"; // ============================================================================ // Authentication Request Schemas diff --git a/packages/domain/billing/providers/whmcs/mapper.ts b/packages/domain/billing/providers/whmcs/mapper.ts index 31fe1ffb..a8f52a05 100644 --- a/packages/domain/billing/providers/whmcs/mapper.ts +++ b/packages/domain/billing/providers/whmcs/mapper.ts @@ -4,8 +4,8 @@ * Transforms raw WHMCS invoice data into normalized billing domain types. */ -import type { Invoice, InvoiceItem } from "../../contract"; -import { invoiceSchema } from "../../schema"; +import type { Invoice, InvoiceItem } from "../../contract.js"; +import { invoiceSchema } from "../../schema.js"; import { type WhmcsInvoiceRaw, whmcsInvoiceRawSchema, diff --git a/packages/domain/catalog/providers/salesforce/mapper.ts b/packages/domain/catalog/providers/salesforce/mapper.ts index 65ee210c..5102cc0d 100644 --- a/packages/domain/catalog/providers/salesforce/mapper.ts +++ b/packages/domain/catalog/providers/salesforce/mapper.ts @@ -13,7 +13,7 @@ import type { SimCatalogProduct, SimActivationFeeCatalogItem, VpnCatalogProduct, -} from "../../contract"; +} from "../../contract.js"; import type { SalesforceProduct2WithPricebookEntries, SalesforcePricebookEntryRecord, diff --git a/packages/domain/customer/providers/portal/mapper.ts b/packages/domain/customer/providers/portal/mapper.ts index a53fe01c..d55fca00 100644 --- a/packages/domain/customer/providers/portal/mapper.ts +++ b/packages/domain/customer/providers/portal/mapper.ts @@ -4,9 +4,9 @@ * Maps Prisma user data to UserAuth domain type using schema validation */ -import { userAuthSchema } from "../../schema"; +import { userAuthSchema } from "../../schema.js"; import type { PrismaUserRaw } from "./types.js"; -import type { UserAuth } from "../../schema"; +import type { UserAuth } from "../../schema.js"; /** * Maps raw Prisma user data to UserAuth domain type diff --git a/packages/domain/customer/providers/portal/types.ts b/packages/domain/customer/providers/portal/types.ts index e9266b0e..b60d1ef6 100644 --- a/packages/domain/customer/providers/portal/types.ts +++ b/packages/domain/customer/providers/portal/types.ts @@ -5,7 +5,7 @@ * Domain doesn't depend on @prisma/client directly. */ -import type { UserRole } from "../../schema"; +import type { UserRole } from "../../schema.js"; /** * Raw Prisma user data from portal database diff --git a/packages/domain/customer/providers/whmcs/mapper.ts b/packages/domain/customer/providers/whmcs/mapper.ts index 2b583fbe..85802a6e 100644 --- a/packages/domain/customer/providers/whmcs/mapper.ts +++ b/packages/domain/customer/providers/whmcs/mapper.ts @@ -7,8 +7,8 @@ import { z } from "zod"; -import type { WhmcsClient, Address } from "../../schema"; -import { whmcsClientSchema, addressSchema } from "../../schema"; +import type { WhmcsClient, Address } from "../../schema.js"; +import { whmcsClientSchema, addressSchema } from "../../schema.js"; import { whmcsClientSchema as whmcsRawClientSchema, whmcsClientResponseSchema, diff --git a/packages/domain/customer/schema.ts b/packages/domain/customer/schema.ts index 7ecfd574..9e2ed205 100644 --- a/packages/domain/customer/schema.ts +++ b/packages/domain/customer/schema.ts @@ -12,7 +12,7 @@ import { z } from "zod"; -import { countryCodeSchema } from "../common/schema"; +import { countryCodeSchema } from "../common/schema.js"; // ============================================================================ // Helper Schemas diff --git a/packages/domain/dashboard/contract.ts b/packages/domain/dashboard/contract.ts index 0d4733c8..12133407 100644 --- a/packages/domain/dashboard/contract.ts +++ b/packages/domain/dashboard/contract.ts @@ -4,8 +4,8 @@ * Shared types for dashboard summaries, activity feeds, and related data. */ -import type { IsoDateTimeString } from "../common/types"; -import type { Invoice } from "../billing/contract"; +import type { IsoDateTimeString } from "../common/types.js"; +import type { Invoice } from "../billing/contract.js"; export type ActivityType = | "invoice_created" diff --git a/packages/domain/mappings/contract.ts b/packages/domain/mappings/contract.ts index 9bf0b6f1..54cf8089 100644 --- a/packages/domain/mappings/contract.ts +++ b/packages/domain/mappings/contract.ts @@ -4,7 +4,7 @@ * Normalized types for mapping portal users to external systems. */ -import type { IsoDateTimeString } from "../common/types"; +import type { IsoDateTimeString } from "../common/types.js"; export interface UserIdMapping { id: string; diff --git a/packages/domain/orders/contract.ts b/packages/domain/orders/contract.ts index 5279a51c..8450fed8 100644 --- a/packages/domain/orders/contract.ts +++ b/packages/domain/orders/contract.ts @@ -5,9 +5,9 @@ * Validated types are derived from schemas (see schema.ts). */ -import type { SalesforceProductFieldMap } from "../catalog/contract"; -import type { SalesforceAccountFieldMap } from "../customer"; -import type { UserIdMapping } from "../mappings/contract"; +import type { SalesforceProductFieldMap } from "../catalog/contract.js"; +import type { SalesforceAccountFieldMap } from "../customer/index.js"; +import type { UserIdMapping } from "../mappings/contract.js"; // ============================================================================ // Order Type Constants diff --git a/packages/domain/orders/providers/salesforce/mapper.ts b/packages/domain/orders/providers/salesforce/mapper.ts index bf56d3b3..fc3e276e 100644 --- a/packages/domain/orders/providers/salesforce/mapper.ts +++ b/packages/domain/orders/providers/salesforce/mapper.ts @@ -9,8 +9,8 @@ import type { OrderItemDetails, OrderItemSummary, OrderSummary, -} from "../../contract"; -import { orderDetailsSchema, orderSummarySchema, orderItemDetailsSchema } from "../../schema"; +} from "../../contract.js"; +import { orderDetailsSchema, orderSummarySchema, orderItemDetailsSchema } from "../../schema.js"; import type { SalesforceOrderItemRecord, SalesforceOrderRecord, diff --git a/packages/domain/orders/providers/whmcs/mapper.ts b/packages/domain/orders/providers/whmcs/mapper.ts index ab7d8d4c..6df1fd0f 100644 --- a/packages/domain/orders/providers/whmcs/mapper.ts +++ b/packages/domain/orders/providers/whmcs/mapper.ts @@ -4,7 +4,7 @@ * Transforms normalized order data to WHMCS API format. */ -import type { OrderDetails, OrderItemDetails } from "../../contract"; +import type { OrderDetails, OrderItemDetails } from "../../contract.js"; import { type WhmcsOrderItem, type WhmcsAddOrderParams, diff --git a/packages/domain/package.json b/packages/domain/package.json index 512f12c3..8bf04294 100644 --- a/packages/domain/package.json +++ b/packages/domain/package.json @@ -1,6 +1,7 @@ { "name": "@customer-portal/domain", "version": "1.0.0", + "type": "module", "description": "Unified domain layer with contracts, schemas, and provider mappers", "main": "./dist/index.js", "types": "./dist/index.d.ts", diff --git a/packages/domain/payments/providers/whmcs/mapper.ts b/packages/domain/payments/providers/whmcs/mapper.ts index 2a54f3ef..d037b26f 100644 --- a/packages/domain/payments/providers/whmcs/mapper.ts +++ b/packages/domain/payments/providers/whmcs/mapper.ts @@ -2,8 +2,8 @@ * WHMCS Payments Provider - Mapper */ -import type { PaymentMethod, PaymentGateway } from "../../contract"; -import { paymentMethodSchema, paymentGatewaySchema } from "../../schema"; +import type { PaymentMethod, PaymentGateway } from "../../contract.js"; +import { paymentMethodSchema, paymentGatewaySchema } from "../../schema.js"; import { type WhmcsPaymentMethodRaw, type WhmcsPaymentGatewayRaw, diff --git a/packages/domain/sim/providers/freebit/mapper.ts b/packages/domain/sim/providers/freebit/mapper.ts index 1de32b27..fecf4383 100644 --- a/packages/domain/sim/providers/freebit/mapper.ts +++ b/packages/domain/sim/providers/freebit/mapper.ts @@ -2,8 +2,8 @@ * Freebit SIM Provider - Mapper */ -import type { SimDetails, SimUsage, SimTopUpHistory, SimType, SimStatus } from "../../contract"; -import { simDetailsSchema, simUsageSchema, simTopUpHistorySchema } from "../../schema"; +import type { SimDetails, SimUsage, SimTopUpHistory, SimType, SimStatus } from "../../contract.js"; +import { simDetailsSchema, simUsageSchema, simTopUpHistorySchema } from "../../schema.js"; import { type FreebitAccountDetailsRaw, type FreebitTrafficInfoRaw, diff --git a/packages/domain/sim/validation.ts b/packages/domain/sim/validation.ts index 3c258035..173b851c 100644 --- a/packages/domain/sim/validation.ts +++ b/packages/domain/sim/validation.ts @@ -5,7 +5,7 @@ * These functions contain no infrastructure dependencies. */ -import type { Subscription } from "../subscriptions/schema"; +import type { Subscription } from "../subscriptions/schema.js"; /** * Check if a subscription is a SIM service diff --git a/packages/domain/subscriptions/providers/whmcs/mapper.ts b/packages/domain/subscriptions/providers/whmcs/mapper.ts index eb7b54b9..fb3ff3fc 100644 --- a/packages/domain/subscriptions/providers/whmcs/mapper.ts +++ b/packages/domain/subscriptions/providers/whmcs/mapper.ts @@ -4,8 +4,8 @@ * Transforms raw WHMCS product/service data into normalized subscription types. */ -import type { Subscription, SubscriptionStatus, SubscriptionCycle } from "../../contract"; -import { subscriptionSchema } from "../../schema"; +import type { Subscription, SubscriptionStatus, SubscriptionCycle } from "../../contract.js"; +import { subscriptionSchema } from "../../schema.js"; import { type WhmcsProductRaw, whmcsProductRawSchema,