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

@draftmark-app/client

v0.1.1

Published

Isomorphic TypeScript client for the Draftmark API (shared by the dm CLI and the VS Code extension)

Readme

@draftmark-app/client

Isomorphic TypeScript client for the Draftmark v1 API. Zero runtime dependencies; runs anywhere fetch is available (Node 18+, VS Code extension host, browsers). Shared by the dm CLI and the Draftmark VS Code extension.

Install

npm install @draftmark-app/client

Usage

import { DraftmarkClient } from "@draftmark-app/client";

// An account API key (acct_...) covers the full owner lifecycle for docs it
// creates: create, update, delete, comment, resolve.
const dm = new DraftmarkClient({ apiKey: process.env.DM_API_KEY });

// Create (the doc is owned by the account behind the acct_ key)
const created = await dm.createDoc({
  content: "# Draft\n\nReview me.",
  visibility: "public",
});

// Read
const doc = await dm.getDoc(created.slug);
const markdown = await dm.getDocRaw(created.slug);

// Comments
const comments = await dm.listComments(created.slug, { status: "open" });
await dm.createComment(created.slug, {
  body: "Nit: tighten this line.",
  anchor_type: "line",
  anchor_ref: 3,
  anchor_text: "Review me.", // populate so the comment survives edits (re-anchoring)
});
await dm.setCommentStatus(created.slug, comments[0].id, "resolved");

// Update (new version) — no per-doc magic token needed for account-owned docs
await dm.updateDoc(created.slug, { content: "# Draft\n\nReviewed.", version_note: "addressed feedback" });

// Reviews & reactions (dedup identity is derived server-side)
await dm.createReview(created.slug, { reviewer_type: "agent" });
await dm.addReaction(created.slug, "thumbs_up");

Auth

Pass default auth to the constructor, or override per call:

const dm = new DraftmarkClient({ baseUrl: "https://draftmark.app/api/v1" });
await dm.getDoc("abc123", { apiKey: "key_..." });      // doc api_key
await dm.updateDoc("abc123", { title: "New" }, { magicToken: "..." }); // per-doc magic token
  • apiKeyAuthorization: Bearer (a doc api_key or an account acct_ key).
  • magicTokenX-Magic-Token (per-doc owner token; only needed for docs not owned by an account).

Errors

Typed methods throw DraftmarkApiError (.status, .code, .message, .details). For result-style handling, use the low-level raw() / request(), which return { ok, status, data }.

import { DraftmarkApiError } from "@draftmark-app/client";

try {
  await dm.createComment(slug, { body: "hi" });
} catch (e) {
  if (e instanceof DraftmarkApiError && e.status === 409) {
    // review closed / deadline passed
  }
}

Custom fetch

new DraftmarkClient({ fetch: myFetch }); // e.g. tests, or a runtime without global fetch

Build

npm install
npm run build   # tsc → dist/ (ESM + .d.ts)

License

MIT © Rumbo Labs