Files
cfw-autumn/shared/utils/fullSubjectUtils/fullSubjectToFullCustomer.ts
2026-05-13 17:24:08 +08:00

18 lines
636 B
TypeScript

import type { FullCustomer, FullSubject } from "../../index.js";
/** Converts a FullSubject back to a FullCustomer for legacy helper compatibility. */
export const fullSubjectToFullCustomer = ({
fullSubject,
}: {
fullSubject: FullSubject;
}): FullCustomer => ({
...fullSubject.customer,
customer_products: fullSubject.customer_products,
entities: fullSubject.entity ? [fullSubject.entity] : [],
entity: fullSubject.entity,
extra_customer_entitlements: fullSubject.extra_customer_entitlements,
subscriptions: fullSubject.subscriptions,
invoices: fullSubject.invoices,
migration_item_runs: fullSubject.migration_item_runs,
});