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

@al/client

v1.2.2

Published

A client to abstract common Public API functionality

Downloads

123

Readme

@al/client

A client to support higher order client interfaces.

This library uses axios as its HTTP provider interface.

This library uses cache to provide transparent persistent storage to consumers.

Disclaimer

Until the release of version 1.0.0 all current minor version increments may be backwards incompatible. Please bear this in mind when developing against this library. Should you have any further questions, please do not hesitate to contact us as [email protected]

Installation

  npm install @al/client --save

Note that this client library has @al/session as a peerDependency so make sure you have this installed in your consuming application you are writing.

Usage

For commonjs environments, e.g nodejs:

  var ALClient = require('@al/client').ALClient;

For ES2015 environments, e.g. TypeScript based frameworks such as Angular:

  import { ALClient } from '@al/client';

Methods

authenticate

Log in to AIMS and establish a Session.

  ALClient.authenticate(username, password, mfa_code);

authenticateWithMFASessionToken

Authenticate with an mfa code and a temporary session token.

  ALClient.authenticateWithMFASessionToken(token, mfa_code);

getEndpoint

Return the current API or UI endpoint (FQDN) for the provided account ID, residency, service, and endpoint type.

  ALClient.getEndpoint(params);
    params: {
      account_id: '0',
      // ("us" or "emea" or "default")
      residency: 'default',
      service_name: 'aims',
      // ("api" or "ui")
      endpoint_type: 'api',
      path: '',
      query: {},
      data: {},
    }

fetch

GET data from an Alert Logic API

  ALClient.fetch(params)
    params: {
      service_name: 'aims',
      path: '/token_info',
    }

GET data from an Alert Logic API in a different response format e.g. CSV file download

  ALClient.fetch(params)
    params: {
      service_name: 'aims',
      path: '/token_info',
      accept_header: 'text/csv',
      response_type: 'blob'
    }

post

POST data to an Alert Logic API

  ALClient.post(params)
    params: {
      service_name: 'aims',
      path: '/change_password',
      // Data can be a String or Object
      data: {"email": "[email protected]", "current_password": "hunter2", "new_password": "Fraudulent$Foes"}
    }

set

PUT data to an Alert Logic API

  ALClient.set(params)
    params: {
      service_name: 'aims',
      path: '/reset_password/:token',
      // Data can be a String or Object
      data: {"password": "hunter2"}
    }

delete

DELETE data from an Alert Logic API

  ALClient.delete(params)
    params: {
      account_id: '1234'
      service_name: 'aims',
      path: '/roles/:role_id',
    }

Interactive

Loads the library into memory and stays in an interactive node shell.

  npm run interactive

Tests

  npm test

or to watch for code changes and re-run tests:

  npm test-watch

An auto-generated coverage directory will be produced which will contain a browsable HTML report

Contributing

The sources are written in Typescript and follow the tslint airbnb style.

Building

To generate a production build

npm run build

To generate a development build for local testing - non minified, concatenated only

npm run build-dev

Builds will be be generated into a dist folder and will contain commonjs and umd bundles that will be consumed depending on the module system in whichever environment you are using.