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 🙏

© 2025 – Pkg Stats / Ryan Hefner

brightpearl

v1.0.4

Published

Brightpearl API client with multi-message support

Downloads

20

Readme

A fairly simple client for making RESTy calls to your Brightpearl API.

Quick example

var Brightpearl = require('brightpearl');

var datacenter = 'eu1',
    accountId = 'acme',
    appRef = 'acme_app',
    token = 'xxxxxxxx';

var bp = Brightpearl(datacenter, accountId, appRef, token);

bp.call('GET', '/warehouse-service/warehouse/4', null, function(error, httpStatus, response){

    if (error) {
        return console.error(error);
    }

    console.log('Status: ' + httpStatus);
    console.log(response);
});

Example output

$ node index.js
Status: 200
[ { name: 'Finishing Warehouse',
    id: 4,
    address:
     { addressId: 215,
       customerId: 0,
       streetAddress: '66 Wells',
       postcode: 'CA11 3HT',
       city: 'Cardiff',
       state: 'Wales',
       countryId: 237,
       countryIsoCode2: 'GB' } } ]

Installation

$ npm install brightpearl

Features

  • Takes care of request back-off & retry when the rate limit is hit
  • Makes maximum use of each request by combining up to 10 destructive actions in each multi-message

Brightpearl resources

Usage

Prerequisites

Constructor params

  • datacenter - Brightpearl data center code (eu1)
  • accountId - Brightpearl account ID
  • appRef - Private app reference
  • token - Private app token

Basic calls

brightpearl.call(method, path, body, callback);
  • method - GET/POST/PUT/DELETE/PATCH/OPTIONS
  • path - path to resource
  • body - JSON request body or null
  • callback - callback function (see below)

The callback will be called with the following params:

  • error - error message or null
  • httpStatus - HTTP response code for request
  • body - JSON HTTP response body

Multi-message

multimessage = brightpearl.multiMessage(mode, onFail);
  • mode - processing mode (SEQUENTIAL or PARALLEL)
  • onFail - on-fail behaviour (STOP or CONTINUE)

A multi-message client exposes the same .call() method as above but it waits until it has been called 10 times before dispatching all 10 requests as a single multi-message request. The pending requests are flushed every 5 seconds to prevent hanging in systems making few requests.

When multi-message requests are finished you can call .close() which will flush any pending requests and cause any further incoming requests to be made immediately.

License

MIT

Disclaimer

This package was originally intended for personal use and as such was not designed to meet every possible use case for the Brightpearl API nor has it been thoroughly tested but it has been used in anger to great success.

I am little more than a hobbyist when it comes to Node and this is my first published NPM package so I can only apologise if anything is hard to follow due to failure to follow convention.

If you have any questions about usage/updates/etc feel free to get in touch.