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

gqlizer

v0.0.14

Published

The power of GQL in its simplest form

Downloads

81

Readme

The power of GQL in its simplest form

GQLizer allows you to use GraphQL anywhere for anything.

WARNING: This package is a work in progress and does not follow semantic versioning.

Usage

There's two ways to use GQLizer:

  1. You can use the resolver directly
import { gql, resolveQuery, ResolverFn } from "gqlizer";

const myAwesomeResolver: ResolverFn = (operations) => {
  // ...
};

const result = await resolveQuery({
  resolver: myAwesomeResolver,
  query: gql`
    {
      User(id: 1) {
        id
        firstName
        lastName
      }
    }
  `,
});

console.log(result);
  1. Or you can create a "client" that you can export and use in your application.
// resolveQuery.ts
import createQueryResolver, { ResolverFn } from "gqlizer";

const myAwesomeResolver: ResolverFn = (operations) => {
  // ...
};

export const resolveQuery = createQueryResolver(myAwesomeResolver);

// somewhere_else.ts
import { gql } from "gqlizer";
import { resolveQuery } from "./resolveQuery";

const result = await resolveQuery(gql`
  {
    User(id: 1) {
      id
      firstName
      lastName
    }
  }
`);

console.log(result);

Resolver

The resolver API was thought so it can be called as little as possible.

The resolver function has a single argument, an array of operations. This is because GQLizer calls the resolver once per depth level, and not for each field. This gives you the chance to make the resolver as fast as possible.

For example: if you are trying to use GQLizer for your own REST API, you could potentially implement an endpoint to resolve the whole array of operations in a single call.

The resolver has to return an array of DocumentLike objects.

type ResolverFn = (operations: Operation[]) => Promise<DocumentLike[]>;

type Operation = {
  handle: string; // The name of the field to resolve
  params?: QueryParams; //  Argument passed to the query of this field
  parent?: DocumentLike; // The result of the parent operation
};

type DocumentLike = Record<string, unknown>;

Notes

  1. This package re-exports gql and GqlDocumentNode from graphql-tag for convenience.

  2. We DO NOT validate the query. You should do that yourself.

  3. We export some utilities that we use under the hood, because why not?

    • assert: a simple assertion function
    • combineArrays: a function that merges two arrays
    • groupBy: a function that groups items by a key
    • isStringArray: a function that checks if an array is made of strings
    • parseGql: a function that transforms a query into a simpler object

Full Example using Star Wars API (SWAPI)

https://stackblitz.com/edit/gqlizer-example-swapi?file=index.ts