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

@brigadecore/brigade-sdk

v2.4.1

Published

![build](https://badgr.brigade2.io/v1/github/checks/brigadecore/brigade-sdk-for-js/badge.svg?appID=99005) [![slack](https://img.shields.io/badge/slack-brigade-brightgreen.svg?logo=slack)](https://kubernetes.slack.com/messages/C87MF1RFD)

Downloads

453

Readme

Brigade SDK for JavaScript

build slack

This is a Brigade 2-compatible SDK for JavaScript and TypeScript.

Supported Runtimes

Great care has been taken to ensure this SDK works within recent versions of Node as well as modern browsers (latest versions of Firefox, Chrome, Edge, Safari, etc.) if properly transpiled with webpack or similar.

Installation

Install into your project using your favorite package manager.

For instance:

$ npm install --save @brigadecore/brigade-sdk

Or:

$ yarn add @brigadecore/brigade-sdk

Basic Use

Note: All examples that follow use TypeScript.

A Brigade API client can be obtained as follows:

import { APIClient } from "@brigadecore/brigade-sdk"

// ...

const client = new APIClient(apiAddress, apiToken, opts)

In the example above, it is assumed:

  • apiAddress points to a Brigade 2 API server. The address must include the protocol (i.e. must be prefixed with http:// or https://).
  • apiToken is:
    • A valid API token. It is probably best to use a non-expiring service account token. Refer to Brigade's own documentation on how to obtain such a token.
    • The empty string is acceptable, but only API operations not requiring authorization will then be supported by the client.
  • opts, as one might infer, is an optional parameter. If included, it must be an object, which may have a single field allowInsecureConnections containing the value true or false to indicate whether SSL errors should be tolerated by the client. If not specified, SSL errors will not be tolerated. This option is only applicable when the value of the apiAddress argument uses https:// as the scheme.

The client returned from the call to the new APIClient(...) constructor is the root in a tree of more specialized clients.

To obtain a client for working with the "core" components of Brigade (Projects, Events, etc.):

const coreClient = client.core()

The coreClient permits navigation to even more specialized clients, for example:

const projectsClient = coreClient.projects()

If your program needs to interact with only a specific subset of the Brigade API, it is possible and encouraged to directly instantiate just the specific subset of the client tree that is needed.

For instance, this example shows instantiation of only the Events client-- something that might be practical for a program such as a Brigade gateway, whose only interaction with Brigade involves the creation of new Events:

import { core } from "@brigadecore/brigade-sdk"

// ...

const eventsClient = new core.EventsClient(apiAddress, apiToken, opts)

The arguments passed above are the same as in our initial example.

Further Examples

Working Node and browser-based examples are available in the examples directory.

Contributing

The Brigade project accepts contributions via GitHub pull requests. The Contributing document outlines the process to help get your contribution accepted.

Support & Feedback

We have a slack channel! Kubernetes/#brigade Feel free to join for any support questions or feedback, we are happy to help. To report an issue or to request a feature open an issue here

Code of Conduct

Participation in the Brigade project is governed by the CNCF Code of Conduct.