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

@manta-eu/client

v0.25.0

Published

The Manta GraphQL contract and the typed React Query hooks generated from it

Readme

@manta-eu/client

The Manta GraphQL contract and the typed React Query hooks generated from it.

Documentation: developers.manta.eu

Installation

pnpm add @manta-eu/client

@tanstack/react-query, react and react-router are peer dependencies — the generated hooks are React Query hooks, so your app supplies the versions it already runs.

Usage

Build a client against your deployment, then call the generated hooks:

import { mantaGraphQLClient } from "@manta-eu/client";

const client = mantaGraphQLClient(new URL("https://app.hiremanta.com"));

Pass the origin — mantaGraphQLClient appends the GraphQL path itself.

Requests carry the session from that origin, so the user signs in there.

An app on any other origin passes the person's access token instead, and the client then sends no cookies:

const client = mantaGraphQLClient(new URL("https://app.hiremanta.com"), undefined, {
  Authorization: `Bearer ${accessToken}`,
});

Access tokens last five minutes, so a long-lived client takes a token source instead of a token. getAccessToken is called before every request. On a 401 the client calls its renew(), when it has one, asks again, and retries once; onUnauthorized fires only if that retry is refused too. cachedToken from @manta-eu/auth/web is such a source:

import { cachedToken } from "@manta-eu/auth/web";

const getAccessToken = cachedToken(() => myServer.freshAccessToken());
const client = mantaGraphQLClient(new URL("https://app.hiremanta.com"), onSignedOut, undefined, { getAccessToken });

Exports

| Export | Contents | | ---------------- | ---------------------------------------------------------------------------------------------- | | . | The generated GraphQL types and hooks, plus the client constructors | | ./shared/* | Contract pieces shared with the server — page context, models, datastore paths, RDF namespaces | | ./types/* | Standalone type modules | | ./shared/tools | Tool definitions the assistant is given | | ./testing | An in-memory Manta for testing your app's SPARQL reads and writes |

Most consumers reach this package through @manta-eu/react, which mounts the copilot and its providers for you. Use it directly when you want the contract without the UI.

Testing your app

createMantaMock from @manta-eu/client/testing answers /sparql and /sparql-update from an in-memory store, so tests run your app's real LDKit queries without a Manta stack. It adds the prefixes Manta declares, to the seed Turtle too, and refuses the writes Manta refuses: anything but INSERT DATA, DELETE DATA and DELETE/INSERT with a scoped WHERE, and writes that name a graph.

It runs on Comunica and N3, which only tests need, so add them as dev dependencies:

pnpm add -D @comunica/query-sparql-rdfjs-lite n3@^1.26.0

Pass its fetch wherever your code takes one, with absolute URLs. As on Manta, /sparql reads, and writes an update sent as application/sparql-update, so one lens does both. It also answers the deprecated /sparql-update:

import { createMantaMock } from "@manta-eu/client/testing";
import { createLens } from "ldkit";

const manta = createMantaMock({ turtle: "<https://example.com/todo/1> a <https://example.com/Todo> ." });
const todos = createLens(TodoSchema, { sources: ["https://manta.test/d/acme/sparql"], fetch: manta.fetch });

In Playwright, route the page's SPARQL requests to it:

import { createMantaMock, mantaMockRoutePattern } from "@manta-eu/client/testing";

test.beforeEach(async ({ page }) => {
  const manta = createMantaMock();
  await page.route(mantaMockRoutePattern, manta.route);
});

mantaMockRoutePattern matches /sparql and /sparql-update on any origin. Pass a narrower pattern, such as https://manta.test/**, when the page also queries other SPARQL endpoints. Requests the mock does not serve fall through to the network. Like Manta, it answers a cross-origin page with CORS headers for that origin, and answers the preflight of a write itself.

manta.updates lists the updates it applied, in order. Every datastore path shares one store.

License

MIT