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

bastion-sdk

v0.1.1

Published

SDK for interacting with your Bastion application

Readme

Bastion SDK

Client SDK for interacting with your Bastion application.

Getting Started

  • To install: npm install bastion-sdk within your project directory.
  • Import the package in your JavaScript file: import initialize from 'bastion-sdk'
  • Initialize the SDK: const sdk = initialize("yourURL", "yourApiKey")
    • You can get the URL and API key for your application instance in your Bastion admin app.
  • You are now ready to use the SDK methods below in your JavaScript code.

SDK Methods

Authentication:

sdk.auth.register(email, password)

Register a new user and password. Passwords are stored as encrypted values.

Inputs:

  • email: String
  • password: String

Outputs:

  • Status 200

sdk.auth.login(email, password)

Log in a user with the given email and password.

Inputs:

  • email: String
  • password: String

Outputs:

  • Status 200

sdk.auth.logout(email)

Logout a given user and invalidate their session.

Inputs:

  • email: String

Outputs:

  • Status 200

Database:

sdk.db.getAllItems(collectionName)

Get all items in a collection with the given collection name.

Inputs:

  • collectionName: String

Outputs:

  • The items in a collection specified as a JSON object
  • Status 200

sdk.db.getItem(collectionName, itemId)

Get a single database record with the given collection name and ID.

Inputs:

  • collectionName: String
  • itemId: String

Outputs:

  • The database record as a JSON object
  • Status 200

sdk.db.createItem(collectionName, data)

Create a single database record in the collection specified. Pass in the JSON object you want to store in that collection.

Inputs:

  • collectionName: String
  • data: JSON object

Outputs:

  • The newly created database record as a JSON object
  • Status 201

sdk.db.overwriteItem(collectionName, itemId, data)

Overwrite a single database record with the given collection name and ID. Pass in the JSON object with key-value pairs you wish to overwrite. Other key-value pairs remain unchanged.

Inputs:

  • collectionName: String
  • itemId: String
  • data: JSON object

Outputs:

  • The updated database record as a JSON object
  • Status 201

sdk.db.updateItem(collectionName, itemId, data)

Update a single database record in the collection specified. Pass in the updated JSON object you want to store in that collection. Replaces the entire record, so you must supply all key-value pairs, even if they have not changed.

Inputs:

  • collectionName: String
  • itemId: String
  • data: JSON object

Outputs:

  • The updated database record as a JSON object
  • Status 201

sdk.db.deleteItem(collectionName, itemId)

Delete a single database record with the given collection name and ID.

Inputs:

  • collectionName: String
  • itemId: String

Outputs:

  • Status 204

Cloud Code Functions:

sdk.ccf.run(cloudFunctionName, parameters)

Runs the code for an existing cloud code function in your Bastion application and returns the resulting value.

Inputs:

  • cloudFunctionName: String
  • parameters (optional): determined by the user

Outputs:

  • Return value of the cloud code function specified
  • Status 200