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

clever-tools

Package Overview
Dependencies
Maintainers
6
Versions
146
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

clever-tools - npm Package Compare versions

Comparing version 1.5.0-beta.6 to 1.5.0-beta.7

6

CHANGELOG.md
# clever-tools changelog
## 1.5.0-beta.7 (2019-08-23)
- Use new @clevercloud/client auto-retry streams (logs & events)
- Fix "opn" module renamed to "open"
- Fix split error on logger
## 1.5.0-beta.6 (2019-08-02)

@@ -4,0 +10,0 @@

6

package.json
{
"name": "clever-tools",
"version": "1.5.0-beta.6",
"version": "1.5.0-beta.7",
"description": "Command Line Interface for Clever Cloud.",

@@ -27,3 +27,3 @@ "main": "bin/clever.js",

"dependencies": {
"@clevercloud/client": "2.0.0-beta.1",
"@clevercloud/client": "2.0.0-beta.3",
"baconjs": "^0.7.83",

@@ -44,3 +44,3 @@ "cliparse": "^0.3.1",

"update-notifier": "^3.0.1",
"ws": "^7.1.1",
"ws": "^7.1.2",
"xdg": "^0.1.1"

@@ -47,0 +47,0 @@ },

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

const colors = require('colors/safe');
const opn = require('opn');
const open = require('open');
const superagent = require('superagent');

@@ -62,3 +62,3 @@

Logger.println(`Opening ${colors.green(consoleUrl.toString())} in your browser to log you in…`);
await opn(consoleUrl.toString(), { wait: false });
await open(consoleUrl.toString(), { wait: false });

@@ -65,0 +65,0 @@ return pollOauthData(cliPollUrl.toString());

@@ -25,3 +25,3 @@ 'use strict';

const blankPrefix = _.repeat(' ', prefixLength);
return _(lines)
return (lines || '')
.split('\n')

@@ -28,0 +28,0 @@ .map((line, i) => (i === 0) ? line : `${blankPrefix}${line}`)

'use strict';
const _ = require('lodash');
const Bacon = require('baconjs');
const { openWsStream } = require('./ws-stream.js');
const { getHostAndTokens } = require('./send-to-api.js');
const { prepareEventsWs } = require('@clevercloud/client/cjs/stream.node.js');
const { EventsStream } = require('@clevercloud/client/cjs/streams/events.node.js');
function getEvents (api, appId) {
return Bacon
.fromPromise(getHostAndTokens().then((params) => prepareEventsWs({ ...params, appId })))
.flatMapLatest(openWsStream)
.flatMapLatest(Bacon.try((rawEvent) => {
const event = JSON.parse(rawEvent);
const data = (event.data != null)
? JSON.parse(event.data)
: null;
return { ...event, data };
}))
.filter((event) => {
return _.get(event, 'data.id ') === appId
|| _.get(event, 'data.appId') === appId;
.fromPromise(getHostAndTokens())
.flatMapLatest(({ apiHost, tokens }) => {
return Bacon.fromBinder((sink) => {
const eventsStream = new EventsStream({ apiHost, tokens, appId });
return eventsStream.openResilientStream({
onMessage: sink,
onError: (error) => sink(new Bacon.Error(error)),
infinite: false,
retryDelay: 2000,
retryTimeout: 30000,
});
});
});

@@ -27,0 +23,0 @@ };

@@ -6,3 +6,2 @@ 'use strict';

const colors = require('colors/safe');
const EventSource = require('eventsource');

@@ -12,6 +11,6 @@ const Application = require('../models/application.js');

const Logger = require('../logger.js');
const { sendToApi, getHostAndTokens } = require('./send-to-api.js');
const { sendToApi, getHostAndTokens } = require('./send-to-api.js');
const { getOldLogs: fetchOldLogs } = require('@clevercloud/client/cjs/api/log.js');
const { prepareLogsSse } = require('@clevercloud/client/cjs/stream.node.js');
const { LogsStream } = require('@clevercloud/client/cjs/streams/logs.node.js');

@@ -22,15 +21,15 @@ function getNewLogs (appId, before, after, filter, deploymentId) {

return Bacon
.fromBinder((sink) => {
getHostAndTokens()
.then((params) => prepareLogsSse({ ...params, appId, filter, deploymentId }))
.then(({ url }) => {
const sse = new EventSource(url);
sse.onmessage = ({ data }) => sink(data);
sse.onerror = () => {
Logger.debug('Logs stream connection failure');
return sink(new Bacon.Error('Logs stream connection failure'));
};
.fromPromise(getHostAndTokens())
.flatMapLatest(({ apiHost, tokens }) => {
return Bacon.fromBinder((sink) => {
const logsStream = new LogsStream({ apiHost, tokens, appId, filter, deploymentId });
return logsStream.openResilientStream({
onMessage: sink,
onError: (error) => sink(new Bacon.Error(error)),
infinite: false,
retryDelay: 2000,
retryTimeout: 30000,
});
});
})
.flatMap(Bacon.try(JSON.parse))
.filter((line) => {

@@ -37,0 +36,0 @@ const lineDate = Date.parse(line._source['@timestamp']);

'use strict';
const Bacon = require('baconjs');
const opn = require('opn');
const open = require('open');

@@ -10,5 +10,5 @@ const Logger = require('./logger.js');

Logger.debug('Opening browser');
return Bacon.fromPromise(opn(url, { wait: false }));
return Bacon.fromPromise(open(url, { wait: false }));
}
module.exports = { openPage };
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