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

@f3liz/mazemaze-generator

v0.11.0

Published

Generate a typed API client from an OpenAPI spec or a GraphQL schema as one Melange runtime with three natural surfaces — Melange, ReScript, and TypeScript (via JSDoc).

Readme

@f3liz/mazemaze-generator

An OCaml-native code generator that turns an OpenAPI spec into one Melange runtime with three natural surfaces — Melange, ReScript, and TypeScript. One set of [@@deriving json] decoders does the work; the three languages each get an idiomatic typed view onto it, sourced from a single IR so they cannot drift:

  • Melange — flat decoders + a Misskey convenience layer of labeled-optional wrappers (Misskey.Notes.create client ~text:"hi" ()).
  • ReScript — a nested .res binding layer (Notes.PostNotesTimeline.send) with optional record fields ({text: "hi"}).
  • TypeScript — the same JS, with JSDoc types in the file itself, so a consumer gets real types (Promise<Note[]>) by opening the .js — no sidecar .d.ts.

It replaces rescript-autogen-openapi's generated layers (no Sury, no drift) and supersedes the melange-autogen-spike (whose hand-written target shape is now generated).

Pipeline

OpenAPI(JSON)
  │  Openapi.lower        spec tree -> Ir.t
  │  Resolve.run          toposort + break cycles to opaque Json
  ▼
 Ir.t ──> Emit_melange    -> componentSchemas.ml + endpoints.ml  (types/accessors ; send wrappers)
      └─> Emit_jsdoc      -> {componentSchemas,endpoints}.jsdoc.json  (the metadata contract)
  │  dune + melange (es6)
  ▼
 componentSchemas.js   endpoints.js (imports ./componentSchemas.js)
  │  annotate.mjs (acorn) : synthesise @typedef + structurally join accessor/send @type (fail-loud)
  ▼
 componentSchemas.annotated.mjs   endpoints.annotated.mjs   <- ship these

Schemas and endpoints are split (B1): endpoints open ComponentSchemas on the OCaml side and re-imports each referenced typedef as @typedef {import('./componentSchemas.annotated.mjs').Note} Note on the JSDoc side, so a send's Promise<Note[]> resolves across the file boundary.

Repr is the single source of the mapping rules (ocaml_type / jsdoc_type / accessor name). Every emitter calls it, which is what keeps the Melange code, the JSDoc, and any future ReScript layer in agreement.

Run

dune build                 # gen -> melange -> annotate -> promote, one shot
./build.sh                 # dune build + the runtime shim so tests can RUN the output
npm test                   # the full regression harness (test/run.sh)
npx tsc -p tsconfig.json   # consumer.ts type-checks against the generated types

The spec is wired into ml/dune (specs/misskey.json); point it elsewhere by editing that rule.

Status

Works end-to-end on the real misskey spec.

Schemas (71): 62 records, 9 opaque fallbacks (allOf/oneOf), cross-type refs kept precise, property-level enums emitted as string-literal unions.

Endpoints (385): each inline-request operation becomes a <op>_send fetch req wrapper (encode request -> injected fetch -> decode response) plus a request typedef; a shared Fetch typedef types the injected fetch. tsc confirms request / Fetch / Promise<Response> all flow (responses resolve to the component typedefs); a send drives a stub fetch and decodes at runtime.

annotate.mjs reads real param names from the AST, so Melange mangling (fetch -> $$fetch, a JS global) is handled without guessing.

Stubbed / reserved seats:

  • Emit_rescript (types-only ReScript layer) — deferred by design.
  • GET / query-parameter operations (no JSON body) are skipped (54 of 439 ops).
  • inline nested objects, oneOf/anyOf/allOf -> opaque Melange_json.t (no aux hoisting / module rec yet, so cyclic refs degrade to unknown).
  • schemas + endpoints share one file to keep typedefs local; production would split files (and use import(...) JSDoc refs or a bundler).
  • the node_modules relink in build.sh is a skeleton hack; a published package would vendor the melange runtime with package.json.