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:
parent
5eebd11668
commit
7b7d736aaf
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@customer-portal/bff",
|
||||
"version": "1.0.0",
|
||||
"type": "module",
|
||||
"type": "commonjs",
|
||||
"description": "Backend for Frontend API",
|
||||
"author": "",
|
||||
"private": true,
|
||||
|
||||
@ -9,10 +9,9 @@
|
||||
|
||||
import type { User as PrismaUser } from "@prisma/client";
|
||||
import type { UserAuth } from "@customer-portal/domain/customer";
|
||||
import {
|
||||
mapPrismaUserToUserAuth,
|
||||
type PrismaUserRaw
|
||||
} from "@customer-portal/domain/customer/providers/portal";
|
||||
import { Providers as CustomerProviders } from "@customer-portal/domain/customer";
|
||||
|
||||
type PrismaUserRaw = Parameters<typeof CustomerProviders.Portal.mapPrismaUserToUserAuth>[0];
|
||||
|
||||
/**
|
||||
* Maps Prisma User entity to Domain UserAuth type
|
||||
@ -40,6 +39,6 @@ export function mapPrismaUserToDomain(user: PrismaUser): UserAuth {
|
||||
};
|
||||
|
||||
// Use domain provider mapper
|
||||
return mapPrismaUserToUserAuth(prismaUserRaw);
|
||||
return CustomerProviders.Portal.mapPrismaUserToUserAuth(prismaUserRaw);
|
||||
}
|
||||
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"module": "Node16",
|
||||
"moduleResolution": "node16",
|
||||
"module": "commonjs",
|
||||
"moduleResolution": "node",
|
||||
"lib": ["ES2022"],
|
||||
"noEmit": true,
|
||||
"baseUrl": ".",
|
||||
@ -27,13 +27,14 @@
|
||||
"typeRoots": ["./node_modules/@types"],
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"strictPropertyInitialization": false
|
||||
"strictPropertyInitialization": false,
|
||||
"esModuleInterop": true,
|
||||
"allowSyntheticDefaultImports": true
|
||||
},
|
||||
"ts-node": {
|
||||
"transpileOnly": true,
|
||||
"esm": true,
|
||||
"compilerOptions": {
|
||||
"module": "Node16"
|
||||
"module": "commonjs"
|
||||
}
|
||||
},
|
||||
"include": ["src/**/*", "scripts/**/*", "src/types/**/*"],
|
||||
|
||||
@ -20,7 +20,7 @@ export {
|
||||
type AuthErrorCode,
|
||||
type TokenTypeValue,
|
||||
type GenderValue,
|
||||
} from "./contract.js";
|
||||
} from "./contract";
|
||||
|
||||
export type {
|
||||
// Request types
|
||||
@ -47,7 +47,7 @@ export type {
|
||||
CheckPasswordNeededResponse,
|
||||
// Error types
|
||||
AuthError,
|
||||
} from "./contract.js";
|
||||
} from "./contract";
|
||||
|
||||
// ============================================================================
|
||||
// Schemas (for validation)
|
||||
@ -81,4 +81,4 @@ export {
|
||||
passwordChangeResultSchema,
|
||||
ssoLinkResponseSchema,
|
||||
checkPasswordNeededResponseSchema,
|
||||
} from "./schema.js";
|
||||
} from "./schema";
|
||||
|
||||
@ -12,8 +12,8 @@
|
||||
|
||||
import { z } from "zod";
|
||||
|
||||
import { emailSchema, nameSchema, passwordSchema, phoneSchema } from "../common/schema.js";
|
||||
import { addressSchema, userSchema } from "../customer/schema.js";
|
||||
import { emailSchema, nameSchema, passwordSchema, phoneSchema } from "../common/schema";
|
||||
import { addressSchema, userSchema } from "../customer/schema";
|
||||
|
||||
// ============================================================================
|
||||
// Authentication Request Schemas
|
||||
|
||||
@ -7,11 +7,11 @@
|
||||
*/
|
||||
|
||||
// Constants
|
||||
export { INVOICE_STATUS } from "./contract.js";
|
||||
export * from "./constants.js";
|
||||
export { INVOICE_STATUS } from "./contract";
|
||||
export * from "./constants";
|
||||
|
||||
// Schemas (includes derived types)
|
||||
export * from "./schema.js";
|
||||
export * from "./schema";
|
||||
|
||||
// Re-export types for convenience
|
||||
export type {
|
||||
@ -28,7 +28,7 @@ export type {
|
||||
} from './schema';
|
||||
|
||||
// Provider adapters
|
||||
export * as Providers from "./providers/index.js";
|
||||
export * as Providers from "./providers/index";
|
||||
|
||||
// Re-export provider raw types (request and response)
|
||||
export type {
|
||||
@ -45,4 +45,4 @@ export type {
|
||||
WhmcsCapturePaymentResponse,
|
||||
WhmcsCurrency,
|
||||
WhmcsCurrenciesResponse,
|
||||
} from "./providers/whmcs/raw.types.js";
|
||||
} from "./providers/whmcs/raw.types";
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
* Billing Domain - Providers
|
||||
*/
|
||||
|
||||
import * as WhmcsMapper from "./whmcs/mapper.js";
|
||||
import * as WhmcsRaw from "./whmcs/raw.types.js";
|
||||
import * as WhmcsMapper from "./whmcs/mapper";
|
||||
import * as WhmcsRaw from "./whmcs/raw.types";
|
||||
|
||||
export const Whmcs = {
|
||||
...WhmcsMapper,
|
||||
@ -12,5 +12,5 @@ export const Whmcs = {
|
||||
};
|
||||
|
||||
export { WhmcsMapper, WhmcsRaw };
|
||||
export * from "./whmcs/mapper.js";
|
||||
export * from "./whmcs/raw.types.js";
|
||||
export * from "./whmcs/mapper";
|
||||
export * from "./whmcs/raw.types";
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
export * from "./mapper.js";
|
||||
export * from "./raw.types.js";
|
||||
export * from "./mapper";
|
||||
export * from "./raw.types";
|
||||
|
||||
@ -4,14 +4,14 @@
|
||||
* Transforms raw WHMCS invoice data into normalized billing domain types.
|
||||
*/
|
||||
|
||||
import type { Invoice, InvoiceItem } from "../../contract.js";
|
||||
import { invoiceSchema } from "../../schema.js";
|
||||
import type { Invoice, InvoiceItem } from "../../contract";
|
||||
import { invoiceSchema } from "../../schema";
|
||||
import {
|
||||
type WhmcsInvoiceRaw,
|
||||
whmcsInvoiceRawSchema,
|
||||
type WhmcsInvoiceItemsRaw,
|
||||
whmcsInvoiceItemsRawSchema,
|
||||
} from "./raw.types.js";
|
||||
} from "./raw.types";
|
||||
|
||||
export interface TransformInvoiceOptions {
|
||||
defaultCurrencyCode?: string;
|
||||
|
||||
@ -7,10 +7,10 @@
|
||||
*/
|
||||
|
||||
// Provider-specific types
|
||||
export { type SalesforceProductFieldMap } from "./contract.js";
|
||||
export { type SalesforceProductFieldMap } from "./contract";
|
||||
|
||||
// Schemas (includes derived types)
|
||||
export * from "./schema.js";
|
||||
export * from "./schema";
|
||||
|
||||
// Re-export types for convenience
|
||||
export type {
|
||||
@ -29,16 +29,16 @@ export type {
|
||||
VpnCatalogProduct,
|
||||
// Union type
|
||||
CatalogProduct,
|
||||
} from './schema.js';
|
||||
} from './schema';
|
||||
|
||||
// Provider adapters
|
||||
export * as Providers from "./providers/index.js";
|
||||
export * as Providers from "./providers/index";
|
||||
|
||||
// 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
|
||||
export type {
|
||||
WhmcsCatalogProduct,
|
||||
WhmcsCatalogProductListResponse,
|
||||
} from "./providers/whmcs/raw.types.js";
|
||||
} from "./providers/whmcs/raw.types";
|
||||
|
||||
@ -2,9 +2,9 @@
|
||||
* Catalog Domain - Providers
|
||||
*/
|
||||
|
||||
import * as SalesforceMapper from "./salesforce/mapper.js";
|
||||
import * as SalesforceRaw from "./salesforce/raw.types.js";
|
||||
import * as WhmcsRaw from "./whmcs/raw.types.js";
|
||||
import * as SalesforceMapper from "./salesforce/mapper";
|
||||
import * as SalesforceRaw from "./salesforce/raw.types";
|
||||
import * as WhmcsRaw from "./whmcs/raw.types";
|
||||
|
||||
export const Salesforce = {
|
||||
...SalesforceMapper,
|
||||
@ -17,6 +17,6 @@ export const Whmcs = {
|
||||
};
|
||||
|
||||
export { SalesforceMapper, SalesforceRaw, WhmcsRaw };
|
||||
export * from "./salesforce/mapper.js";
|
||||
export * from "./salesforce/raw.types.js";
|
||||
export * from "./whmcs/raw.types.js";
|
||||
export * from "./salesforce/mapper";
|
||||
export * from "./salesforce/raw.types";
|
||||
export * from "./whmcs/raw.types";
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
export * from "./mapper.js";
|
||||
export * from "./raw.types.js";
|
||||
export * from "./mapper";
|
||||
export * from "./raw.types";
|
||||
|
||||
@ -13,11 +13,11 @@ import type {
|
||||
SimCatalogProduct,
|
||||
SimActivationFeeCatalogItem,
|
||||
VpnCatalogProduct,
|
||||
} from "../../contract.js";
|
||||
} from "../../contract";
|
||||
import type {
|
||||
SalesforceProduct2WithPricebookEntries,
|
||||
SalesforcePricebookEntryRecord,
|
||||
} from "./raw.types.js";
|
||||
} from "./raw.types";
|
||||
|
||||
// ============================================================================
|
||||
// Tier Templates (Hardcoded Product Metadata)
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
export * from "./raw.types.js";
|
||||
export * from "./raw.types";
|
||||
|
||||
|
||||
@ -4,14 +4,14 @@
|
||||
* Shared types and utilities used across all domains.
|
||||
*/
|
||||
|
||||
export * from "./types.js";
|
||||
export * from "./schema.js";
|
||||
export * from "./validation.js";
|
||||
export * from "./types";
|
||||
export * from "./schema";
|
||||
export * from "./validation";
|
||||
|
||||
// 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
|
||||
export type { WhmcsResponse, WhmcsErrorResponse } from "./providers/whmcs.js";
|
||||
export type { SalesforceResponse } from "./providers/salesforce.js";
|
||||
export type { WhmcsResponse, WhmcsErrorResponse } from "./providers/whmcs";
|
||||
export type { SalesforceResponse } from "./providers/salesforce";
|
||||
|
||||
|
||||
@ -4,5 +4,5 @@
|
||||
* Generic provider-specific response structures used across multiple domains.
|
||||
*/
|
||||
|
||||
export * as Whmcs from "./whmcs.js";
|
||||
export * as Salesforce from "./salesforce/index.js";
|
||||
export * as Whmcs from "./whmcs";
|
||||
export * as Salesforce from "./salesforce/index";
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
export * from "./raw.types.js";
|
||||
export * from "./raw.types";
|
||||
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
// Constants
|
||||
// ============================================================================
|
||||
|
||||
export { USER_ROLE, type UserRoleValue } from "./contract.js";
|
||||
export { USER_ROLE, type UserRoleValue } from "./contract";
|
||||
|
||||
// ============================================================================
|
||||
// Domain Types (Clean Names - Public API)
|
||||
@ -27,7 +27,7 @@ export type {
|
||||
UserRole, // "USER" | "ADMIN"
|
||||
Address, // Address structure (not "CustomerAddress")
|
||||
AddressFormData, // Address form validation
|
||||
} from "./schema.js";
|
||||
} from "./schema";
|
||||
|
||||
// ============================================================================
|
||||
// Schemas
|
||||
@ -42,7 +42,7 @@ export {
|
||||
// Helper functions
|
||||
combineToUser, // Domain helper: UserAuth + WhmcsClient → User
|
||||
addressFormToRequest,
|
||||
} from "./schema.js";
|
||||
} from "./schema";
|
||||
|
||||
// ============================================================================
|
||||
// Provider Namespace
|
||||
@ -56,7 +56,7 @@ export {
|
||||
* - Providers.Whmcs.transformWhmcsClientResponse()
|
||||
* - Providers.Portal.mapPrismaUserToUserAuth()
|
||||
*/
|
||||
export * as Providers from "./providers/index.js";
|
||||
export * as Providers from "./providers/index";
|
||||
|
||||
// ============================================================================
|
||||
// Provider Raw Response Types (Selective Exports)
|
||||
@ -76,7 +76,7 @@ export type {
|
||||
WhmcsAddClientResponse,
|
||||
WhmcsValidateLoginResponse,
|
||||
WhmcsSsoResponse,
|
||||
} from "./providers/whmcs/raw.types.js";
|
||||
} from "./providers/whmcs/raw.types";
|
||||
|
||||
// ============================================================================
|
||||
// Provider-Specific Types (For Integrations)
|
||||
@ -89,4 +89,4 @@ export type {
|
||||
export type {
|
||||
SalesforceAccountFieldMap,
|
||||
SalesforceAccountRecord,
|
||||
} from "./contract.js";
|
||||
} from "./contract";
|
||||
|
||||
@ -6,5 +6,5 @@
|
||||
* - Whmcs: WHMCS API → WhmcsClient
|
||||
*/
|
||||
|
||||
export * as Portal from "./portal/index.js";
|
||||
export * as Whmcs from "./whmcs/index.js";
|
||||
export * as Portal from "./portal/index";
|
||||
export * as Whmcs from "./whmcs/index";
|
||||
|
||||
@ -4,6 +4,6 @@
|
||||
* Handles mapping from Prisma (portal database) to UserAuth domain type
|
||||
*/
|
||||
|
||||
export * from "./mapper.js";
|
||||
export * from "./types.js";
|
||||
export * from "./mapper";
|
||||
export * from "./types";
|
||||
|
||||
|
||||
@ -4,9 +4,9 @@
|
||||
* Maps Prisma user data to UserAuth domain type using schema validation
|
||||
*/
|
||||
|
||||
import { userAuthSchema } from "../../schema.js";
|
||||
import type { PrismaUserRaw } from "./types.js";
|
||||
import type { UserAuth } from "../../schema.js";
|
||||
import { userAuthSchema } from "../../schema";
|
||||
import type { PrismaUserRaw } from "./types";
|
||||
import type { UserAuth } from "../../schema";
|
||||
|
||||
/**
|
||||
* Maps raw Prisma user data to UserAuth domain type
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
* 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
|
||||
|
||||
@ -5,8 +5,8 @@
|
||||
* Exports transformation functions and raw API types (request/response).
|
||||
*/
|
||||
|
||||
export * from "./mapper.js";
|
||||
export * from "./raw.types.js";
|
||||
export * from "./mapper";
|
||||
export * from "./raw.types";
|
||||
|
||||
// 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";
|
||||
|
||||
@ -7,14 +7,14 @@
|
||||
|
||||
import { z } from "zod";
|
||||
|
||||
import type { WhmcsClient, Address } from "../../schema.js";
|
||||
import { whmcsClientSchema, addressSchema } from "../../schema.js";
|
||||
import type { WhmcsClient, Address } from "../../schema";
|
||||
import { whmcsClientSchema, addressSchema } from "../../schema";
|
||||
import {
|
||||
whmcsClientSchema as whmcsRawClientSchema,
|
||||
whmcsClientResponseSchema,
|
||||
type WhmcsClient as WhmcsRawClient,
|
||||
type WhmcsClientResponse,
|
||||
} from "./raw.types.js";
|
||||
} from "./raw.types";
|
||||
|
||||
/**
|
||||
* Parse and validate WHMCS client response
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
|
||||
import { z } from "zod";
|
||||
|
||||
import { countryCodeSchema } from "../common/schema.js";
|
||||
import { countryCodeSchema } from "../common/schema";
|
||||
|
||||
// ============================================================================
|
||||
// Helper Schemas
|
||||
|
||||
@ -4,8 +4,8 @@
|
||||
* Shared types for dashboard summaries, activity feeds, and related data.
|
||||
*/
|
||||
|
||||
import type { IsoDateTimeString } from "../common/types.js";
|
||||
import type { Invoice } from "../billing/contract.js";
|
||||
import type { IsoDateTimeString } from "../common/types";
|
||||
import type { Invoice } from "../billing/contract";
|
||||
|
||||
export type ActivityType =
|
||||
| "invoice_created"
|
||||
|
||||
@ -2,4 +2,4 @@
|
||||
* Dashboard Domain
|
||||
*/
|
||||
|
||||
export * from "./contract.js";
|
||||
export * from "./contract";
|
||||
|
||||
@ -4,15 +4,15 @@
|
||||
*/
|
||||
|
||||
// Re-export domain modules
|
||||
export * as Billing from "./billing/index.js";
|
||||
export * as Subscriptions from "./subscriptions/index.js";
|
||||
export * as Payments from "./payments/index.js";
|
||||
export * as Sim from "./sim/index.js";
|
||||
export * as Orders from "./orders/index.js";
|
||||
export * as Catalog from "./catalog/index.js";
|
||||
export * as Common from "./common/index.js";
|
||||
export * as Toolkit from "./toolkit/index.js";
|
||||
export * as Auth from "./auth/index.js";
|
||||
export * as Customer from "./customer/index.js";
|
||||
export * as Mappings from "./mappings/index.js";
|
||||
export * as Dashboard from "./dashboard/index.js";
|
||||
export * as Billing from "./billing/index";
|
||||
export * as Subscriptions from "./subscriptions/index";
|
||||
export * as Payments from "./payments/index";
|
||||
export * as Sim from "./sim/index";
|
||||
export * as Orders from "./orders/index";
|
||||
export * as Catalog from "./catalog/index";
|
||||
export * as Common from "./common/index";
|
||||
export * as Toolkit from "./toolkit/index";
|
||||
export * as Auth from "./auth/index";
|
||||
export * as Customer from "./customer/index";
|
||||
export * as Mappings from "./mappings/index";
|
||||
export * as Dashboard from "./dashboard/index";
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
* 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 {
|
||||
id: string;
|
||||
|
||||
@ -2,9 +2,9 @@
|
||||
* ID Mapping Domain
|
||||
*/
|
||||
|
||||
export * from "./contract.js";
|
||||
export * from "./schema.js";
|
||||
export * from "./validation.js";
|
||||
export * from "./contract";
|
||||
export * from "./schema";
|
||||
export * from "./validation";
|
||||
|
||||
// Re-export types for convenience
|
||||
export type {
|
||||
@ -12,5 +12,5 @@ export type {
|
||||
MappingStats,
|
||||
BulkMappingOperation,
|
||||
BulkMappingResult,
|
||||
} from "./schema.js";
|
||||
export type { MappingValidationResult } from "./contract.js";
|
||||
} from "./schema";
|
||||
export type { MappingValidationResult } from "./contract";
|
||||
|
||||
@ -7,7 +7,7 @@ import type {
|
||||
CreateMappingRequest,
|
||||
UpdateMappingRequest,
|
||||
UserIdMapping,
|
||||
} from "./contract.js";
|
||||
} from "./contract";
|
||||
|
||||
export const createMappingRequestSchema: z.ZodType<CreateMappingRequest> = z.object({
|
||||
userId: z.string().uuid(),
|
||||
|
||||
@ -10,13 +10,13 @@ import {
|
||||
createMappingRequestSchema,
|
||||
updateMappingRequestSchema,
|
||||
userIdMappingSchema,
|
||||
} from "./schema.js";
|
||||
} from "./schema";
|
||||
import type {
|
||||
CreateMappingRequest,
|
||||
UpdateMappingRequest,
|
||||
UserIdMapping,
|
||||
MappingValidationResult,
|
||||
} from "./contract.js";
|
||||
} from "./contract";
|
||||
|
||||
/**
|
||||
* Check if a mapping request has optional Salesforce account ID
|
||||
|
||||
@ -5,9 +5,9 @@
|
||||
* Validated types are derived from schemas (see schema.ts).
|
||||
*/
|
||||
|
||||
import type { SalesforceProductFieldMap } from "../catalog/contract.js";
|
||||
import type { SalesforceAccountFieldMap } from "../customer/index.js";
|
||||
import type { UserIdMapping } from "../mappings/contract.js";
|
||||
import type { SalesforceProductFieldMap } from "../catalog/contract";
|
||||
import type { SalesforceAccountFieldMap } from "../customer/index";
|
||||
import type { UserIdMapping } from "../mappings/contract";
|
||||
|
||||
// ============================================================================
|
||||
// Order Type Constants
|
||||
|
||||
@ -19,13 +19,13 @@ export {
|
||||
SIM_TYPE,
|
||||
ORDER_FULFILLMENT_ERROR_CODE,
|
||||
type OrderFulfillmentErrorCode,
|
||||
} from "./contract.js";
|
||||
} from "./contract";
|
||||
|
||||
// Schemas (includes derived types)
|
||||
export * from "./schema.js";
|
||||
export * from "./schema";
|
||||
|
||||
// Validation (extended business rules)
|
||||
export * from "./validation.js";
|
||||
export * from "./validation";
|
||||
|
||||
// Re-export types for convenience
|
||||
export type {
|
||||
@ -45,8 +45,8 @@ export type {
|
||||
} from './schema';
|
||||
|
||||
// Provider adapters
|
||||
export * as Providers from "./providers/index.js";
|
||||
export * as Providers from "./providers/index";
|
||||
|
||||
// Re-export provider types for convenience
|
||||
export * from "./providers/whmcs/raw.types.js";
|
||||
export * from "./providers/salesforce/raw.types.js";
|
||||
export * from "./providers/whmcs/raw.types";
|
||||
export * from "./providers/salesforce/raw.types";
|
||||
|
||||
@ -2,10 +2,10 @@
|
||||
* Orders Domain - Providers
|
||||
*/
|
||||
|
||||
import * as WhmcsMapper from "./whmcs/mapper.js";
|
||||
import * as WhmcsRaw from "./whmcs/raw.types.js";
|
||||
import * as SalesforceMapper from "./salesforce/mapper.js";
|
||||
import * as SalesforceRaw from "./salesforce/raw.types.js";
|
||||
import * as WhmcsMapper from "./whmcs/mapper";
|
||||
import * as WhmcsRaw from "./whmcs/raw.types";
|
||||
import * as SalesforceMapper from "./salesforce/mapper";
|
||||
import * as SalesforceRaw from "./salesforce/raw.types";
|
||||
|
||||
export const Whmcs = {
|
||||
...WhmcsMapper,
|
||||
@ -25,7 +25,7 @@ export {
|
||||
SalesforceMapper,
|
||||
SalesforceRaw,
|
||||
};
|
||||
export * from "./whmcs/mapper.js";
|
||||
export * from "./whmcs/raw.types.js";
|
||||
export * from "./salesforce/mapper.js";
|
||||
export * from "./salesforce/raw.types.js";
|
||||
export * from "./whmcs/mapper";
|
||||
export * from "./whmcs/raw.types";
|
||||
export * from "./salesforce/mapper";
|
||||
export * from "./salesforce/raw.types";
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
export * from "./raw.types.js";
|
||||
export * from "./mapper.js";
|
||||
export * from "./raw.types";
|
||||
export * from "./mapper";
|
||||
|
||||
@ -9,12 +9,12 @@ import type {
|
||||
OrderItemDetails,
|
||||
OrderItemSummary,
|
||||
OrderSummary,
|
||||
} from "../../contract.js";
|
||||
import { orderDetailsSchema, orderSummarySchema, orderItemDetailsSchema } from "../../schema.js";
|
||||
} from "../../contract";
|
||||
import { orderDetailsSchema, orderSummarySchema, orderItemDetailsSchema } from "../../schema";
|
||||
import type {
|
||||
SalesforceOrderItemRecord,
|
||||
SalesforceOrderRecord,
|
||||
} from "./raw.types.js";
|
||||
} from "./raw.types";
|
||||
|
||||
/**
|
||||
* Transform a Salesforce OrderItem record into domain details + summary.
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
export * from "./mapper.js";
|
||||
export * from "./raw.types.js";
|
||||
export * from "./mapper";
|
||||
export * from "./raw.types";
|
||||
|
||||
@ -4,12 +4,12 @@
|
||||
* Transforms normalized order data to WHMCS API format.
|
||||
*/
|
||||
|
||||
import type { OrderDetails, OrderItemDetails } from "../../contract.js";
|
||||
import type { OrderDetails, OrderItemDetails } from "../../contract";
|
||||
import {
|
||||
type WhmcsOrderItem,
|
||||
type WhmcsAddOrderParams,
|
||||
type WhmcsAddOrderPayload,
|
||||
} from "./raw.types.js";
|
||||
} from "./raw.types";
|
||||
|
||||
export interface OrderItemMappingResult {
|
||||
whmcsItems: WhmcsOrderItem[];
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
*/
|
||||
|
||||
import { z } from "zod";
|
||||
import { orderBusinessValidationSchema } from "./schema.js";
|
||||
import { orderBusinessValidationSchema } from "./schema";
|
||||
|
||||
// ============================================================================
|
||||
// SKU Business Rules Helpers
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@customer-portal/domain",
|
||||
"version": "1.0.0",
|
||||
"type": "module",
|
||||
"type": "commonjs",
|
||||
"description": "Unified domain layer with contracts, schemas, and provider mappers",
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
|
||||
@ -7,10 +7,10 @@
|
||||
*/
|
||||
|
||||
// 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)
|
||||
export * from "./schema.js";
|
||||
export * from "./schema";
|
||||
|
||||
// Re-export types for convenience
|
||||
export type {
|
||||
@ -20,10 +20,10 @@ export type {
|
||||
PaymentGatewayType,
|
||||
PaymentGateway,
|
||||
PaymentGatewayList,
|
||||
} from './schema.js';
|
||||
} from './schema';
|
||||
|
||||
// Provider adapters
|
||||
export * as Providers from "./providers/index.js";
|
||||
export * as Providers from "./providers/index";
|
||||
|
||||
// Re-export provider raw types (request and response)
|
||||
export type {
|
||||
@ -34,4 +34,4 @@ export type {
|
||||
WhmcsPaymentMethodListResponse,
|
||||
WhmcsPaymentGateway,
|
||||
WhmcsPaymentGatewayListResponse,
|
||||
} from "./providers/whmcs/raw.types.js";
|
||||
} from "./providers/whmcs/raw.types";
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
* Payments Domain - Providers
|
||||
*/
|
||||
|
||||
import * as WhmcsMapper from "./whmcs/mapper.js";
|
||||
import * as WhmcsRaw from "./whmcs/raw.types.js";
|
||||
import * as WhmcsMapper from "./whmcs/mapper";
|
||||
import * as WhmcsRaw from "./whmcs/raw.types";
|
||||
|
||||
export const Whmcs = {
|
||||
...WhmcsMapper,
|
||||
@ -12,5 +12,5 @@ export const Whmcs = {
|
||||
};
|
||||
|
||||
export { WhmcsMapper, WhmcsRaw };
|
||||
export * from "./whmcs/mapper.js";
|
||||
export * from "./whmcs/raw.types.js";
|
||||
export * from "./whmcs/mapper";
|
||||
export * from "./whmcs/raw.types";
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
export * from "./mapper.js";
|
||||
export * from "./raw.types.js";
|
||||
export * from "./mapper";
|
||||
export * from "./raw.types";
|
||||
|
||||
@ -2,14 +2,14 @@
|
||||
* WHMCS Payments Provider - Mapper
|
||||
*/
|
||||
|
||||
import type { PaymentMethod, PaymentGateway } from "../../contract.js";
|
||||
import { paymentMethodSchema, paymentGatewaySchema } from "../../schema.js";
|
||||
import type { PaymentMethod, PaymentGateway } from "../../contract";
|
||||
import { paymentMethodSchema, paymentGatewaySchema } from "../../schema";
|
||||
import {
|
||||
type WhmcsPaymentMethodRaw,
|
||||
type WhmcsPaymentGatewayRaw,
|
||||
whmcsPaymentMethodRawSchema,
|
||||
whmcsPaymentGatewayRawSchema,
|
||||
} from "./raw.types.js";
|
||||
} from "./raw.types";
|
||||
|
||||
const PAYMENT_TYPE_MAP: Record<string, PaymentMethod["type"]> = {
|
||||
creditcard: "CreditCard",
|
||||
|
||||
@ -7,13 +7,13 @@
|
||||
*/
|
||||
|
||||
// Constants
|
||||
export { SIM_STATUS, SIM_TYPE } from "./contract.js";
|
||||
export { SIM_STATUS, SIM_TYPE } from "./contract";
|
||||
|
||||
// Schemas (includes derived types)
|
||||
export * from "./schema.js";
|
||||
export * from "./schema";
|
||||
|
||||
// Validation functions
|
||||
export * from "./validation.js";
|
||||
export * from "./validation";
|
||||
|
||||
// Re-export types for convenience
|
||||
export type {
|
||||
@ -34,7 +34,7 @@ export type {
|
||||
SimOrderActivationRequest,
|
||||
SimOrderActivationMnp,
|
||||
SimOrderActivationAddons,
|
||||
} from './schema.js';
|
||||
} from './schema';
|
||||
|
||||
// Provider adapters
|
||||
export * as Providers from "./providers/index.js";
|
||||
export * as Providers from "./providers/index";
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import * as Mapper from "./mapper.js";
|
||||
import * as RawTypes from "./raw.types.js";
|
||||
import * as Requests from "./requests.js";
|
||||
import * as Utils from "./utils.js";
|
||||
import * as Mapper from "./mapper";
|
||||
import * as RawTypes from "./raw.types";
|
||||
import * as Requests from "./requests";
|
||||
import * as Utils from "./utils";
|
||||
|
||||
export const schemas = {
|
||||
accountDetails: Requests.freebitAccountDetailsRequestSchema,
|
||||
@ -51,10 +51,10 @@ export type EsimAddAccountResponse = ReturnType<typeof Mapper.transformFreebitEs
|
||||
export type EsimActivationResponse = ReturnType<typeof Mapper.transformFreebitEsimActivationResponse>;
|
||||
export type AuthResponse = ReturnType<typeof Mapper.transformFreebitAuthResponse>;
|
||||
|
||||
export * from "./mapper.js";
|
||||
export * from "./raw.types.js";
|
||||
export * from "./requests.js";
|
||||
export * from "./utils.js";
|
||||
export * from "./mapper";
|
||||
export * from "./raw.types";
|
||||
export * from "./requests";
|
||||
export * from "./utils";
|
||||
|
||||
export const Freebit = {
|
||||
...Mapper,
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
* Freebit SIM Provider - Mapper
|
||||
*/
|
||||
|
||||
import type { SimDetails, SimUsage, SimTopUpHistory, SimType, SimStatus } from "../../contract.js";
|
||||
import { simDetailsSchema, simUsageSchema, simTopUpHistorySchema } from "../../schema.js";
|
||||
import type { SimDetails, SimUsage, SimTopUpHistory, SimType, SimStatus } from "../../contract";
|
||||
import { simDetailsSchema, simUsageSchema, simTopUpHistorySchema } from "../../schema";
|
||||
import {
|
||||
type FreebitAccountDetailsRaw,
|
||||
type FreebitTrafficInfoRaw,
|
||||
@ -27,8 +27,8 @@ import {
|
||||
freebitCancelAccountRawSchema,
|
||||
freebitEsimReissueRawSchema,
|
||||
freebitEsimAddAccountRawSchema,
|
||||
} from "./raw.types.js";
|
||||
import { normalizeAccount } from "./utils.js";
|
||||
} from "./raw.types";
|
||||
import { normalizeAccount } from "./utils";
|
||||
|
||||
function asString(value: unknown): string {
|
||||
if (typeof value === "string") return value;
|
||||
|
||||
@ -2,9 +2,9 @@
|
||||
* SIM Domain - Providers
|
||||
*/
|
||||
|
||||
import { Freebit as FreebitAggregated } from "./freebit/index.js";
|
||||
import * as FreebitModule from "./freebit/index.js";
|
||||
import { Freebit as FreebitAggregated } from "./freebit/index";
|
||||
import * as FreebitModule from "./freebit/index";
|
||||
|
||||
export const Freebit = FreebitAggregated;
|
||||
export { FreebitModule };
|
||||
export * from "./freebit/index.js";
|
||||
export * from "./freebit/index";
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
* 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
|
||||
|
||||
@ -7,10 +7,10 @@
|
||||
*/
|
||||
|
||||
// Constants
|
||||
export { SUBSCRIPTION_STATUS, SUBSCRIPTION_CYCLE } from "./contract.js";
|
||||
export { SUBSCRIPTION_STATUS, SUBSCRIPTION_CYCLE } from "./contract";
|
||||
|
||||
// Schemas (includes derived types)
|
||||
export * from "./schema.js";
|
||||
export * from "./schema";
|
||||
|
||||
// Re-export types for convenience
|
||||
export type {
|
||||
@ -23,10 +23,10 @@ export type {
|
||||
SubscriptionStats,
|
||||
SimActionResponse,
|
||||
SimPlanChangeResult,
|
||||
} from './schema.js';
|
||||
} from './schema';
|
||||
|
||||
// Provider adapters
|
||||
export * as Providers from "./providers/index.js";
|
||||
export * as Providers from "./providers/index";
|
||||
|
||||
// Re-export provider raw types (request and response)
|
||||
export type {
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
* Subscriptions Domain - Providers
|
||||
*/
|
||||
|
||||
import * as WhmcsMapper from "./whmcs/mapper.js";
|
||||
import * as WhmcsRaw from "./whmcs/raw.types.js";
|
||||
import * as WhmcsMapper from "./whmcs/mapper";
|
||||
import * as WhmcsRaw from "./whmcs/raw.types";
|
||||
|
||||
export const Whmcs = {
|
||||
...WhmcsMapper,
|
||||
@ -12,5 +12,5 @@ export const Whmcs = {
|
||||
};
|
||||
|
||||
export { WhmcsMapper, WhmcsRaw };
|
||||
export * from "./whmcs/mapper.js";
|
||||
export * from "./whmcs/raw.types.js";
|
||||
export * from "./whmcs/mapper";
|
||||
export * from "./whmcs/raw.types";
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
export * from "./mapper.js";
|
||||
export * from "./raw.types.js";
|
||||
export * from "./mapper";
|
||||
export * from "./raw.types";
|
||||
|
||||
@ -4,13 +4,13 @@
|
||||
* Transforms raw WHMCS product/service data into normalized subscription types.
|
||||
*/
|
||||
|
||||
import type { Subscription, SubscriptionStatus, SubscriptionCycle } from "../../contract.js";
|
||||
import { subscriptionSchema } from "../../schema.js";
|
||||
import type { Subscription, SubscriptionStatus, SubscriptionCycle } from "../../contract";
|
||||
import { subscriptionSchema } from "../../schema";
|
||||
import {
|
||||
type WhmcsProductRaw,
|
||||
whmcsProductRawSchema,
|
||||
whmcsCustomFieldsContainerSchema,
|
||||
} from "./raw.types.js";
|
||||
} from "./raw.types";
|
||||
|
||||
export interface TransformSubscriptionOptions {
|
||||
defaultCurrencyCode?: string;
|
||||
|
||||
@ -4,8 +4,8 @@
|
||||
* Formatting utilities for currency, dates, phone numbers, etc.
|
||||
*/
|
||||
|
||||
export * from "./currency.js";
|
||||
export * from "./date.js";
|
||||
export * from "./phone.js";
|
||||
export * from "./text.js";
|
||||
export * from "./currency";
|
||||
export * from "./date";
|
||||
export * from "./phone";
|
||||
export * from "./text";
|
||||
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
* Utility functions and helpers used across all domain packages.
|
||||
*/
|
||||
|
||||
export * as Formatting from "./formatting/index.js";
|
||||
export * as Validation from "./validation/index.js";
|
||||
export * as Typing from "./typing/index.js";
|
||||
export * as Formatting from "./formatting/index";
|
||||
export * as Validation from "./validation/index";
|
||||
export * as Typing from "./typing/index";
|
||||
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
* TypeScript type utilities and runtime type checking.
|
||||
*/
|
||||
|
||||
export * from "./guards.js";
|
||||
export * from "./assertions.js";
|
||||
export * from "./helpers.js";
|
||||
export * from "./guards";
|
||||
export * from "./assertions";
|
||||
export * from "./helpers";
|
||||
|
||||
|
||||
@ -4,9 +4,9 @@
|
||||
* Validation utilities for common data types.
|
||||
*/
|
||||
|
||||
export * from "./email.js";
|
||||
export * from "./url.js";
|
||||
export * from "./string.js";
|
||||
export * from "./helpers.js";
|
||||
export * from "./email";
|
||||
export * from "./url";
|
||||
export * from "./string";
|
||||
export * from "./helpers";
|
||||
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2022",
|
||||
"module": "ESNext",
|
||||
"module": "commonjs",
|
||||
"lib": ["ES2022"],
|
||||
"declaration": true,
|
||||
"declarationMap": true,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user