feat(10-01): add PAX8 typed entity barrel

- Pax8PageEnvelope<T> generic pagination envelope
- Pax8Company, Pax8Subscription, Pax8Product entity interfaces
- Pax8Order/Pax8OrderItem modeled on PAX8 Invoice/InvoiceItem fields
  (not bare Order/LineItem, which lack pricing) per 10-RESEARCH.md Pitfall 1
- escape-hatch [key: string]: unknown on each entity, matching appgate.ts convention
This commit is contained in:
lorentz 2026-07-10 17:31:38 -04:00
parent 8b975be700
commit 5c9cee02af

80
lib/types/pax8.ts Normal file
View file

@ -0,0 +1,80 @@
/**
* Type definitions for the PAX8 REST API (v1) and the shapes Pulse persists.
* Source spec lives at `https://devx.pax8.com`.
*
* Only the slices Pulse consumes are typed PAX8 exposes a much larger
* surface (marketplace/provisioning endpoints Pulse never calls as a
* partner/reseller). Long-tail fields fall back to the `[key: string]:
* unknown` escape hatch on each interface, matching lib/types/appgate.ts.
*/
// ─── API response shapes ──────────────────────────────────────────────────
export interface Pax8PageEnvelope<T> {
content: T[];
page: {
size: number;
totalElements: number;
totalPages: number;
number: number;
};
}
export interface Pax8Company {
id: string;
name: string;
externalId: string | null;
website: string | null;
status: string | null;
city: string | null;
stateOrProvince: string | null;
postalCode: string | null;
country: string | null;
[key: string]: unknown; // escape hatch for fields not yet modeled
}
export interface Pax8Subscription {
id: string;
companyId: string;
productId: string;
quantity: number;
billingTerm: string | null;
status: string | null;
startDate: string | null;
[key: string]: unknown; // escape hatch for fields not yet modeled
}
export interface Pax8Product {
id: string;
sku: string;
vendorSku: string | null;
name: string;
category: string | null;
[key: string]: unknown; // escape hatch for fields not yet modeled
// NOTE: the deprecated alternate-vendor-SKU field per PAX8's own schema is intentionally omitted.
}
// Modeled on PAX8's Invoice object (not the bare Order object, which lacks
// pricing/status) — see 10-RESEARCH.md Pitfall 1.
export interface Pax8Order {
id: string;
companyId: string;
orderDate: string | null;
total: number | null;
status: string | null;
currencyCode: string | null;
[key: string]: unknown; // escape hatch for fields not yet modeled
}
// Modeled on PAX8's Invoice Item object (not the bare LineItem object,
// which lacks pricing) — see 10-RESEARCH.md Pitfall 1.
export interface Pax8OrderItem {
id: string;
orderId: string;
productId: string;
quantity: number;
price: number | null;
subTotal: number | null;
currencyCode: string | null;
[key: string]: unknown; // escape hatch for fields not yet modeled
}