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

@seneca/provider

v4.0.0

Published

Shared utilities for Seneca Provider plugins.

Readme

Seneca

A Seneca.js plugin

@seneca/provider

npm version build Known Vulnerabilities DeepScan grade Maintainability

| Voxgig | This open source module is sponsored and supported by Voxgig. | |---|---|

Shared utilities for Seneca provider plugins — the plugins that wrap third-party APIs such as GitHub, Trello or Stripe.

This module does two things:

  • Holds provider keys and serves them over sys:provider messages, so credentials live in one place instead of in every integration.
  • Builds provider plugins, exposing remote API resources as Seneca entities under a provider/<name>/<entity> canon, with URL building, JSON handling, error wrapping, retry and token refresh provided for you.

Requires Node.js 24 or later.

Install

$ npm install @seneca/provider

seneca, seneca-entity and seneca-promisify are peer dependencies; @seneca/env is optional and enables environment variable references in key values.

$ npm install seneca seneca-entity seneca-promisify

Quick Example

Register the plugin, declaring the keys your providers need:

Seneca({ legacy: false })
  .use('promisify')
  .use('entity')
  .use('provider', {
    provider: {
      github: {
        keys: {
          main: { value: process.env.GITHUB_TOKEN },
        }
      }
    }
  })

Then build a provider plugin on top of it. This one exposes GitHub repositories as the entity provider/repohome/readme:

function RepohomeProvider() {
  const seneca = this
  const entityBuilder = seneca.export('provider/entityBuilder')

  const { makeUrl, getJSON } = seneca.export('provider/makeUtils')({
    name: 'repohome',
    url: 'https://api.github.com/repos/senecajs/',
  })

  entityBuilder(seneca, {
    provider: { name: 'repohome' },
    entity: {
      readme: {
        cmd: {
          load: {
            action: async function (entize, msg) {
              const res = await getJSON(makeUrl(msg.q.id))
              const load = entize(res)
              load.id = msg.q.id
              return load
            }
          }
        }
      }
    }
  })
}

Remote data is now reachable through the ordinary entity API:

const repo = await seneca.entity('provider/repohome/readme')
  .load$('seneca-provider')

console.log(repo.full_name)   // senecajs/seneca-provider

Documentation

  • Tutorial — build a working provider plugin from scratch, step by step. Start here.
  • Guide — recipes: managing keys, retries, token refresh, query parameters, writes, error handling, testing.
  • API reference — every export, message and helper function.
  • Options reference — every option, with defaults.
  • Concepts — the design and its trade-offs.
  • Developing — building, testing and releasing this repository.

More Examples

See test/ for more usage examples.

Motivation

Every integration with a third-party API repeats the same work: building URLs, attaching credentials, parsing JSON, deciding what counts as an error, retrying flaky calls, refreshing expired tokens. Written separately for each API, that code drifts, and each integration ends up handling failure a little differently.

This plugin factors out the parts that do not vary, and models remote resources as Seneca entities so that calling code does not need to know whether data is local or remote.

See Concepts for the reasoning in full.

Support

If you're using this module and need help, you can:

API

Options

  • provider — map of provider name to { keys: { <name>: { value } } }. Default {}.
  • entity.pin — extra pattern properties merged into every generated entity message. Default { sys: 'entity' }.

Full details in the options reference.

Action Patterns

Action Descriptions

« get:key,sys:provider »

No description provided.


« get:keymap,sys:provider »

No description provided.


« list:provider,sys:provider »

No description provided.


Message parameters and responses are documented in the API reference.

Provider Plugins

Contributing

The Senecajs org encourages open participation. If you feel you can help in any way, be it with documentation, examples, extra testing, or new features please get in touch.

The SenecaJS org encourages participation. If you feel you can help in any way, be it with bug reporting, documentation, examples, extra testing, or new features, feel free to create an issue, or better yet - submit a Pull Request. For more information on contribution, please see our Contributing Guide.

To work on this repository — layout, build, test and release — see doc/develop.md.

Background

Check out the SenecaJS roadmap here!