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

@unibiz/uplink

v1.1.4

Published

Contains client library for base-station.

Downloads

2

Readme

Table of Contents

Uplink

uplink

uplink is meant to interact the base-station service. To understand more about base-station, please go to base-station repository. It mainly consists of three functions, execute, status and store.

execute api

To execute an action, you'll need to provide respective stage, fact and then action, along with parameters if necessary. Following is some sample usage.

import Uplink from '@sigma-infosolutions/uplink';
const {execute} = Uplink('http://optional-host.goes.here', 'optional-uplink-id', 'optional-auth-token');

const payload = {
  ip: '127.0.0.1'
};

execute('dock', 'section', 'command', payload)
      .then((application) => {
        // do something with application
      })
      .catch((err) => {
        // handle error
      });

Above code demonstrates a call to command command of section which is docked at dock. payload is what required by command command. Please take a note that payload is totally optional. Meaning, if the command does not require it you don't need to pass it.

Optional Arguments:

  • host: First argument represents 'endpoint for uplink', if not provided, it will take value from environment variable UPLINK_ENDPOINT
  • uplinkId: Second argument represents 'current' uplink id, if this argument is omitted, then it will load uplink-id from localstorage, if no uplink-id is persisted in localstorage, a new token will be generated and persisted in localstorage.
  • token: Third argument is auth-token, if no token is provided, token will be omitted by base-station while executing a command on Interface's behalf (this may cause 401 when calling secure endpoints)
import Uplink from '@sigma-infosolutions/uplink';
const {execute} = Uplink() ;

execute('lead', 'application', 'save-checkpoint')
      .then(result => {
        // do something with application
      })
      .catch((err) => {
        // handle error
      });

As you might have noticed, the request is identical to the previous one, except no payload is provided.

status api

This api is used to retrieve status, workflow restricts setting status from outside for workflow, the status is set as an effect of executing an action. Status api is very much similar, expect status can be retrieved for different stage, fact or even whole workflow (i.e. with no arguments.) Sample call.

Status can be retrieved on few levels, to understand in detail, say the status for current workflow is

{
    lead: {
      application: {
        id: 'CE-091234',
        applicantId: 'CE-009122342'
      },
      offer: {
        id: 'CE-OF-1123',
        amount: 4000,
        currency: 'INR'
      }
    },
    converted: {
      loan: {
        id: 'CE-99803',
        amount: 49500
      }
    }
}

Section level

import Uplink from '@sigma-infosolutions/uplink';
const {status} = Uplink();

status('lead', 'application')
      .then((application) => {
         /* Application object will be
           {
             id: 'CE-091234',
             applicantId: 'CE-009122342'
           }
         */

      })
      .catch((err) => {
        // handle error
      });

Dock level


import Uplink from '@sigma-infosolutions/uplink';
const {status} = Uplink();

status('lead')
      .then((lead) => {
        /*
           lead object will be
           {
             application: {
               id: 'CE-091234',
               applicantId: 'CE-009122342'
             },
             offer: {
               id: 'CE-OF-1123',
               amount: 4000,
               currency: 'INR'
             }
           }
        */
      })
      .catch((err) => {
        // handle error
      });

Root (base-station) level -- This is not supported as off now (If requirement arises, we may implement this api).

import Uplink from '@sigma-infosolutions/uplink';
const {status} = Uplink();

status()
      .then((root) => {
        /*
           root object will have
           {
               lead: {
                 application: {
                   id: 'CE-091234',
                   applicantId: 'CE-009122342'
                 },
                 offer: {
                   id: 'CE-OF-1123',
                   amount: 4000,
                   currency: 'INR'
                 }
               },
               converted: {
                 loan: {
                   id: 'CE-99803',
                   amount: 49500
                 }
               }
           }
        */
      })
      .catch((err) => {
        // handle error
      });