npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@voyantjs/legal

v0.92.0

Published

Legal module for Voyant. Contracts and policies in a single package — templates with variable substitution, versioning, number series, signing workflow, structured cancellation/payment/T&C policies with rule evaluation, assignments, and acceptance trackin

Downloads

59,932

Readme

@voyantjs/legal

Legal module for Voyant. Contracts and policies in a single package — templates with variable substitution, versioning, number series, signing workflow, structured cancellation/payment/T&C policies with rule evaluation, assignments, and acceptance tracking.

Install

pnpm add @voyantjs/legal

Usage

import { legalHonoModule } from "@voyantjs/legal"
import { createApp } from "@voyantjs/hono"

const app = createApp({
  modules: [legalHonoModule],
  // ...
})

Entities

Contracts

  • Contracts (cont) — legal document instances with status lifecycle
  • Contract templates (ctpl) — reusable templates with variable schemas, optional channel scope, and explicit storefront defaults
  • Contract template versions (ctpv) — immutable version snapshots
  • Contract signatures (ctsi) — signing records (who/when/method/ip)
  • Contract number series (ctns) — series definitions with auto-increment
  • Contract attachments (ctat) — rendered PDFs and appendices

Default Storefront Contract Templates

Contract templates can be marked with isDefault: true. At most one default template can exist for a given (scope, channelId, language) selector. A default with channelId: null is the global fallback for that scope/language; a channel-specific default wins when callers pass channelId.

Storefronts can resolve the active customer-safe template through:

  • GET /v1/public/legal/contracts/templates/default
  • GET /v1/admin/legal/contracts/templates/default

Supported query parameters are scope (defaults to customer), channelId, language, and comma-separated fallbackLanguages. Selection checks requested and fallback languages in order, prefers channel-specific defaults over global defaults, ignores inactive templates, and falls back to the newest active matching template only when no explicit default exists for that selector.

Contract Document Operations

The contracts route surface exposes stable operations for storefront previews and stored document handling:

  • POST /v1/public/legal/contracts/templates/:id/render-preview
  • POST /v1/public/legal/contracts/templates/by-slug/:slug/render-preview
  • POST /v1/admin/legal/contracts/templates/:id/render-preview
  • POST /v1/admin/legal/contracts/:id/attach-document
  • POST /v1/admin/legal/contracts/:id/regenerate-pdf

Preview routes accept { variables } and return only the rendered text. Public preview routes require the template to be active. attach-document expects a multipart file field plus optional name and kind, uploads through the configured documentStorage, and persists a contract attachment. regenerate-pdf uses the configured contract document generator and replaces the canonical generated document artifact.

Contract Lifecycle

Contract lifecycle transitions are enforced by the contract service:

draft -> issued -> sent -> signed -> executed

Contracts may be voided from any non-void stage. Each service transition appends to stageHistory and emits a domain event when an event bus is configured: contract.issued, contract.sent, contract.signed, contract.executed, or contract.voided. Event payloads are intentionally minimal: contract IDs, relationship IDs, stage names, and timestamps only; rendered bodies, variables, metadata, and signature details stay out of the event payload.

Policies

  • Policies (pol) — policy definitions by kind (cancellation, payment, T&C, etc.)
  • Policy versions (plvr) — immutable version snapshots with publish/retire lifecycle
  • Policy rules (plrl) — structured rules per version (cancellation windows, percentages)
  • Policy assignments (plas) — scope-based assignment to products, channels, markets
  • Policy acceptances (plac) — acceptance records per booking/order/person

Exports

| Entry | Description | | --- | --- | | . | Combined module export + all linkable definitions | | ./contracts | Contract barrel (types, tables, service, validation) | | ./contracts/schema | Drizzle tables for contracts | | ./contracts/validation | Zod schemas for contracts | | ./contracts/routes | Hono routes for contracts (admin + public) | | ./contracts/service | Contract service functions | | ./policies | Policy barrel (types, tables, service, validation) | | ./policies/schema | Drizzle tables for policies | | ./policies/validation | Zod schemas for policies | | ./policies/routes | Hono routes for policies (admin + public) | | ./policies/service | Policy service functions |

License

Apache-2.0