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

graze-client

v0.8.1

Published

A Typescript Graze API client.

Downloads

74

Readme

Graze Client

This is a simple Typescript package for interacting with the Graze API. The API is undocumented and not officially supported, but this package was made with their blessing.

npm install graze-client

Features

  1. getFeeds: Get all your graze feeds.
  2. getFeed: Get a specific feed.
  3. hidePost: Hide a post from a feed.
  4. updateAlgorithm: Update an algorithm.
  5. publishAlgorithm: Publish an algorithm.
  6. Algorithm Builder: A custom utility to make building an algorithm easier. See the example below.

This is a WIP

This package is under development, so if you find bugs, please report. Known issues include:

  1. Not all graze operators or APIs are implemented. I have only implemented what I need so far, so feed free to make a PR adding more.
  2. Not everything is documented, but typescript is your friend. It you use this in an editor like VSCode, you should get good autocomplete hints for types.

Usage

Authentication is currently cookie-based and a little hacky. You will need to log into Graze in your browser, then copy the cookie from your browser's developer tools, and pass it as a string to the GrazeService.

There are two exports:

1. A promise-based GrazeService

import { GrazeService, F, Algo, FullForm } from "graze-client";

const graze = new GrazeService({
  apiUrl: "https://api.graze.social",
  cookie: "<change this>",
  userId: 15,
});

// get feets
const myFeeds = await graze.getFeeds();
const feed = await graze.getFeed({ path: { feedId: 1234 } });
// hide a post
await graze.hidePost({
  payload: { algo_id: 1234, at_uri: "at://<did>/app.bsky.feed.post/<rkey>" },
});

// build a complex algorithm

const hasNoBadContent = F.and(
  F.isContentOk(0.9),
  F.hasNoNSFWLabels,
  F.isNotListMember("my-blocklist-url")
);

const algo = Algo.filter(
  // the top level filter will combine elements in an "and" block
  hasNoBadContent,
  F.hasVideo,
  F.or(
    F.posterFollows("samuel.bsky.team"),
    F.isListMember("my-whitelist-url"),
    F.and(
      F.regexMatches("text", "my-keyword-regex"),
      F.regexMatches("embed.alt", "my-keyword-regex"),
      F.regexMatches("embed.external.title", "my-keyword-regex"),
      F.regexMatches("embed.external.description", "my-keyword-regex"),
      F.isPost
    ),
    F.or(
      // nested logic blocks will be automatically flattened, so this will
      // be brought up one level since it is logically equivalent.
      F.regexNegationMatches("text", "my-negative-keyword-regex")
    )
  )
);

const manifest: FullForm = {
  algorithm_manifest: algo,
  id: 12,
  user_id: 1,
  display_name: "My Fancy Feed",
  // file:  add a file blob here to update the image
  description: "This is a fancy feed with lots of logic for fun and profit.",
  order: "new",
  // CAUTION: this will change the feed slug and cause you to lose existing follows.
  // but if you do it, don't worry you can set it back and it will be fixed : ).
  record_name: "my-fancy-feed",
};

// send the algorithm to graze
const response = await graze.updateAlgorithm(manifest);
// publish the algorithm
const res = await graze.publishAlgorithm({ path: { feedId: 1234 } });

2. An Effect based GrazeClient

This package is build with Effect. One feature of Effect is the ability to generate typesafe API clients with input/output validation. The GrazeClient is an Effect service for performing API requests. A benefit of using Effect is that errors will be typed in addition to success cases.

In the below example, the updateAlgo effect has the type: Effect.Effect<void, HttpApiDecodeError | HttpClientError | ParseError, GrazeClient>, meaning the success value is void, the possible errors are HttpApiDecodeError | HttpClientError | ParseError, and the effect requires a GrazeClient to run.

const updateAlgo = Effect.gen(function* () {
  const client = yield* GrazeClient;

  const res = yield* client.updateAlgorithm({
    record_name: "my-feed",
    display_name: "My Feed",
    user_id: 1,
    order: "new",
    id: 1234,
    algorithm_manifest: {
      filter: {
        and: [
          {
            regex_matches: ["text", /Hello World!/.source, true],
          },
        ],
      },
    },
  });
});

If you're interested, I recommend reading more in the Effect docs.

To do

  • [ ] Organize schema to provide more useful type exports
  • [ ] Add additional filter blocks to UpdateAlgorithmPayload schema.
  • [ ] Add API to create a feed.