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

bfastjs

v4.5.3

Published

javascript client sdk for bfast::cloud project

Downloads

21

Readme

BFast::Cloud | JS Client SDK

Sdk library to be used in a client-side web like (Angular, React) and NodeJs env.

Get Started

Web

You can use https://www.unpkg.com/bfastjs to add it as a <script src="https://www.unpkg.com/bfastjs"></script> direct to your html file. Or you can install it direct from npm.

john@pc:~$ npm install --save bfastjs

NodeJs

john@pc:~$ npm install --save bfastnode

Note For bfastjs < 3.x.x work with bfast-daas < 1.x.x and bfast-faas < 1.x.x

SetUp

Before you call any API you need to initialize your SDK

const {bfast} = require('bfastjs');

BFast.init({
    applicationId: 'your-bfast-project-applicationId', // required if you connect to bfast cloud project [ optional if you have a bfast cloud project]
    projectId: 'your-bfast-project-projectId', // required if you connect to bfast cloud project [ optional if you have a bfast cloud project]
    appPassword: 'your-bfast-project-password', // this is the master-key to override any authorization from bfast cloud, you get it from from bfast cloud project [ optional if you have a bfast cloud project]
    functionsURL: 'a url to your FaaS engine', // if you have a faas engine served in your servers other that bfast cloud
    databaseURL: 'a url to your DaaS engine', // if you have a daas engine served in your servers other than bfast cloud
    cache: {
        collection: 'any name',
        ttlCollection: 'any name',
        enable: false // default is false
    } // this is optional if you need to override a default cache configuration
}, 'your-app-name');

if you don't supply app name DEFAULT_APP name will be used. That all you need to set up a bfast sdk. You will only call this once in your app just before you use any api this sdk.

React | NextJS Support

Create useBFast.js file:

import { useRef, useState, useEffect } from "react";

export default function useBFast() {
  const dbRef = useRef();
  const [isDBLoaded, setIsDBLoaded] = useState(false);
  const { BFast } = dbRef.current || {};

  useEffect(() => {
    dbRef.current = {
      BFast: require("bfastjs").BFast,
    };

    setIsDBLoaded(true);
  }, []);

  return Object.freeze({
    isDBLoaded,
    BFast,
  });
}

Use in app as:

import useBFast from "../PATH_TO/useBFast";

export default function MyComponent(props) {
  const { isDBLoaded, BFast } = useBFast();
  
  useEffect(() => {
    if (isDBLoaded) {
      console.log(BFast);
      // use BFast
      BFast.BFast.init({
        applicationId: "",
        projectId: "",
      });
    }
  }, [isDBLoaded]);

  return (
    <>
      <div>
        BFast App!
      </div>
    </>
  );
}

Database

You can manipulate a database instance from bfast cloud project or the instance you deploy in your own infrastructure.