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

@panproto/core

v0.7.0

Published

TypeScript SDK for panproto — protocol-aware schema migration via generalized algebraic theories

Readme

@panproto/core

npm MIT

TypeScript SDK for panproto. Protocol-aware schema migration via generalized algebraic theories, with automatic lens generation via protolenses.

This package wraps the panproto WASM module, providing a typed, ergonomic API for defining protocols, building schemas, computing migrations, and applying protolens-based transformations from JavaScript and TypeScript.

Requires Node.js >= 20.

Installation

npm install @panproto/core

Usage

import { Panproto } from '@panproto/core';

const panproto = await Panproto.init();
const atproto = panproto.protocol('atproto');

// Build schemas
const oldSchema = atproto.schema()
  .vertex('post', 'record', { nsid: 'app.bsky.feed.post' })
  .vertex('post:body', 'object')
  .edge('post', 'post:body', 'record-schema')
  .build();

const newSchema = atproto.schema()
  .vertex('post', 'record', { nsid: 'app.bsky.feed.post' })
  .vertex('post:body', 'object')
  .vertex('post:body.title', 'string')
  .edge('post', 'post:body', 'record-schema')
  .edge('post:body', 'post:body.title', 'prop', { name: 'title' })
  .build();

// One-liner data conversion between schema versions
const converted = panproto.convert(record, oldSchema, newSchema);

// Auto-generate a lens with full control
const lens = panproto.lens(oldSchema, newSchema);
const { view, complement } = lens.get(record);
const restored = lens.put(modifiedView, complement);

// Build a reusable protolens chain (schema-independent)
const chain = panproto.protolensChain(oldSchema, newSchema);
const result = chain.apply(record);

// Factorize a theory morphism into elementary steps
const factors = panproto.factorizeMorphism(morphism);

API

Core

| Export | Description | |--------|-------------| | Panproto | Main entry point; call Panproto.init() to load the WASM module | | Panproto.convert() | One-liner data conversion between two schemas via auto-generated protolens | | Panproto.lens() | Auto-generate a lens between two schemas | | Panproto.protolensChain() | Build a reusable, schema-independent protolens chain | | Panproto.factorizeMorphism() | Decompose a theory morphism into elementary endofunctors | | Protocol | Protocol handle with schema builder factory | | SchemaBuilder / BuiltSchema | Fluent schema construction | | MigrationBuilder / CompiledMigration | Migration construction, compilation, and application | | Instance | Instance wrapper with JSON conversion and validation | | IoRegistry | Protocol-aware parse/emit for all 76 formats | | Repository | Schematic version control (init, commit, branch, merge) |

Protolenses

| Export | Description | |--------|-------------| | LensHandle | Lens with get, put, and autoGenerate() for automatic lens derivation | | LensHandle.autoGenerate() | Auto-generate a lens between two schemas | | ProtolensChainHandle | Reusable, schema-independent protolens chain with apply and instantiate | | ProtolensChainHandle.fuse() | Fuse chain into single step | | ProtolensChainHandle.checkApplicability() | Check applicability with reasons | | ProtolensChainHandle.applyToFleet() | Apply to multiple schemas | | ProtolensChainHandle.lift() | Lift along theory morphism | | ProtolensChainHandle.fromJson() | Deserialize from JSON | | SymmetricLensHandle | Symmetric (bidirectional) lens for two-way synchronization | | DataSetHandle | Handle to versioned data set with migrate/staleness methods | | Panproto.dataSet() | Store and track a data set | | Panproto.migrateData() | Migrate data between schemas |

Breaking change analysis

| Export | Description | |--------|-------------| | FullDiffReport | Comprehensive structural diff between two schemas | | CompatReport | Protocol-aware classification into breaking/non-breaking | | ValidationResult | Schema validation against protocol rules |

GAT engine

| Export | Description | |--------|-------------| | TheoryHandle / TheoryBuilder | Theory construction | | createTheory / colimit | Build and compose theories | | checkMorphism / migrateModel | Morphism validation and model transport |

Built-in protocol specs

ATPROTO_SPEC, SQL_SPEC, PROTOBUF_SPEC, GRAPHQL_SPEC, JSON_SCHEMA_SPEC, BUILTIN_PROTOCOLS

Error classes

PanprotoError, WasmError, SchemaValidationError, MigrationError, ExistenceCheckError

Documentation

panproto.dev

License

MIT