TypeScript
Type-level conventions and exported types in @easylabs/node.
@easylabs/node is written in strict TypeScript and ships .d.ts (ESM) and .d.cts (CJS) declaration files. The types from @easylabs/common are re-exported from the entry point — you never need to add the common package to your dependencies directly.
Public types
Every method on the client is fully typed; the most-reached-for shapes are listed here so you know what to import.
Client + envelope
import type {
ClientOptions, // argument to createClient
ApiResponse, // every method returns ApiResponse<T>
Paginated, // { data, total, limit, offset } envelope
PaginationParams, // { limit?, offset?, ids? }
EasyApiError, // thrown on non-2xx
} from "@easylabs/node";Resource request types
import type {
CreateCustomer,
UpdatePaymentInstrument,
CreatePaymentInstrument,
CreateTransfer,
CreatePaymentLinkPayload,
UpdatePaymentLinkPayload,
CreateCheckoutSession,
CreateProduct,
CreatePrice,
CreateSubscription,
UpdateSubscription,
ApplySubscriptionDiscount,
CreateOneTimeCharge,
ProrationPreviewParams,
ReportSubscriptionUsage,
CreateInvoice,
UpdateInvoice,
ListInvoicesQuery,
PayInvoice,
SendInvoice,
CreateCoupon,
UpdateCoupon,
CreatePromotionCode,
UpdatePromotionCode,
ValidatePromotionCode,
CreateEmbeddedCheckoutSession,
UpdateEmbeddedCheckoutConfig,
CreateWebhookEndpoint,
UpdateWebhookEndpoint,
AnalyticsQuery,
DunningConfig,
SignComplianceForm,
} from "@easylabs/node";Resource response types
import type {
CustomerData,
PaymentInstrumentData,
TransferData,
OrderData,
SubscriptionData,
SubscriptionItem,
SubscriptionDiscount,
ProductData,
PriceData,
PaymentLinkData,
InvoiceData,
CouponData,
PromotionCodeData,
AuthorizationData,
DisputeData,
SettlementData,
ComplianceFormData,
WebhookEndpoint,
RegisteredWebhookEndpoint,
WebhookEvent,
WebhookDelivery,
EmbeddedCheckoutSessionData,
EmbeddedCheckoutSessionStatus,
EmbeddedCheckoutConfig,
} from "@easylabs/node";Webhooks
WebhookEvent<T> is parameterized by the data payload of the event, so you can narrow with a type guard or a discriminated handler:
import type { WebhookEvent, SubscriptionData, OrderData } from "@easylabs/node";
function handle(event: WebhookEvent) {
switch (event.type) {
case "subscription.updated": {
const e = event as WebhookEvent<SubscriptionData>;
// e.data.status, e.data.items, ...
break;
}
case "checkout.session.completed": {
const e = event as WebhookEvent<OrderData>;
// e.data.order_number, e.data.identity, ...
break;
}
}
}The full set of event names is exported as EASY_EVENT_TYPES (a readonly tuple) and the union is EasyEventType.
Module augmentation
The SDK does not currently expose declaration-merging hooks. If you need to attach app-level metadata, use the tags / metadata fields that most resources carry — both are typed as Record<string, unknown>, so you can introduce a stricter interface in your own code and cast at the boundary:
interface OrderTags {
internal_order_id: string;
fulfillment_state: "pending" | "shipped" | "delivered";
}
await easy.updateOrderTags(orderId, {
internal_order_id: "ord_42",
fulfillment_state: "shipped",
} satisfies OrderTags);