UNPKG

lago-javascript-client

Version:
25 lines (24 loc) 1.34 kB
"use strict"; // User-facing TypeScript types for Lago webhook payloads. // // Backed by ./openapi/webhooks.ts, which is auto-generated from the Lago // OpenAPI 3.1 spec (`webhooks:` key) via `deno task generate:webhooks`. // This file is hand-written and is safe across regenerations. // // The generator output keys events by their snake_case operationId // (e.g. `alert_triggered`). We re-key here by the dotted `webhook_type` // literal (e.g. `alert.triggered`) so that the public API matches the // string customers actually see on the wire. // // Note on nested types: the payload types here are produced by // `openapi-typescript`, while the SDK's component exports (e.g. // `CustomerObject`, `InvoiceObjectExtended`) are produced by // `swagger-typescript-api`. The two generators interpret the same schema // slightly differently for nullable fields, so a value typed as // `LagoWebhookPayloads['customer.created']['customer']` is not always // structurally equal to `CustomerObject` from the main SDK exports. Both // are valid views of the same wire shape; the openapi-typescript view is // the more accurate one for what actually arrives over the network. If // you pass webhook objects into helpers typed with SDK components, a // narrowing cast may be required. Object.defineProperty(exports, "__esModule", { value: true });