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

@skaile/forge-editor-directus

v0.1.1

Published

Directus storage for @skaile/forge-editor: documents, collaboration state and per-user settings over the Directus REST items API (fetch only, no Directus SDK).

Readme

@skaile/forge-editor-directus

The storage of @skaile/forge-editor in a Directus instance: documents (TipTap JSON with a content version), the collaboration server's Yjs state and per-user editor settings, over the Directus REST items API. The transport is fetch; there is no dependency on @directus/sdk.

import { createDirectusAdapter } from '@skaile/forge-editor-directus'

const ports = createDirectusAdapter({
  url: 'http://localhost:8055',
  token: process.env.DIRECTUS_TOKEN!,
  authenticate: async ({ headers }) => userOfSession(headers), // null = not signed in
})
// provideEditorServer({ ports: { ...ports, models, index, ... }, blockTypes })

createDirectusAdapter returns Omit<StoredPorts, 'assets'> (see @skaile/forge-editor/adapters): identity, directory, documents, collabState, settings. The identity hooks (authenticate, authorize, users) behave as in createJsonAdapter: without authenticate there is a development user outside NODE_ENV=production and nobody in production.

  • documents: storeContent only updates (create with putDocument, a missing document is not an error); every write sets a new random version and updated_at, contentVersion returns it. deleteDocument removes content and collaboration state. There is no listTree / createDocument / moveDocument, so the document-tree routes answer 501.
  • assets: none, the image routes answer 501.
  • JSON is written as text and read both ways, so it works whether the collection's json fields are registered in Directus or not.

Collections

Three collections with these columns (SQLite, in the style of Directus' own JSON columns); the adapter does not create them:

CREATE TABLE editor_documents (id TEXT PRIMARY KEY NOT NULL, content JSON NOT NULL, version TEXT NOT NULL, updated_at TEXT NOT NULL);
CREATE TABLE editor_states    (id TEXT PRIMARY KEY NOT NULL, state TEXT NOT NULL);  -- the state bytes as base64
CREATE TABLE editor_settings  (user_id TEXT PRIMARY KEY NOT NULL, json JSON NOT NULL);

Other names: collections: { documents, states, settings }. The token needs full access to the three collections; an admin token works, and the tables need no registration in Directus (untracked tables are reachable through /items for admins). Directus 11 answers GET /items/<c>/<id> for a missing item with 403, not 404, and PATCH of a missing item with 204 and no body, so the adapter never relies on a status to detect a missing item: it reads through GET /items/<c>?filter[<key>][_eq]=<id>&limit=1 (empty list = missing) and reads a PATCH answer without data as "not updated" before it creates the row. A 403 on a list read stays an error (token without access).

Payload limit

Directus caps request bodies at 1 MB by default (MAX_PAYLOAD_SIZE). The adapter writes a document's content and a collaboration state in one request each, so a host with large documents must raise the limit, e.g. MAX_PAYLOAD_SIZE=50mb. Otherwise Directus answers 413 and the write (storeContent, putDocument, storeState) throws.

Transport

restItemsClient({ url, token, fetch? }) implements DirectusItemsClient (readOne is a filtered list query, empty → null; readMany with limit=-1; updateOne PATCH with fields=<key>, 204/404/no data → false; createOne; deleteOne 204/404 is fine; any other non-2xx throws). Ids are URL-encoded (gutachten:<uuid>). Pass client instead to use your own transport.