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

@anteros/sdk

v0.0.3

Published

Anteros SDK

Readme

@anteros/sdk

TypeScript REST client for the Anteros backend platform. Provides a typed, promise-based API to interact with your Anteros collections, services, files, and authentication endpoints — works in the browser, Node.js, and Bun.

Installation

bun add @anteros/sdk
# or
npm install @anteros/sdk

Requires typescript ^5 (peer dependency).

Quick start

import { Rest } from "@anteros/sdk";

const api = new Rest({
  server: "https://api.example.com",
  tenant: "my-tenant",
  token: {
    persist: true,        // auto-save token in localStorage
    storageKey: "dnax_token",
  },
});

// Login
const { token, data: user } = await api.login("users", {
  email: "[email protected]",
  password: "secret",
});

// CRUD
const posts = await api.find("posts", { $limit: 10 });
const post  = await api.insertOne("posts", { title: "Hello" });
await api.updateOne("posts", post._id, { title: "Updated" });
await api.deleteOne("posts", post._id);

API reference

Constructor

new Rest(options: RestClientOptions)

| Option | Type | Description | |-------------------|--------------------------|-------------| | server | string | Base URL of the Anteros server | | tenant | string | Tenant identifier | | headers | Record<string, string> | Default headers sent with every request | | token | object | Token persistence settings | | token.persist | boolean | Persist token in localStorage (default: true) | | token.storageKey| string | localStorage key (default: "dnax_token") |

Collections (CRUD)

All collection methods follow the pattern method<T>(collection, …) where T is the return type.

| Method | Description | |-----------------------------------------------------|-------------| | find<T>(collection, params, options?) | Query documents with filters, sorting, pagination, lookups | | findOne<T>(collection, id, params?, options?) | Get a single document by ID | | insertOne<T, TBody>(collection, data, options?) | Insert one document | | insertMany<T, TBody>(collection, data[], options?)| Insert multiple documents | | updateOne<T, TUpdate>(collection, id, update, options?) | Update one document | | updateMany<TUpdate>(collection, ids[], update, options?) | Update multiple documents | | deleteOne(collection, id, options?) | Delete one document | | deleteMany(collection, ids[], options?) | Delete multiple documents | | aggregate<T>(collection, pipeline, options?) | Run an aggregation pipeline | | runAction<T>(collection, action, data?, options?) | Call a custom collection action |

FindOptions

{
  $limit?: number;
  $skip?: number;
  $sort?: { [key: string]: 1 | -1 };
  $match?: Record<string, unknown>;
  $project?: Record<string, unknown>;
  $include?: Array<string | LookupOptions>;
  $lookup?: Array<Record<string, any>>;
  $graphLookup?: Array<Record<string, any>>;
}

Authentication

| Method | Description | |-------------------------------------------------|-------------| | login<T>(collection, payload, options?) | Login and automatically store the JWT token | | logout<T>(collection, payload?, options?) | Logout and clear the stored token | | getToken() | Get the current token | | clearToken() | Manually clear the token | | setHeader(name, value) | Set/unset a custom header |

File management

// Upload one or more files
const result = await api.upload("photos", file, { title: "My photo" }, {
  fieldName: "file",  // default
});

// Get a file URL with optional image transform
const url = api.getFileUrl("photos", "abc123.jpg", {
  width: 400,
  height: 300,
  format: "webp",
  quality: 80,
});

// Delete a file (by its _id)
await api.deleteFile("photos", fileResult._id);

Services

const result = await api.runService("email", "send", {
  to: "[email protected]",
  subject: "Hello",
});

Configuration

const config = await api.getConfig();
// { tenants, collections, services, fileCollections }

Request options

Every method accepts optional RestRequestOptions:

{
  headers?: Record<string, string>;   // extra headers
  signal?: AbortSignal;               // support for AbortController
  query?: RestQueryOptions;           // query params
  cleanDeep?: boolean;                // strip null/empty values from body
}

Utility: cleanDeep

The SDK exports a cleanDeep utility that recursively removes null, undefined, empty arrays, and empty objects from a value.

License

MIT