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

certrev-api-contract

v2.8.7

Published

API contract types and schemas for CertRev verification engines. MVP is the source of truth.

Readme

@certrev/api-contract

API contract types and Zod schemas for CertRev verification engines.

The certrev-mvp repository is the SOURCE OF TRUTH for this contract.

Installation

# For MVP (workspace dependency)
pnpm add @certrev/api-contract

# For external engines (when published to npm)
npm install @certrev/api-contract

Usage

Types (Compile-time)

import type {
  VerificationJob,
  TipTapDocument,
  ClaimResult,
  APAReference,
} from '@certrev/api-contract'

const job: VerificationJob = { ... }

Schemas (Runtime Validation)

import {
  VerificationJobSchema,
  TipTapDocumentSchema,
  CreateJobInputSchema,
} from '@certrev/api-contract'

// Validate incoming data
const result = VerificationJobSchema.safeParse(data)
if (!result.success) {
  console.error('Invalid job:', result.error)
}

Constants

import {
  STAGE_LABELS,
  ERROR_MESSAGES,
  CONTRACT_VERSION,
} from '@certrev/api-contract'

// Show progress to users
const label = STAGE_LABELS[job.stage_name] // "Verifying critical claims"

// Show errors to users
const message = ERROR_MESSAGES[error.code] // "Rate limit exceeded..."

Contract Version

Current version: 2.1.0

Check CONTRACT_VERSION constant for programmatic access.

For Engine Developers

Engines MUST:

  1. Poll verification_jobs table for jobs with status = 'pending' AND matching engine
  2. Update jobs with progress using JobProgressUpdate schema
  3. Complete jobs with JobCompletion schema
  4. Fail jobs with JobFailure schema

See schemas.ts for exact shapes.

Engine Routing

Jobs are assigned to specific engines via the options.engine field. Each engine should poll only for jobs assigned to it:

-- cr-engine-v2 polls:
SELECT * FROM verification_jobs
WHERE status = 'pending'
AND options->>'engine' = 'cr-engine-v2'
ORDER BY created_at ASC
LIMIT 1

-- cr-engine-v3 polls:
SELECT * FROM verification_jobs
WHERE status = 'pending'
AND options->>'engine' = 'cr-engine-v3'
ORDER BY created_at ASC
LIMIT 1

Available engines:

| Engine ID | Name | Description | |-----------|------|-------------| | cr-engine-v2 | CR Engine V2 | Stable version | | cr-engine-v3 | CR Engine V3 (BMAD) | Latest with BMAD improvements |

Handling legacy jobs: Jobs created before engine routing (without options.engine) can be handled by any engine or ignored based on your deployment needs.

Footnote Mark Format

The MVP frontend TipTap editor expects footnotes as marks with this exact structure:

// In output_document nodes, add this mark to cited text:
{
  type: 'footnote',
  attrs: {
    footnoteNumbers: [1, 2],  // References supporting this claim
    claimId: 'uuid'           // Links to ClaimResult.id
  }
}

Example: A paragraph with a footnoted claim:

{
  "type": "paragraph",
  "content": [
    { "type": "text", "text": "Studies show this treatment is effective" },
    {
      "type": "text",
      "text": " for patients",
      "marks": [{
        "type": "footnote",
        "attrs": {
          "footnoteNumbers": [1, 3],
          "claimId": "claim-123"
        }
      }]
    },
    { "type": "text", "text": "." }
  ]
}

The frontend renders this as: "...effective for patients[1,3]."

Frontend support:

  • TipTap Footnote extension in src/lib/editor/tiptap-config.ts
  • Renders as <sup data-footnote="true" class="footnote-marker">[1,3]</sup>
  • DOMPurify whitelist includes sup tag and data-footnote attribute

Breaking Changes

See CHANGELOG.md for version history.

What's breaking:

  • Removing a field from output
  • Changing a field's type
  • Renaming a required field
  • Adding a required input field

What's NOT breaking:

  • Adding optional fields
  • Adding new error codes
  • Adding new claim types