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

@digital-retex/flos-pim-graphql-client

v1.0.1

Published

TypeScript client generated from local GraphQL schema files

Readme

Product GraphQL TypeScript Client

TypeScript library generated from the GraphQL schemas in this repository, designed to execute type-safe calls against a GraphQL endpoint.

Main features

  • Automatic TypeScript type generation from GraphQL schema (graphql-codegen).
  • Typed GraphQL documents (TypedDocumentNode) for compile-time safety.
  • Ready-to-use client built on graphql-request (ProductGraphqlClient).
  • Dedicated methods for core queries:
    • getProduct(code)
    • searchProducts(filter)
  • Generic request(options) method for custom queries.
  • Included Postman collection for manual testing: product-graphql.postman_collection.json.

Requirements

  • Bun 1.1+

Installation

bun install

Available scripts

  • bun run generate: generates types from schema + GraphQL operations.
  • bun run build: regenerates types and builds outputs in dist/ (CJS + ESM + d.ts).
  • bun run check: runs project type-check.
  • bun run release:patch: bumps patch version, publishes to npm, pushes commit and tags.
  • bun run release:minor: bumps minor version, publishes to npm, pushes commit and tags.
  • bun run release:major: bumps major version, publishes to npm, pushes commit and tags.
  • bun run release:beta: bumps beta prerelease version, publishes with beta tag, pushes commit and tags.
  • bun run publish:public: publishes to npmjs as public package.

Project structure

  • schemas.graphqls + types/**/*.graphqls: source GraphQL schema.
  • src/operations/*.graphql: library GraphQL operations.
  • src/generated/graphql.ts: generated types and documents (auto-generated).
  • src/client.ts: client implementation.
  • src/index.ts: public exports.

Usage in your application

import { ProductGraphqlClient } from "@digital-retex/flos-pim-graphql-client";

const client = new ProductGraphqlClient(
  "https://your-api.example.com/graphql",
  {
    headers: {
      Authorization: `Bearer ${process.env.API_TOKEN}`,
    },
  },
);

const product = await client.getProduct("ABC123");

const page = await client.searchProducts({
  page: 0,
  size: 20,
  onlyWeb: true,
});

Typed custom requests

You can also use the request(options) method with a generated document:

import {
  ProductGraphqlClient,
  SearchProductsDocument,
  type SearchProductsQuery,
  type SearchProductsQueryVariables,
} from "@digital-retex/flos-pim-graphql-client";

const client = new ProductGraphqlClient("https://your-api.example.com/graphql");

const data = await client.request<
  SearchProductsQuery,
  SearchProductsQueryVariables
>({
  document: SearchProductsDocument,
  variables: {
    filter: {
      page: 0,
      size: 10,
    },
  },
});

How to add new queries

  1. Create a .graphql file in src/operations/.
  2. Run bun run generate.
  3. Import the new ...Document and related types from the package.
  4. (Optional) Add a dedicated method in src/client.ts.

Testing with Postman

  1. Import product-graphql.postman_collection.json into Postman.
  2. Set collection variables:
    • baseUrl (GraphQL endpoint)
    • authToken (if required)
    • productCode, page, size
  3. Run Get Product or Search Products.

Release and versioning

1) Prepare release

Make sure your working tree is clean and you are authenticated on npm:

npm whoami

If needed:

npm login

Also make sure git remote is configured and you have push permissions.

2) Run one release command

Choose one of:

bun run release:patch
bun run release:minor
bun run release:major

For beta builds:

bun run release:beta

Each release command performs all steps automatically:

  • runs npm version ... (updates package.json + creates git tag)
  • publishes to npm (public for stable, --tag beta for beta)
  • pushes commit and tags to remote (git push && git push --tags)

prepublishOnly runs automatically before every publish and executes:

  • bun run build
  • bun run check

Operational notes

  • src/generated/graphql.ts is auto-generated: do not edit it manually.
  • If you update schema or queries, always regenerate with bun run generate.