heroku-cli-addons
Advanced tools
Comparing version 1.2.20 to 1.2.21
@@ -25,3 +25,3 @@ 'use strict' | ||
}) | ||
.then(singularize('addon')) | ||
.then(singularize('addon', options.namespace)) | ||
} | ||
@@ -47,3 +47,3 @@ | ||
}) | ||
.then(singularize('addon')) | ||
.then(singularize('addon', options.namespace)) | ||
} | ||
@@ -107,5 +107,10 @@ | ||
const singularize = function (type) { | ||
const singularize = function (type, namespace) { | ||
return (matches) => { | ||
matches = matches.filter(m => !m.hasOwnProperty('namespace') || m.namespace === null) | ||
if (namespace) { | ||
matches = matches.filter(m => m.namespace === namespace) | ||
} else if (matches.length > 1) { | ||
// In cases that aren't specific enough, filter by namespace | ||
matches = matches.filter(m => !m.hasOwnProperty('namespace') || m.namespace === null) | ||
} | ||
switch (matches.length) { | ||
@@ -127,3 +132,3 @@ case 0: | ||
'headers': headers, 'body': {'app': null, 'addon_attachment': id, 'addon_service': options.addon_service} | ||
}).then(singularize('addon_attachment')) | ||
}).then(singularize('addon_attachment', options.namespace)) | ||
.catch(function (err) { handleNotFound(err, 'add_on attachment') }) | ||
@@ -135,3 +140,3 @@ } | ||
.then(filter(app, options.addon_service)) | ||
.then(singularize('addon_attachment')) | ||
.then(singularize('addon_attachment', options.namespace)) | ||
} | ||
@@ -182,3 +187,3 @@ | ||
'headers': headers, 'body': {'app': app, 'addon_attachment': id, 'addon_service': options.addon_service} | ||
}).then(singularize('addon_attachment')) | ||
}).then(singularize('addon_attachment', options.namespace)) | ||
} | ||
@@ -185,0 +190,0 @@ |
{ | ||
"name": "heroku-cli-addons", | ||
"description": "`heroku addons:*` commands", | ||
"version": "1.2.20", | ||
"version": "1.2.21", | ||
"author": "Bo Jeanes @bjeanes", | ||
@@ -6,0 +6,0 @@ "bugs": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
147232
1216
0