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

@graphql-workbench/graphql-workbench-store

v0.1.0

Published

Signal-backed coordinator for GraphQL schema and execution components

Readme

@graphql-workbench/graphql-workbench-store

An optional, DOM-free coordinator for @graphql-workbench/schema-explorer and @graphql-workbench/execute-query. It shares a theme signal, forwards slice events, and saves/restores both stores together. It does not create a query editor, run GraphQL requests, or rewrite query text when a schema selection changes.

Install it with its two peer runtimes:

npm install @graphql-workbench/graphql-workbench-store @preact/signals-core graphql

The package owns its dependencies on @graphql-workbench/schema-explorer, @graphql-workbench/execute-query, and @graphql-workbench/graphql-store-core. Each component remains independently consumable.

Composed browser usage

<textarea id="query">query Demo { hello }</textarea>
<gwb-schema-explorer></gwb-schema-explorer>
<gwb-execute-query></gwb-execute-query>
import { createGraphQLWorkbenchStore } from '@graphql-workbench/graphql-workbench-store';
import '@graphql-workbench/schema-explorer';
import '@graphql-workbench/execute-query';

const workbench = createGraphQLWorkbenchStore();
const explorer = document.querySelector('gwb-schema-explorer');
const executor = document.querySelector('gwb-execute-query');
if (explorer) explorer.store = workbench.schema;
if (executor) executor.store = workbench.execution;
workbench.schema.schema.value = 'type Query { hello: String }';

const queryEditor = document.querySelector<HTMLTextAreaElement>('#query');
if (queryEditor) {
  workbench.execution.query.value = queryEditor.value;
  queryEditor.addEventListener('input', () => {
    workbench.execution.query.value = queryEditor.value;
  });
}

workbench.events.subscribe('execution:execute-requested', ({ query, variables, sink }) => {
  // Use one transport channel: this store event OR the component DOM event.
  sink.next({ data: { hello: `${query} with ${JSON.stringify(variables)}` } });
  sink.complete();
});

const saved = JSON.stringify(workbench.snapshot());
workbench.restore(JSON.parse(saved));
window.addEventListener('pagehide', () => workbench.dispose(), { once: true });

The browser-facing component imports above need a DOM. The coordinator module itself can be imported in Node. The schema and execution properties are the same stores accepted by their components. theme is one writable Preact signal shared by both. Events are synchronously forwarded under schema: and execution: names without inventing additional events. Snapshot restoration validates both slices before either is changed and requires their themes to agree.

The coordinator forwards schema:selection-change, schema:selection-path-error, schema:include-deprecated-change, execution:variables-change, execution:execute-requested, and execution:execution-cancelled. Component-originated actions still emit their compatibility DOM events exactly once. Connect a transport to the typed event or the DOM event, never both. Direct store actions do not synthesize DOM events, and schema selection never edits workbench.execution.query.

The two slices are owned by the coordinator. It disposes both; component views only borrow them. A disconnected view leaves an active shared request running. snapshot() contains durable versioned inputs and preferences, not response streams or request handles. restore() validates both slices before mutation and aborts an active request while returning execution to idle.

Standalone component usage

Neither component requires the coordinator. Import @graphql-workbench/schema-explorer and @graphql-workbench/execute-query separately, assign their documented public properties, and listen to their existing DOM events. Each component creates and disposes a private store when no store is injected. For direct variables/response pane composition, see the @graphql-workbench/execute-query README.

The demo uses both components with one workbench store, a consumer-owned query editor, and a selectable simulated response mode.