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

fh-fhc

Package Overview
Dependencies
Maintainers
2
Versions
121
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fh-fhc - npm Package Compare versions

Comparing version 0.7.36-202 to 0.8.0-203

1

fh-fhc.js

@@ -49,4 +49,5 @@ exports.login = require('./lib/login.js');

exports.embed = require('./lib/embed.js');
exports.resources = require('./lib/resources.js');

87

lib/common.js

@@ -14,7 +14,7 @@ // Misc common functions..

exports.doApiCall = function(host, uri, payload, errorMsg, cb) {
fhreq.POST(host, uri, payload, function (er, remoteData, raw, respose){
if (er){
return cb(er);
fhreq.POST(host, uri, payload, function (err, remoteData, raw, response){
if (err){
return cb(err);
}
if (!remoteData) return cb("No remoteData returned. Raw response is: " + util.inspect(raw));
if(remoteData.msg != undefined && remoteData.address != undefined){

@@ -24,3 +24,3 @@ if (remoteData.address["login-status"] == 'none'){

}
}
}

@@ -32,3 +32,3 @@ if (remoteData.status != undefined && remoteData.status !== 'ok'){

return cb(undefined, remoteData);
});
});
};

@@ -39,5 +39,5 @@

fhreq.GET(fhreq.getFeedHenryUrl(), uri, function (err, remoteData, raw, respose){
fhreq.GET(fhreq.getFeedHenryUrl(), uri, function (err, remoteData, raw, response){
if (err) return cb(err);
return cb(undefined, raw);
return cb(undefined, raw);
});

@@ -59,3 +59,3 @@ };

fhreq.GET(fhreq.getFeedHenryUrl(), uri, function (err, remoteData, raw, respose){
fhreq.GET(fhreq.getFeedHenryUrl(), uri, function (err, remoteData, raw, response){

@@ -78,3 +78,3 @@ if (err) return cb(err);

}else {
return cb(undefined, remoteData);
return cb(undefined, remoteData);
}

@@ -92,4 +92,4 @@ }

return cb(undefined, data.hosts[env + '-name'], data.hosts[env + '-url']);
});
});
};

@@ -104,3 +104,3 @@

if (s) len = s.length;
return len;
return len;
};

@@ -137,3 +137,3 @@

}
if (maxDescription > exports.maxTableCell) maxDescription = exports.maxTableCell;

@@ -143,3 +143,3 @@ if (maxTitle > exports.maxTableCell) maxTitle = exports.maxTableCell;

// create our table
var table = new Table({
var table = new Table({
head: ['Id', 'Title', 'Description','Alias'],

@@ -149,3 +149,3 @@ colWidths: [maxId +2 , maxTitle + 2, maxDescription + 2, maxAlias + 2],

});
// populate our table

@@ -155,4 +155,4 @@ for (var b in apps) {

table.push([app.id, app.title, app.description, app.alias]);
}
return table;
}
return table;
};

@@ -163,12 +163,28 @@

var vals = [];
for (var name in resources.usage) {
var head = name + " (Max)";
if(name.toLowerCase() === "mem" || name.toLowerCase() === "disk") {
vals[head] = bytesToSize(resources.usage[name]) + " (" + bytesToSize(resources.max[name]) + ")";
} else if(name.toLowerCase() === "cpu") {
vals[head] = resources.usage[name] + "% (" + resources.max[name] + "%)";
} else {
vals[head] = resources.usage[name] + " (" + resources.max[name] + ")";
// The resources api has changed since millicore 3.0.35
// previously the Dyno resources were used, i.e. resources.usage above.
// Now, an Apps usage is returned in resources.app.resources (and the
// field names differ also.
// So below is an attempt to keep backward compatability.
if (resources.app && resources.app.resources) {
// the new api for resources
vals["Cpu (Max): "] = resources.app.resources.Cpu_Pct + "% (" + resources.max['cpu'] + "%)";
vals["Disk (Max): "] = kbytesToSize(resources.app.resources.Disk) + " (" + bytesToSize(resources.max['disk']) + ")";
vals["Mem (Max): "] = kbytesToSize(resources.app.resources.VmRSS) + " (" + bytesToSize(resources.max['mem']) + ")";
} else {
// the old way - show the dyno resources
for (var name in resources.usage) {
var head = name + " (Max)";
if(name.toLowerCase() === "mem" || name.toLowerCase() === "disk") {
vals[head] = bytesToSize(resources.usage[name]) + " (" + bytesToSize(resources.max[name]) + ")";
} else if(name.toLowerCase() === "cpu") {
vals[head] = resources.usage[name] + "% (" + resources.max[name] + "%)";
} else {
vals[head] = resources.usage[name] + " (" + resources.max[name] + ")";
}
}
}
return createObjectTable(vals);

@@ -256,2 +272,7 @@ };

function kbytesToSize(kbytes) {
var bytes = parseInt(kbytes) * 1024;
return bytesToSize(bytes);
}
exports.createTableForTemplates = function (apps) {

@@ -315,3 +336,3 @@ return exports.createTableForApps(apps);

if (maxValue > exports.maxTableCell) maxValue = exports.maxTableCell;
var table = new Table({
var table = new Table({
head: ['Name', 'Value'],

@@ -341,3 +362,3 @@ colWidths: [maxName+2, maxValue+2],

var table = new Table({
var table = new Table({
head: heads,

@@ -366,3 +387,3 @@ colWidths: colWidths,

var table = new Table({
var table = new Table({
head: heads,

@@ -392,3 +413,3 @@ colWidths: colWidths,

W3C: app.app.w3cid,
Widg: app.app.guid,
Widg: app.app.guid,
Config: JSON.stringify(app.inst.config)

@@ -398,5 +419,5 @@ };

if (scm) {
if (scm.url) pairs["Git Url"] = scm.url;
if (scm.branch) pairs["Git Branch"] = scm.branch;
if (scm.key) pairs["Key"] = scm.key;
if (scm.url) pairs["Git Url"] = scm.url;
if (scm.branch) pairs["Git Branch"] = scm.branch;
if (scm.key) pairs["Key"] = scm.key;
}

@@ -403,0 +424,0 @@

@@ -23,4 +23,3 @@ module.exports = login;

data.p = password;
// Don't send the domain
cb = done(cb);
log.silly(data, "login POST data");

@@ -31,6 +30,17 @@ fhreq.POST

, function (error, data, json, response) {
if (!error) {
if (!error) {
if (response && response.statusCode !== 200) {
var msg = json || response.body || " ";
return cb("Login error, problem contacting: " + fhreq.getFeedHenryUrl() + " " + msg);
}
fhc.config.set("username", username);
fhc.config.set("_password", password);
var js = JSON.parse(json);
fhc.config.set("_password", password);
var js;
try {
js = JSON.parse(json);
} catch (x) {
return cb("Error parsing response: " + json + " - " + util.inspect(x));
}
if (js.login != undefined){

@@ -41,2 +51,3 @@ log.silly(js.login, "Setting cookie");

}
cb = done(cb);
if (!error || !response || response.statusCode !== 409) {

@@ -43,0 +54,0 @@ return cb(error, data, json, response);

@@ -5,3 +5,3 @@ {

"keywords" : [ "cli", "feedhenry" ],
"version": "0.7.36-202",
"version": "0.8.0-203",
"preferGlobal" : true,

@@ -8,0 +8,0 @@ "homepage" : "http://git.io/fh-fhc",

@@ -1,1 +0,1 @@

0.7.36-202
0.8.0-203
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