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

@lifeomic/alpha-cli

v3.1.2

Published

Curl-like CLI for the Alpha client

Downloads

437

Readme

alpha-cli

npm Build Status

alpha-cli provides a curl-like CLI wrapper around the alpha client. This allows Lambda services to be directly invoked manually.

Setup

$ npm install -g @lifeomic/alpha-cli

Usage

$ alpha --help
Options:
      --help             Show help                                     [boolean]
  -H, --header           Pass custom header line to server              [string]
      --lambda-handler   A javascript/typescript lambda handler to send requests
                         to                                             [string]
      --env-file         File to load as environment variables when importing
                         lambda                                         [string]
  -X, --request          Specify the request method to use
      --data-binary      Send binary data
      --proxy-port       port to proxy requests on      [number] [default: 9000]
      --proxy            http proxy requests to alpha [boolean] [default: false]
      --sign             Sign requests with AWS SignatureV4
                                                      [boolean] [default: false]
      --role             Role to assume when signing                    [string]
      --validate-status  Validate the HTTP response code and fail if not 2XX
                                                      [boolean] [default: false]
  -V, --version          Show the version number and quit              [boolean]

$ alpha lambda://user-service/users/jagoda | jq
{
  "id": "jagoda",
  "profile": {
    "email": "[email protected]"
  }
}

Options

sign

Use for services like OpenSearch when set up with Role based auth. When combined with the --proxy option normal RESTful UI tools can then be used to hit a cluster without additional configuration.

Interacting with GraphQL lambdas using the Alpha CLI proxy

Introduction

This is a guide on how to proxy GraphQL requests through Alpha in order to be able to use IDEs to construct and execute queries. While this approach is IDE agnostic, this will demonstrate how to proxy to the Insomnia IDE, offering capabilities like automatic schema detection, auto-complete, linting, and a convenient way to save queries.

Install a GraphQL IDE

Insomnia has a nice interface, but [Postman] and other IDEs should work as well.

If you have brew, all you need to do to install Insomnia is run:

brew install --cask insomnia

Setup

You'll need to be authenticated against your AWS environment

# Connect to the proxy
alpha --proxy lambda://my-graphql-lambda:deployed

Usage

Once you're logged in and your proxy is running, launch Insomnia and start creating/organizing queries. It may be convenient to organize them by folder.

For a typical GraphQL request, you'll want to configure your request to POST to http://localhost:[port],

You'll also likely need to configure headers. If using lifeomic APIs, you may need lifeomic-account and lifeomic-user depending on the service:

Depending on how you've configured Insomnia, it will either automatically start fetching the schema, or you can manually fetch it.

Once you've successfully loaded the schema, you can pull up documentation using the same dialog, allowing you to click through and copy GraphQL queries/mutations.

Now that the schema is loaded, you can review documentation and create and test queries with autocomplete