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

vanillabknd-sdk

v1.0.3

Published

Backand SDK for JavaScript

Downloads

9

Readme

vanillabknd-sdk

npm version npm downloads

Backand SDK for JavaScript. This SDK enables you to communicate comfortably and quickly with your Backand app. It requires zero configurations, no installations and no requirements.

Installation

  • NPM:
$ npm i -S vanillabknd-sdk
import backand from 'vanillabknd-sdk'
  • CDN:
<script src="https://cdn.backand.net/javascript/dist/1.0.1/backand.min.js"></script>
  • Download/Clone this repo and include backand.min.js in your project
<script src="backand.min.js"></script>

Browser Support

Chrome | Firefox | Safari | Opera | Edge | IE | --- | --- | --- | --- | --- | --- | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | 10+ ✔ |

Quick start

backand.initiate({
  appName: 'APP_NAME',
  signUpToken: 'SIGNUP_TOKEN',
  anonymousToken: 'ANONYMOUS_TOKEN'
});

backand.service.useAnonymousAuth()
  .then(() => {
      return backand.service.getList('USERS');
  })
  .then((response) => {
      console.log(response);
  })
  .catch(function(error){
      console.log(error);
  });

API

backand namespace window.backand

The entry point to the sdk functions.

backand.initiate():

Creates a new backand instance.

backand.initiate(config);

config:

  • appName - Sets the name of your backand app (String) required
  • anonymousToken - Sets the anonymous token of your backand app (String) required
  • signUpToken - Sets the signup token of your backand app (String) required
  • apiUrl - Sets the API url of backand servers (String) (Default: 'https://api.backand.com') optional
  • storagePrefix - Sets prefix to use at the storage (String) (Default: 'BACKAND_') optional
  • storageType - Sets the storage type to use (local/session) (String) (Default: 'local') optional
  • manageRefreshToken - Determines whether the sdk should manage refresh tokens internally (Boolean) (Default: true) optional
  • runSigninAfterSignup - Determines whether the sdk should run signin after signup automatically (Boolean) (Default: true) optional
  • runSocket - Determines whether the sdk should run socket automatically (socketio-client required) (Boolean) (Default: false) optional
  • socketUrl - Sets the socket url of backand servers (String) (Default: 'https://socket.backand.com') optional
  • isMobile - Determines whether the sdk run on mobile platform (Boolean) (Default: false) optional

Properties:

| Name | Description | |--------------------------|----------------------------------------------------------| | service | entry point to the sdk service functions | | constants | entry point to the sdk constants (EVENTS, URLS, SOCIALS) | | helpers | entry point to the sdk helpers (filter, sort, exclude) | | socket (runSocket: true) | entry point to the sdk socket functions (on) |

Methods backand.service:

auth:

| Name | Syntax | |--------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------| | useAnonymousAuth (scb) | backand.service.useAnonymousAuth(data=>{}) | | signin (username, password, scb, ecb) | backand.service.signin(username, password, data=>{}, error=>{}) | | signup (email, password, confirmPassword, firstName, lastName, parameters, scb, ecb) | backand.service.signin(email, password, confirmPassword, firstName, lastName, parameters, data=>{}, error=>{}) | | socialSignin (provider, scb, ecb, spec) | backand.service.socialSignin(backand.constants.SOCIAL_PROVIDERS[provider].name, data=>{}, error=>{}, window.open - spec) | | socialSignup (provider, email, scb, ecb, spec) | backand.service.socialSignup(backand.constants.SOCIAL_PROVIDERS[provider].name, email, data=>{}, error=>{}, window.open - spec) | | requestResetPassword (username, scb, ecb) | backand.service.requestResetPassword(username, data=>{}, error=>{}) | | resetPassword (newPassword, resetToken, scb, ecb) | backand.service.resetPassword(newPassword, resetToken, data=>{}, error=>{}) | | changePassword (oldPassword, newPassword, scb, ecb) | backand.service.changePassword(oldPassword, newPassword, data=>{}, error=>{}) | | signout (scb) | backand.service.signout(data=>{}) | | getUserDetails(scb, ecb) | backand.service.getUserDetails(data=>{}, error=>{}) |

crud:

| Name | Syntax | |---------------------------------------------|-----------------------------------------------------------------------| | getList (object, params, scb, ecb) | backand.service.getList(object, params, data=>{}, error=>{}) | | create (object, data, params, scb, ecb) | backand.service.create(object, data, params, data=>{}, error=>{}) | | getOne (object, id, params, scb, ecb) | backand.service.getOne(object, id, params, data=>{}, error=>{}) | | update (object, id, data, params, scb, ecb) | backand.service.update(object, id, data, params, data=>{}, error=>{}) | | remove (object, id, scb, ecb) | backand.service.remove(object, id, data=>{}, error=>{}) |

files:

| Name | Syntax | |---------------------------------------------------------------|-----------------------------------------------------------------------------------------| | uploadFile (object, fileAction, filename, filedata, scb, ecb) | backand.service.uploadFile(object, fileAction, filename, filedata, data=>{}, error=>{}) | | deleteFile (object, fileAction, filename, scb, ecb) | backand.service.getList(object, fileAction, filename, data=>{}, error=>{}) |

Methods backand.helpers:

| Name | Syntax | |---------------------------------------------|------------------------------------------------------------------------------------| | filter: create (fieldName, operator, value) | backand.helpers.filter.create(fieldName, backand.helpers.filter.operators, value); | | sort: create (fieldName, order) | backand.helpers.sort.create(fieldName, backand.helpers.sort.orders) |

Methods backand.socket:

| Name | Syntax | |-------------------|----------------------------------------| | on(eventName, cb) | backand.socket.on(eventName, data=>{}) |

NOTE:

  • scb == Success Callback, ecb == Error Callback
  • All Methods return Promise -> .then() .catch() are available

Events:

| Name | Description | Syntax | |---------|-----------------------|----------------------------------------------------------------------------| | SIGNIN | dispatched on signin | window.addEventListener(backand.constants.EVENTS.SIGNIN, (e)=>{}, false); | | SIGNOUT | dispatched on signout | window.addEventListener(backand.constants.EVENTS.SIGNOUT, (e)=>{}, false); | | SIGNUP | dispatched on signup | window.addEventListener(backand.constants.EVENTS.SIGNUP, (e)=>{}, false); |

Examples

To view the demo web page, just run npm start - example page.

License

MIT