
Security News
AGENTS.md Gains Traction as an Open Format for AI Coding Agents
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
lago-javascript-client
Advanced tools
This is a JavaScript wrapper for Lago API. Works in Cloudflare Workers, Deno, and Node.js. Generated from the Lago OpenAPI document.
Project | Release Badge |
---|---|
Lago | |
Lago JavaScript Client |
For npm users:
npm install lago-javascript-client
// npm
import { Client, getLagoError } from 'lago-javascript-client';
// Deno
import { Client, getLagoError } from 'https://deno.land/x/lago/mod.ts';
const lagoClient = Client('__YOUR_API_KEY__');
try {
const { data } = await lagoClient.billableMetrics.createBillableMetric(billableMetric);
} catch (error) {
const lagoError = await getLagoError<typeof lagoClient.billableMetrics.createBillableMetric>(error);
}
This SDK uses the Fetch API and natively supported Node.js version >= 18. For other Node versions:
Ideally, run Node with the --experimental-fetch
flag
Otherwise, polyfill the Fetch API by doing both:
Pass a Fetch instance to the Lago client
import { Client } from 'lago-javascript-client';
import fetch from 'node-fetch';
const lagoClient = Client("api_key", { customFetch: fetch });
Check the Lago API reference
Use the get getLagoError<>()
utility function to extract the error object and TypeScript type:
try {
const { data } = await lagoClient.billableMetrics.createBillableMetric(billableMetric);
} catch (error) {
const lagoError = await getLagoError<typeof lagoClient.billableMetrics.createBillableMetric>(error);
}
Uses dnt to build and test for Deno and Node.
Change the affected fields in scripts/build_npm.ts
and commit to GitHub. GitHub Actions will build and deploy to npm.
Requires Deno and Node.js >= 18
deno task generate:openapi
deno task test
deno task build
deno task build
cd npm
npm publish
The Lago documentation is available at doc.getlago.com.
The contribution documentation is available here
Lago JavaScript client is distributed under MIT license.
FAQs
Lago JavaScript API Client
The npm package lago-javascript-client receives a total of 6,798 weekly downloads. As such, lago-javascript-client popularity was classified as popular.
We found that lago-javascript-client demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.