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

@lankajs/plugin-graphql

v5.0.0

Published

plugin: A request kind that reads the errors array, a gateway that writes query and mutate, and graphql-ws as a stream.

Readme

@lankajs/plugin-graphql

⬡ plugin · GraphQL: operations, and subscriptions

A request kind that reads the errors array, a gateway that writes query and mutate, and graphql-ws as a stream.

A core capability core does not implement itself. Registered with use(), then called by core. peerDependencies: lanka is mandatory.

Runs in: the browser, node and React Native — everywhere.

How to use it: GUIDE.md — the user guide, with examples. How to change it: SKILL.md.

Extension point

Plugs into:

use(plugin) · host.apiBaseUrl

Contents

  • LankaGraphqlRequest — a request kind: one POST, and errors read as a tagged failure
  • ALankaGraphqlGateway / createLankaGraphqlGatewayquery and mutate, both styles
  • LankaGraphqlSubscriptionTransport — the graphql-ws protocol as a stream transport
  • lankaGraphql — the plugin, for subscriptions only

The one thing this package is really for

GraphQL answers 200 OK with an errors array. Through an ordinary JSON request that is a success carrying a body the screen then has to inspect — so every application grows the same helper, and the ones that forget show a spinner over a failed mutation. LankaGraphqlRequest turns it into LankaError with kind: "domain", which is the kind the framework already has for a server refusing deliberately and naming the reason.

An errors array beside non-null data is a PARTIAL result and is not a failure: the data is returned and the errors are handed to onPartialErrors. Refusing it would throw away a page that rendered because one nullable field did not.

Two halves, used apart

Operations need no plugin: build a gateway on ALankaGraphqlGateway, or hand createLankaGraphqlRequest() to any gateway you already have. lanka.use(...) is for SUBSCRIPTIONS, because a subscription is a connection and a connection needs a lifetime to belong to.

No document parsing, ever

A document is a string, and TypedDocumentNode from a code generator is accepted by reading its loc.source.body. The package never parses GraphQL: doing so would mean shipping a parser, and a build-time code generator already knows more about the schema than a runtime parser can.

Subscriptions are one operation per event type

graphql-ws multiplexes by an id per subscription; this maps each to a named event a bridge already understands, so a subscription and a server-sent event reach a scenario through exactly the same code. The socket is opened once and subscribe is sent per type — including again after a reconnect, which the far end has forgotten about.


Repository map: ../../README.md