Public mirror for @nebutra/license from Nebutra/Nebutra-Sailor.
This repository is generated from the Nebutra Sailor monorepo. Package releases are cut from the monorepo and mirrored here for discovery, standalone cloning, and contribution intake.
- Canonical source:
packages/commerce/licenseinNebutra/Nebutra-Sailor - Package registry: npm and GitHub Packages
- Contributions: open issues or PRs here; maintainers port accepted changes back into the monorepo source package
License domain logic for issuance, validation, and lifecycle event handling.
# Internal monorepo dependency
pnpm add @nebutra/license@workspace:*import { issueLicense, validateLicense, generateSlug } from "@nebutra/license";
// Issue a new license
const license = await issueLicense({
userId: "user_123",
tier: "OPC",
displayName: "Jane Doe",
email: "jane@example.com",
githubHandle: "janedoe",
});
// → { id, licenseKey, tier, type, expiresAt }
// Validate an existing license
const result = await validateLicense("license-key-here");
// → { valid: true, tier: "OPC", type: "FREE" }
// Generate a human-readable slug
const slug = generateSlug();| Export | Description |
|---|---|
issueLicense(params) |
Issue a new license (idempotent per user+tier) |
validateLicense(key) |
Validate a license key and return its status |
generateSlug() |
Generate a human-readable license slug |
| Type | Description |
|---|---|
LicenseTier |
"INDIVIDUAL" / "OPC" / "STARTUP" / "ENTERPRISE" |
LicenseType |
"FREE" / "COMMERCIAL" |
IssueLicenseParams |
Input for issueLicense (userId, tier, displayName, email, etc.) |
IssueLicenseResult |
Output with id, licenseKey, tier, type, expiresAt |
ValidateLicenseResult |
Validation output with valid flag, tier, type, error |
LicenseIssuedEvent |
Queue event payload for downstream handlers |
| Schema | Description |
|---|---|
LicenseTierSchema |
Zod enum for license tier validation |
LicenseTypeSchema |
Zod enum for license type validation |
INDIVIDUALandOPCtiers resolve toFREEtype (perpetual)STARTUPandENTERPRISEtiers resolve toCOMMERCIALtype (1-year expiry)- Issuance is idempotent: re-issuing for the same user+tier returns the existing license
@nebutra/db-- Prisma database access@nebutra/queue-- Event publishing (license.issued)@nebutra/email-- License delivery emails