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

@inkoxide/schema

v2.3.0

Published

TypeScript types and JSON Schema for Inkoxide documents (schema version 1).

Readme

@inkoxide/schema

TypeScript types and the JSON Schema for Inkoxide documents, schema version 1. The types are generated from document.v1.json by scripts/gen-schema-types.mjs; do not edit index.d.ts by hand.

npm install @inkoxide/schema

The package is an ES module and needs Node.js 22 or later. Its version is independent of the document schema version: @inkoxide/schema 2.x describes schema version 1.

Types

import type { Document, Node, TextRun } from '@inkoxide/schema';

const doc: Document = {
  version: 1,
  fonts: [{ id: 'Inter-Regular', family: 'Inter' }],
  pages: [{ size: { width: 595.28, height: 841.89 },
            children: [{ type: 'text', runs: [{ text: 'Hello', font: 'Inter-Regular', size: 24 }] }] }],
};

Every $defs entry of the schema is exported under its own name: Style, TableNode, Color, and so on. Node is a union of the node types, discriminated by type.

Two rules cannot be expressed in TypeScript:

  • A text run has exactly one of text or placeholder.
  • An image has exactly one of src or data.

Both are optional in the types. The engine and ajv report a document that breaks either rule.

Client-side validation (ajv)

import { Ajv2020 } from 'ajv/dist/2020.js';
import { schema, enginePath } from '@inkoxide/schema';

const validate = new Ajv2020({ discriminator: true, strict: false, validateFormats: false }).compile(schema);
if (!validate(doc)) {
  for (const e of validate.errors!) console.log(enginePath(e), e.message);
}

Pass discriminator: true. Without it, ajv reports an error for every node type that does not match, not only for the one the type field names. strict: false lets ajv accept the discriminator annotation alongside properties. validateFormats: false skips date-time; add ajv-formats if you want ajv to check it.

enginePath(error) turns an ajv error into the engine's path syntax, pages[0].children[3].style.width. Paths from ajv and from the engine (validate() / InkoxideError.path) then compare as follows:

| Problem | ajv keyword | Same path as the engine? | |---|---|---| | Unknown property | additionalProperties | yes (enginePath appends the property, as the engine does) | | Wrong type, bad enum value, bad pattern | type, enum, const, pattern, oneOf | yes | | Number out of range | minimum, maximum, exclusiveMinimum, … | yes | | Missing required field of an object (size.height) | required | yes | | Missing required field of a node (text without runs) | required | no: the engine reports the node's path, ajv the field's | | Unsupported version | const | yes (version) | | text and placeholder both set | not / oneOf on the run | no: the engine reports ….placeholder, ajv the run | | Unknown or unregistered font or image, duplicate id, unknown anchor, table structure | (none) | engine only: these need the registered fonts and images, or cross-references |

The schema checks shape only. Always handle errors from the engine as well: ajv lets you show problems early, but the engine has the final word.

Exports

  • SCHEMA_VERSION: 1.
  • schema: the JSON Schema object. It is also available as @inkoxide/schema/document.v1.json.
  • enginePath(error): see above.