@bearer/node
Bearer platform bindings
Last updated 3 months ago by bearer-engineering-ci-cd .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @bearer/node 
SYNC missed versions from official npm registry.

@bearer/node

Version npm bundle size (scoped) node (scoped) Downloads/week NPM

Node client to query any APIs and custom functions using Bearer.sh

Usage

Get your Bearer's credentials and setup Bearer as follow:

Calling any APIs

const bearer = require('@bearer/node')
// or
// import bearer from '@bearer/node'

const client = bearer(process.env.BEARER_SECRET_KEY) // find it on https://app.bearer.sh/keys
const github = client.integration('INTEGRATION_ID') // you'll find it on the Bearer's dashboard

github
  .get('/repositories')
  .then(console.log)
  .catch(console.error)

More advanced examples:

// With query parameters
github
  .get('/repositories', { query: { since: 364 } })
  .then(console.log)
  .catch(console.error)

// Making an authenticated POST
github
  .auth(authId) // Create an authId for GitHub on https://app.bearer.sh
  .post('/user/repos', { body: { name: 'Just setting up my Bearer.sh' } })
  .then(console.log)
  .catch(console.error)

Using async/await:

const response = await github
  .auth(authId) // Create an authId for GitHub on https://app.bearer.sh
  .post('/user/repos', { body: { name: 'Just setting up my Bearer.sh' } })

console.log(response)

Setting the request timeout

By default bearer client times out after 5 seconds. Bearer allows to increase the timeout to up to 30 seconds

const bearer = require('@bearer/node')
// or
// import bearer from '@bearer/node'

const client = bearer(process.env.BEARER_SECRET_KEY, { httpClientSettings: { timeout: 10 * 1000 } }) // sets the timeout to 10 seconds
const github = client.integration('INTEGRATION_ID', { httpClientSettings: { timeout: 1 } }) // sets the timeout to 1 second for this specific integration

github
  .invoke('myFunction')
  .then(console.log)
  .catch(console.error)

Learn more on how to use custom functions with Bearer.sh.

Notes

Note 1: we are using axios as the http client. Each .get(), .post(), .put(), ... or .invoke() returns an Axios Promise.

Note 2: If you are using ExpressJS, have a look at the @bearer/express client

Current Tags

  • 0.91.0                                ...           beta4 (a year ago)
  • 0.96.1                                ...           beta5 (a year ago)
  • 0.105.0                                ...           beta6 (a year ago)
  • 0.113.0                                ...           buid (10 months ago)
  • 2.2.0                                ...           latest (3 months ago)
  • 2.0.0                                ...           next (5 months ago)
  • 0.115.1                                ...           rc (10 months ago)
  • 2.2.0                                ...           test (3 months ago)

147 Versions

  • 2.2.0                                ...           3 months ago
  • 2.1.1                                ...           3 months ago
  • 2.1.0                                ...           4 months ago
  • 2.0.1                                ...           5 months ago
  • 2.0.1-alpha.0                                ...           5 months ago
  • 2.0.1-test.4                                ...           5 months ago
  • 2.0.0                                ...           5 months ago
  • 1.13.10                                ...           5 months ago
  • 1.13.9                                ...           5 months ago
  • 1.13.8                                ...           5 months ago
  • 1.13.7                                ...           5 months ago
  • 1.13.4                                ...           5 months ago
  • 1.13.0                                ...           5 months ago
  • 1.11.0                                ...           5 months ago
  • 1.8.0                                ...           7 months ago
  • 1.7.1-canary.2                                ...           7 months ago
  • 1.8.0-canary.2                                ...           7 months ago
  • 1.7.0                                ...           7 months ago
  • 1.6.8                                ...           7 months ago
  • 1.6.6                                ...           7 months ago
  • 1.6.5                                ...           7 months ago
  • 1.6.4                                ...           7 months ago
  • 1.6.2-canary-4.1                                ...           8 months ago
  • 1.6.1                                ...           8 months ago
  • 1.6.0                                ...           8 months ago
  • 1.4.2-canary.24 [deprecated]           ...           8 months ago
  • 1.5.0                                ...           8 months ago
  • 1.4.2-canary.17 [deprecated]           ...           8 months ago
  • 1.0.2                                ...           10 months ago
  • 1.0.1                                ...           10 months ago
  • 1.0.0                                ...           10 months ago
  • 0.115.1 [deprecated]           ...           10 months ago
  • 0.115.0 [deprecated]           ...           10 months ago
  • 0.114.1 [deprecated]           ...           10 months ago
  • 0.113.0 [deprecated]           ...           10 months ago
  • 0.112.0 [deprecated]           ...           10 months ago
  • 0.111.0-canary2.13 [deprecated]           ...           a year ago
  • 0.111.0-canary.13 [deprecated]           ...           a year ago
  • 0.111.0-canary.9 [deprecated]           ...           a year ago
  • 0.111.0 [deprecated]           ...           a year ago
  • 0.111.0-canary.2 [deprecated]           ...           a year ago
  • 0.110.0 [deprecated]           ...           a year ago
  • 0.109.0 [deprecated]           ...           a year ago
  • 0.108.0 [deprecated]           ...           a year ago
  • 0.108.0-canary-x-ray.10 [deprecated]           ...           a year ago
  • 0.108.0-canary-xray.16 [deprecated]           ...           a year ago
  • 0.107.0-canary-xray.8 [deprecated]           ...           a year ago
  • 0.107.0-canary-tarik.8 [deprecated]           ...           a year ago
  • 0.107.0-canary-tarik.7 [deprecated]           ...           a year ago
  • 0.107.0 [deprecated]           ...           a year ago
  • 0.107.0-canary-tarik.6 [deprecated]           ...           a year ago
  • 0.107.0-canary-tarik.5 [deprecated]           ...           a year ago
  • 0.107.0-canary-tarik.3 [deprecated]           ...           a year ago
  • 0.107.0-canary-tarik.2 [deprecated]           ...           a year ago
  • 0.107.0-canary-tarik.1 [deprecated]           ...           a year ago
  • 0.107.0-canary.1 [deprecated]           ...           a year ago
  • 0.107.0-canary.0 [deprecated]           ...           a year ago
  • 0.100.1-canary.102 [deprecated]           ...           a year ago
  • 0.107.0-canary.6 [deprecated]           ...           a year ago
  • 0.106.0 [deprecated]           ...           a year ago
  • 0.106.0-canary.15 [deprecated]           ...           a year ago
  • 0.106.0-canary.14 [deprecated]           ...           a year ago
  • 0.106.0-canary.13 [deprecated]           ...           a year ago
  • 0.106.0-canary.9 [deprecated]           ...           a year ago
  • 0.106.0-canary.5 [deprecated]           ...           a year ago
  • 0.106.0-canary.1 [deprecated]           ...           a year ago
  • 0.105.0 [deprecated]           ...           a year ago
  • 0.104.0 [deprecated]           ...           a year ago
  • 0.103.0 [deprecated]           ...           a year ago
  • 0.102.0 [deprecated]           ...           a year ago
  • 0.100.1-canary.53 [deprecated]           ...           a year ago
  • 0.100.1-canary.51 [deprecated]           ...           a year ago
  • 0.101.0 [deprecated]           ...           a year ago
  • 0.101.0-canary.43 [deprecated]           ...           a year ago
  • 0.100.1-canary.40 [deprecated]           ...           a year ago
  • 0.100.1-canary.39 [deprecated]           ...           a year ago
  • 0.100.1-canary.34 [deprecated]           ...           a year ago
  • 0.100.1-next.40 [deprecated]           ...           a year ago
  • 0.100.1-canary.36 [deprecated]           ...           a year ago
  • 0.100.1-next.35 [deprecated]           ...           a year ago
  • 0.92.1-canary.148 [deprecated]           ...           a year ago
  • 0.100.1-canary.31 [deprecated]           ...           a year ago
  • 0.100.1-next.48 [deprecated]           ...           a year ago
  • 0.100.1-next.47 [deprecated]           ...           a year ago
  • 0.92.1-canary.143 [deprecated]           ...           a year ago
  • 0.92.1-canary.142 [deprecated]           ...           a year ago
  • 0.100.1-canary.25 [deprecated]           ...           a year ago
  • 0.92.1-canary.138 [deprecated]           ...           a year ago
  • 0.92.1-canary.137 [deprecated]           ...           a year ago
  • 0.100.1-next.27 [deprecated]           ...           a year ago
  • 0.92.1-canary.136 [deprecated]           ...           a year ago
  • 0.92.1-canary.135 [deprecated]           ...           a year ago
  • 0.100.1-next.25 [deprecated]           ...           a year ago
  • 0.92.1-canary.134 [deprecated]           ...           a year ago
  • 0.100.1-next.21 [deprecated]           ...           a year ago
  • 0.100.1-next.23 [deprecated]           ...           a year ago
  • 0.100.1-next.17 [deprecated]           ...           a year ago
  • 0.100.1-next.15 [deprecated]           ...           a year ago
  • 0.100.1-next.1 [deprecated]           ...           a year ago
  • 0.100.0 [deprecated]           ...           a year ago
  • 0.99.2 [deprecated]           ...           a year ago
  • 0.99.1 [deprecated]           ...           a year ago
  • 0.99.0 [deprecated]           ...           a year ago
  • 0.98.0 [deprecated]           ...           a year ago
  • 0.97.3 [deprecated]           ...           a year ago
  • 0.97.2 [deprecated]           ...           a year ago
  • 0.97.0 [deprecated]           ...           a year ago
  • 0.96.2-next.13 [deprecated]           ...           a year ago
  • 0.96.1 [deprecated]           ...           a year ago
  • 0.96.0 [deprecated]           ...           a year ago
  • 0.95.1 [deprecated]           ...           a year ago
  • 0.95.0 [deprecated]           ...           a year ago
  • 0.94.1 [deprecated]           ...           a year ago
  • 0.94.0 [deprecated]           ...           a year ago
  • 0.93.0 [deprecated]           ...           a year ago
  • 0.92.2 [deprecated]           ...           a year ago
  • 0.92.1 [deprecated]           ...           a year ago
  • 0.92.0 [deprecated]           ...           a year ago
  • 0.91.5 [deprecated]           ...           a year ago
  • 0.91.0 [deprecated]           ...           a year ago
  • 0.90.2 [deprecated]           ...           a year ago
  • 0.90.1 [deprecated]           ...           a year ago
  • 0.90.0 [deprecated]           ...           a year ago
  • 0.89.0 [deprecated]           ...           a year ago
  • 0.88.0 [deprecated]           ...           a year ago
  • 0.87.0 [deprecated]           ...           a year ago
  • 0.86.2 [deprecated]           ...           a year ago
  • 0.86.0 [deprecated]           ...           a year ago
  • 0.85.3 [deprecated]           ...           a year ago
  • 0.85.2 [deprecated]           ...           a year ago
  • 0.85.0 [deprecated]           ...           a year ago
  • 0.84.2 [deprecated]           ...           a year ago
  • 0.84.1 [deprecated]           ...           a year ago
  • 0.84.0 [deprecated]           ...           a year ago
  • 0.83.4 [deprecated]           ...           a year ago
  • 0.83.3 [deprecated]           ...           a year ago
  • 0.83.0 [deprecated]           ...           a year ago
  • 0.82.0 [deprecated]           ...           a year ago
  • 0.81.7 [deprecated]           ...           a year ago
  • 0.81.3 [deprecated]           ...           a year ago
  • 0.81.0 [deprecated]           ...           a year ago
  • 0.80.0 [deprecated]           ...           a year ago
  • 0.79.0 [deprecated]           ...           a year ago
  • 0.78.0 [deprecated]           ...           a year ago
  • 0.77.0 [deprecated]           ...           a year ago
  • 0.76.0 [deprecated]           ...           a year ago
  • 0.75.0 [deprecated]           ...           a year ago
Downloads
Today 0
This Week 0
This Month 147
Last Day 0
Last Week 147
Last Month 148
Dependencies (2)
Dev Dependencies (7)
Dependents (1)

Copyright 2014 - 2016 © taobao.org |