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

bitloops

v0.5.1

Published

NodeJS library for the Bitloops

Downloads

63

Readme

Bitloops

bitloops

NodeJS library for the Bitloops

Usage

Installing

Using npm:

$ npm install bitloops

Using yarn:

$ yarn add bitloops

TypeScript Frontend usage Example

import Bitloops, { AuthTypes, BitloopsUser, getAuth } from 'bitloops';

// You will get this from your Console in your Workflow information
const bitloopsConfig = {
	apiKey: "kgyst344ktst43kyygk4tkt4s",
	server: "bitloops.net",
	environmentId: "3c42a5ef-fe21-4b50-8128-8596ea47da93",
	workspaceId: "4f7a0fc5-fe2f-450a-b246-11a0873e91f0",
	messagingSenderId: "742387243782",
  auth: {
    authenticationType: AuthTypes.User,
    providerId: 'myProviderId', // You create this in the Bitloops Console
    clientId: 'myWebAppId', // You create this in the Bitloops Console
  }
}

const bitloops = Bitloops.initialize(bitloopsConfig);

bitloops.auth.authenticateWithUsername('username', 'email', 'password');
bitloops.auth.authenticateWithEmail('email', 'password');
bitloops.auth.authenticateWithEmailLink('email');
bitloops.auth.authenticateWithEmailLinkVerification('link');
bitloops.auth.forgotPassword('email', 'username');
bitloops.auth.forgotPassword('email');
bitloops.auth.forgotPasswordLink('link');
bitloops.auth.forgotPasswordLink('link', 'new-password');

bitloops.auth.authenticateWithGoogle();
bitloops.auth.registerWithGoogle();
bitloops.auth.addGoogle();
bitloops.auth.authenticateWithGitHub();
bitloops.auth.registerWithGitHub();
bitloops.auth.addGitHub();
bitloops.auth.authenticateWithTwitter();
bitloops.auth.registerWithTwitter();
bitloops.auth.addTwitter();
bitloops.auth.sendVerificationCode(phone);
bitloops.auth.verifyPhoneCode(phone, code);

bitloops.auth.getUser();
bitloops.auth.clear();

bitloops.auth.onAuthStateChanged((user: BitloopsUser) => {
  if (user) {
    // Do stuff when authenticated
  } else {
    // Do stuff if authentication is cleared
  }
});

...

const userInfo = await bitloops.request('db7a654a-1e2c-4f9c-b2d0-8ff2e2d6cbfe', '70e3084f-9056-4905-ac45-a5b65c926b1b');
const productInfo = await bitloops.request('64f264ad-76b1-4ba1-975c-c7b9795e55ce', '70e3084f-9056-4905-ac45-a5b65c926b1b', { productId: '7829' });
bitloops.publish('page-visited-event', { page: 'landing-page'});

PRO TIP: The second argument passed in the product.getProductInfo request and in the page-visited-event publish message containing the data of the request/publish message is using a shortcut notation which you can use if the only arguments other than the requestId or the messageId are the payload parameters. The full form is the following:

bitloops.publish('page-visited-event', { payload: { page: 'landing-page' } });

The above is equivalent to:

bitloops.p('page-visited-event', { page: 'landing-page' });

This means that if you need to pass more settings to the request / publish message then you need to explicitly define the payload argument.

Testing Example

To ask your workflows to return mocked values based on your test scenarios you can pass the testScenarioId along with your request.

const productInfo = await bitloops.request('product.getProductInfo', {
  payload: { productId: '7829' },
  testScenarioId: 'Test-Scenario-1',
});

Subscriptions

const callback = (data: any) => {
  console.log('Received', data);
};
bitloops.subscribe('ride-requested', callback);

Questions?

Please post your questions on Stack Overflow making sure you use the Bitloops tag and someone from the Bitloops team or the community will make sure to help you.

Alternatively feel free to submit an Issue on GitHub.