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

@yottagraph-ai/elemental-api

v0.4.1

Published

Elemental API OpenAPI specifications and generated TypeScript client

Readme

@lovelace-ai/elemental-api

Elemental API OpenAPI specifications and TypeScript client for the Lovelace project.

Installation

npm install @lovelace-ai/elemental-api
# or
pnpm add @lovelace-ai/elemental-api

Package exports

| Export | Use for | |------------|---------| | @lovelace-ai/elemental-api | Spec only: elementalSpec, elementalSpecPath, version | | @lovelace-ai/elemental-api/client | Wrapped client, raw client functions, and types | | @lovelace-ai/elemental-api/config | configureElementalClient() and ElementalFetchConfig |

Usage

The Orval-generated client uses global config: you set base URL and optional fetch once, and every call (wrapped, raw, or a mix of both) uses that config. Do this once at app init regardless of how you intend to use the API.

1. Configure once (required)

Set your base URL and optional custom fetch. All client calls—whether you use the wrapped API, the raw functions, or both—use this same global config.

import { configureElementalClient } from "@lovelace-ai/elemental-api/config";

configureElementalClient({
  baseUrl: "https://stable-query.lovelace.ai",
  fetch: async (url, options) => {
    const res = await fetch(url, {
      ...options,
      headers: {
        ...options?.headers,
        Authorization: `Bearer ${yourToken}`,
      },
    });
    const data = await res.json().catch(() => ({}));
    return { data, status: res.status, headers: res.headers };
  },
});

Your fetch must return { data, status, headers } (not a raw Response).

2. Call the API

Wrapped — Use useElementalClient() when you want methods to return response data on success and throw on non-2xx. Best for most call sites.

import { useElementalClient } from "@lovelace-ai/elemental-api/client";

const client = useElementalClient();
const article = await client.getArticle(artid);        // data only
const report = await client.getNamedEntityReport(neid);

Raw — Use the exported functions (getArticle, findEntities, etc.) when you need status codes or headers (e.g. custom error handling). They return { data, status, headers }.

import { getArticle, findEntities } from "@lovelace-ai/elemental-api/client";

const response = await getArticle(artid);
if (response.status === 200) {
  console.log(response.data);
} else if (response.status === 404) {
  // handle not found
}

3. Types

Import API types from the client entrypoint; import ElementalFetchConfig from the config entrypoint when typing options for configureElementalClient:

import type { MentionDetail, NamedEntityReport, ArticleDetail } from "@lovelace-ai/elemental-api/client";
import type { ElementalFetchConfig } from "@lovelace-ai/elemental-api/config";

4. Spec only (no client)

If you only need the OpenAPI spec:

const { elementalSpec, elementalSpecPath, version } = require("@lovelace-ai/elemental-api");
// or
import { elementalSpec, elementalSpecPath } from "@lovelace-ai/elemental-api";

Development

The OpenAPI spec is built from the query project’s specs (see scripts/merge-elemental-specs.mjs): we currently merge the legacy and new Elemental specs into one, then generate the client from that (see orval.config.mjs). Long-term, the legacy spec will be dropped and this package will consume a single spec from the query project. The spec and generated code live under generated/ and are not checked in. Run npm run build (or npm run generate:client then npm run validate) before npm run validate.

Important: Use the Cursor command instead of running these commands manually.

In Cursor, run the command defined in .cursor/commands/elemental_api_update.md which handles the full workflow: regenerating specs from Go annotations, updating skill docs, running tests, and optionally publishing packages.

# Build spec from query project + generate client + emit types
npm run build

# Or step by step:
npm run generate:client   # merge specs from query dir → generated/elemental-api-spec.json, then orval
npm run build:types        # emit .d.ts for /client and /config

# Publish (build runs automatically via prepublishOnly)
npm publish