Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

heroku-cli-addons

Package Overview
Dependencies
Maintainers
7
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

heroku-cli-addons - npm Package Compare versions

Comparing version 1.1.8 to 1.2.0

2

commands/addons/info.js

@@ -13,3 +13,3 @@ 'use strict'

return co(function * () {
let addon = yield resolve.addon(api, ctx.app, ctx.args.addon, {'Accept-Expansion': 'addon_service,plan'})
let addon = yield resolve.addon(api, ctx.app, ctx.args.addon)

@@ -16,0 +16,0 @@ addon.attachments = yield api.request({

@@ -69,4 +69,7 @@ 'use strict'

let attachment = yield resolve.attachment(api, ctx.app, ctx.args.addon)
.catch(function (err) {
if (err.statusCode !== 404) throw err
})
let webUrl
if (attachment) {

@@ -73,0 +76,0 @@ webUrl = attachment.web_url

@@ -9,3 +9,3 @@ 'use strict'

const resolve = require('../../lib/resolve')
let addon = yield resolve.addon(api, ctx.app, ctx.args.addon, {'Accept-Expansion': 'addon_service,plan'})
let addon = yield resolve.addon(api, ctx.app, ctx.args.addon)

@@ -12,0 +12,0 @@ let interval = parseInt(ctx.flags['wait-interval'])

@@ -5,4 +5,4 @@ 'use strict'

const addonResolver = function (heroku, app, id, headers) {
headers = headers || {}
const addonResolver = function (heroku, app, id, options = {}) {
const headers = {'Accept-Expansion': 'addon_service,plan'}
let getAddon = function (id) {

@@ -46,5 +46,35 @@ return heroku.get(`/addons/${encodeURIComponent(id)}`, {headers})

exports.attachment = function (heroku, app, id, headers) {
headers = headers || {}
function NotFound () {
Error.call(this)
Error.captureStackTrace(this, this.constructor)
this.name = this.constructor.name
this.statusCode = 404
this.message = 'Couldn\'t find that addon.'
}
function AmbiguousError (objects) {
Error.call(this)
Error.captureStackTrace(this, this.constructor)
this.name = this.constructor.name
this.statusCode = 422
this.message = `Ambiguous identifier; multiple matching add-ons found: ${objects.map((object) => object.name).join(', ')}.`
this.body = {'id': 'multiple_matches', 'message': this.message}
}
const singularize = function (matches) {
switch (matches.length) {
case 0:
throw new NotFound()
case 1:
return matches[0]
default:
throw new AmbiguousError(matches)
}
}
exports.attachment = function (heroku, app, id, options = {}) {
const headers = {'Accept-Inclusion': 'addon:plan,config_vars'}
function getAttachment (id) {

@@ -63,3 +93,5 @@ return heroku.get(`/addon-attachments/${encodeURIComponent(id)}`, {headers})

return heroku.get(`/addons/${encodeURIComponent(addon.id)}/addon-attachments`, {headers})
.then((attachments) => attachments.find((att) => att.app.name === app))
.then(function (attachments) {
return singularize(attachments.filter((att) => att.app.name === app))
})
}

@@ -75,7 +107,9 @@

// correctly in the SSO payload.
else {
else if (app) {
return exports.addon(heroku, app, id)
.then((addon) => getAppAddonAttachment(addon, app))
} else {
throw new NotFound()
}
})
}
{
"name": "heroku-cli-addons",
"description": "`heroku addons:*` commands",
"version": "1.1.8",
"version": "1.2.0",
"author": "Bo Jeanes @bjeanes",

@@ -6,0 +6,0 @@ "bugs": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc