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 🙏

© 2024 – Pkg Stats / Ryan Hefner

lightrail-client

v4.6.0

Published

A Javascript and Typescript client for Lightrail

Downloads

201

Readme

Lightrail Client for JavaScript and TypeScript

Lightrail is a modern platform for digital account credits, gift cards, promotions, and points (to learn more, visit Lightrail). This is a basic library for developers to easily connect with the Lightrail API using Javascript or Typescript. You can find JS API documentation at https://giftbit.github.io/lightrail-client-javascript/ .

This client runs on your server and makes calls to the Lightrail server.

Features

The following features are supported in this version:

Contacts: Create, Get, List, Update, Delete, List Values, Attach to Value, Detach from Value

Values: Create, Get by Id, Get by FullCode, List, Update, Delete

Programs: Create, Get, List, Update, Delete, Create Issuance, Get Issuance, List Issuances

Transactions: Checkout, Debit, Credit, Transfer, Reverse, Capture Pending, Void Pending, Get, Get Transaction Chain, List

Currencies: Create, Get, List, Update, Delete

Webhooks: Create, Get, List, Update, Delete, Create Secret, Get Secret, Delete Secret

For a complete list of Lightrail API features check out the Lightrail API documentation.

Usage

Configuration

Before using this client, you'll need to configure it to use your API key:

import * as Lightrail from "lightrail-client";
// or
const Lightrail = require('lightrail-client');

Lightrail.configure({
  apiKey: '<LIGHTRAIL API KEY>'
})

The API key you configure should not be shared publicly. Also, it should not be set in the browser or any client side code because it can be viewed and tampered with. The browser cannot be trusted to interact with the Lightrail API directly.

Compiling for node with webpack

This library uses superagent to facilitate network requests. To have webpack use the node-version of superagent your webpack config must include target: 'node'.

If when running your code you see the error TypeError: undefined is not a function then most likely you must include the following in the plugins section of your webpack config: plugins: [new webpack.DefinePlugin({"global.GENTLY": false})]. See https://github.com/felixge/node-formidable/issues/337 for an explanation.

Development

Testing

Testing requires a Lightrail account. Copy .env.example to .env and set your account's test API key which is available in the Lightrail web app.

Then you can run npm test.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/Giftbit/lightrail-client-javascript.

Releasing (Lightrail team only)

  1. Update the version of the project in package.json following semantic versioning.
  2. Publish to npm with the command npm publish. Tests and linting run as part of this script.
  3. Create a GitHub release. The release name and tag must be v followed by the version number (eg: v1.2.3). The description must list changes and highlight any breaking changes.

License

This library is available as open source under the terms of the MIT License.