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

akkeris

Package Overview
Dependencies
Maintainers
4
Versions
116
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

akkeris - npm Package Compare versions

Comparing version 2.4.11 to 2.4.12

34

lib/terminal.js

@@ -31,2 +31,35 @@ var cli_table = require('cli-table');

function getDateDiff(date /*: Date */) {
var seconds = Math.floor((new Date() - date) / 1000);
var interval = Math.floor(seconds / 31536000);
if (interval > 1) {
return `${interval} years ago`;
}
if (interval === 1) {
return `${interval} year ago`;
}
interval = Math.floor(seconds / 2592000);
if (interval > 1) {
return `${interval} months ago`;
}
if (interval === 1) {
return `${interval} month ago`;
}
interval = Math.floor(seconds / 86400);
if (interval > 1) {
return `${interval} days ago`;
}
if (interval === 1) {
return `${interval} day ago`;
}
interval = Math.floor(seconds / 3600);
if (interval > 1) {
return `${interval} hours ago`;
}
if (interval === 1) {
return `${interval} hour ago`;
}
interval = Math.floor(seconds / 60);
return `${interval} minutes ago`;
}

@@ -292,3 +325,4 @@ function task(text) {

markdown:markdown,
friendly_date:getDateDiff,
format_objects:format_objects
};

2

package.json
{
"name": "akkeris",
"version": "2.4.11",
"version": "2.4.12",
"description": "Akkeris CLI",

@@ -5,0 +5,0 @@ "main": "aka.js",

@@ -60,5 +60,5 @@ "use strict"

.command('app:features', false, require_app_option, list.bind(null, appkit))
.command('features:disable FEATURE', 'list available features on an app', require_app_option, disable.bind(null, appkit))
.command('features:disable FEATURE', 'disable a feature on an app', require_app_option, disable.bind(null, appkit))
.command('app:features:disable FEATURE', false, require_app_option, disable.bind(null, appkit))
.command('features:enable FEATURE', 'list available features on an app', require_app_option, enable.bind(null, appkit))
.command('features:enable FEATURE', 'enable a feature on an app', require_app_option, enable.bind(null, appkit))
.command('app:features:enable FEATURE', false, require_app_option, enable.bind(null, appkit))

@@ -65,0 +65,0 @@ .command('features:info FEATURE', 'get information on a feature for an app', require_app_option, info.bind(null, appkit))

"use strict"
const http = require('http');
function format_hooks(hook) {

@@ -52,3 +54,37 @@ return `**ɧ ${hook.url}**

}
function to_console(headers, prefix) {
if(!headers) {
return ''
}
return Object.keys(headers).map((x) => {
return `${prefix}${x}: ${headers[x]}`
}).join('\n')
}
function format_results(appkit, result) {
return `**ɧ Hook Result:** ${result.id}, ${appkit.terminal.friendly_date(new Date(result.created_at))} - ${result.hook.events.join(', ')}
###>### POST ${result.last_attempt.request.url}
${to_console(result.last_attempt.request.headers, ' ###>### ')}
###>###
###>### ${JSON.stringify(result.last_attempt.request.body, null, 2).replace(/\n/g, '\n ###>### ')}
###>###
###<### ${(result.last_attempt.response.code > 299 || result.last_attempt.response.code < 200) ? `!!${result.last_attempt.response.code}!!` : `^^${result.last_attempt.response.code}^^`} ${http.STATUS_CODES[result.last_attempt.response.code]}
${to_console(result.last_attempt.response.headers, ' ###<### ')}
`
}
function result(appkit, args) {
appkit.api.get(`/apps/${args.app}/hooks/${args.ID}/results`, (err, results) => {
if(err) {
return appkit.terminal.error(err)
} else {
if(!args.all) {
results = results.slice(-10)
}
console.log(results.map(format_results.bind(null, appkit)).map(appkit.terminal.markdown).join('\n\n'))
}
})
}
module.exports = {

@@ -65,2 +101,16 @@

};
let hook_results_options = {
'app':{
'alias':'a',
'demand':true,
'string':true,
'description':'The app to act on.'
},
'all':{
'demand':true,
'boolean':true,
'default':false,
'description':'Show all hook results.'
}
};
let hooks_create_options = JSON.parse(JSON.stringify(hooks_options));

@@ -91,2 +141,3 @@ hooks_create_options.events = {

.command('hooks:create URL', 'create a new webhook.', hooks_create_options, create_hooks.bind(null, appkit))
.command('hooks:deliveries ID', 'Get information on a webhook delivery.', hook_results_options, result.bind(null, appkit))

@@ -93,0 +144,0 @@ },

@@ -5,34 +5,34 @@ "use strict"

function getDateDiff(date /*: Date */) {
var seconds = Math.floor((new Date() - date) / 1000);
var interval = Math.floor(seconds / 31536000);
if (interval > 1) {
return `${interval} years ago`;
}
if (interval === 1) {
return `${interval} year ago`;
}
interval = Math.floor(seconds / 2592000);
if (interval > 1) {
return `${interval} months ago`;
}
if (interval === 1) {
return `${interval} month ago`;
}
interval = Math.floor(seconds / 86400);
if (interval > 1) {
return `${interval} days ago`;
}
if (interval === 1) {
return `${interval} day ago`;
}
interval = Math.floor(seconds / 3600);
if (interval > 1) {
return `${interval} hours ago`;
}
if (interval === 1) {
return `${interval} hour ago`;
}
interval = Math.floor(seconds / 60);
return `${interval} minutes ago`;
var seconds = Math.floor((new Date() - date) / 1000);
var interval = Math.floor(seconds / 31536000);
if (interval > 1) {
return `${interval} years ago`;
}
if (interval === 1) {
return `${interval} year ago`;
}
interval = Math.floor(seconds / 2592000);
if (interval > 1) {
return `${interval} months ago`;
}
if (interval === 1) {
return `${interval} month ago`;
}
interval = Math.floor(seconds / 86400);
if (interval > 1) {
return `${interval} days ago`;
}
if (interval === 1) {
return `${interval} day ago`;
}
interval = Math.floor(seconds / 3600);
if (interval > 1) {
return `${interval} hours ago`;
}
if (interval === 1) {
return `${interval} hour ago`;
}
interval = Math.floor(seconds / 60);
return `${interval} minutes ago`;
}

@@ -39,0 +39,0 @@ function format_release(release) {

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