New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

harcon

Package Overview
Dependencies
Maintainers
1
Versions
326
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

harcon - npm Package Compare versions

Comparing version 0.6.10 to 0.7.0

12

lib/Barrel.js

@@ -23,3 +23,3 @@ var async = require('async');

barrel.affiliate = function( firestarter ){
this.logger.debug('Affiliate: ', firestarter.name, firestarter.event || firestarter.events );
this.logger.harconlog( null, 'Affiliate', { name: firestarter.name, events: firestarter.event || firestarter.events } );

@@ -40,6 +40,6 @@ this.firestarters.push( firestarter );

this.logger.debug('Appeasing', err, responseComms );
this.logger.harconlog( err, 'Appeasing', { responseComms: responseComms } );
if( err )
return this.logger.error('Error occurred: ', err );
return this.logger.harconlog( err );

@@ -63,3 +63,3 @@ _.each( self.firestarters, function( fs ){

if( matching.length === 0 )
return this.logger.warn('Nobody is listening', comm);
return this.logger.harconlog( null, 'Nobody is listening', {comm: comm }, 'warn');

@@ -70,3 +70,3 @@ var self = this;

return function( cb ){
self.logger.debug('Emitting', fs.name, comm );
self.logger.harconlog( null, 'Emitting', { name: fs.name, comm: comm } );
fs.burn( comm, cb );

@@ -77,3 +77,3 @@ };

function(err, results){
self.logger.debug('Emitted with: ', err, results);
self.logger.harconlog( err, 'Emitted with: ', { results: results } );

@@ -80,0 +80,0 @@ if( comm.callback )

@@ -30,12 +30,3 @@ var _ = require('lodash');

/**
* Matches the emited event with the interest of the entity encapsulated by this firestarter
*
* @method matches
* @param {String} eventName Tells if the given firestarter is listening to the given event
* @return {Boolean} Returns true on matching
*/
firestarter.matches = function( eventName ){
this.logger.debug('Matching: ', this.event, eventName );
firestarter.innermatches = function( eventName ){
if( this.event === '*' )

@@ -60,3 +51,17 @@ return true;

};
/**
* Matches the emited event with the interest of the entity encapsulated by this firestarter
*
* @method matches
* @param {String} eventName Tells if the given firestarter is listening to the given event
* @return {Boolean} Returns true on matching
*/
firestarter.matches = function( eventName ){
var matches = this.innermatches( eventName );
this.logger.harconlog(null, 'Matching: ', {event: this.event, eventName: eventName, matches: matches}, 'silly' );
return matches;
};
firestarter.appease = function( comm, responseComms ){

@@ -93,3 +98,3 @@ if( this.comms[ comm.id ] ){

this.logger.debug('Burning: ', comm );
this.logger.harconlog(null, 'Burning: ', {comm: comm} );

@@ -119,3 +124,3 @@ self.fn.apply(

this.logger.debug('Initiate ignition: ', comm );
this.logger.harconlog(null, 'Initiate ignition: ', {comm: comm} );

@@ -145,3 +150,3 @@ if( comm.callback )

this.logger.debug('Igniting: ', newComm, comm );
this.logger.harconlog( null, 'Igniting: ', {newComm: newComm, comm: comm} );

@@ -148,0 +153,0 @@ if( newComm.callback )

@@ -38,8 +38,10 @@ var _ = require('lodash');

firestorm.matches = function( eventName ){
this.logger.debug('Matching: ', this.events, eventName );
var index = eventName.lastIndexOf( '.' );
if( index === -1 ){ index = eventName.length; }
return index === -1 ? _.contains(this.events, eventName) : ( this.context === eventName.substring(0,index) && _.contains(this.events, eventName.substring(index+1) ) );
var matches = index === -1 ? _.contains(this.events, eventName) : ( this.context === eventName.substring(0,index) && _.contains(this.events, eventName.substring(index+1) ) );
this.logger.harconlog( null, 'Matching: ', {events: this.events, eventName: eventName, matches: matches}, 'silly' );
return matches;
};

@@ -57,3 +59,3 @@

this.logger.debug('Burning: ', comm );
this.logger.harconlog(null, 'Burning: ', {comm: comm} );

@@ -60,0 +62,0 @@ var index = comm.event.lastIndexOf( '.' );

@@ -8,2 +8,24 @@ var _ = require('lodash');

var VERSION = exports.VERSION = '0.7.0';
var winston = require('winston');
var harconlog = function( err, message, obj, level ){
this.log( err ? 'error' : (level || 'debug'), err ? err.message : message, _.extend( obj || {}, { 'harcon': VERSION } ) );
};
var createWinstonLogger = function( options ){
options = options || {};
if( options.exceptionFile )
winston.handleExceptions(new winston.transports.File({ filename: options.exceptionFile }));
var transports = [
new (winston.transports.Console)({ level: 'error', colorize: 'true' }),
new (winston.transports.File)( {
filename: options.file || 'server.log',
level: options.level || 'info',
maxsize: options.maxSize || 1000000,
maxFiles: options.maxFiles || 1
} )
];
return new (winston.Logger)({ transports: transports });
};
/**

@@ -18,6 +40,6 @@ * Main control point of the messaging subsystem

this.name = this.options.name || 'Inflicter';
this.logger = this.options.logger || {
debug: function(){},
warn: function(){}
};
this.logger = this.options.logger ? ( this.options.logger.level ? createWinstonLogger( this.options.logger ) : this.options.logger ) : createWinstonLogger( {} );
this.logger.harconlog = harconlog.bind( this.logger );
this.barrel = new Barrel( this.logger );

@@ -24,0 +46,0 @@

{
"name": "harcon",
"version": "0.6.10",
"version": "0.7.0",
"description": "Messaging/Service Bus for the harmonic convergence of node-based enterprise entities.",

@@ -31,3 +31,4 @@ "keywords": [

"clerobee": "latest",
"lodash": "latest"
"lodash": "latest",
"winston": "latest"
},

@@ -40,4 +41,3 @@ "devDependencies": {

"gulp-mocha": "latest",
"gulp-yuidoc": "latest",
"winston": "latest"
"gulp-yuidoc": "latest"
},

@@ -47,3 +47,3 @@ "engines": {

},
"_id": "harcon@0.6.10"
"_id": "harcon@0.7.0"
}
var chai = require("chai");
var should = chai.should();
var expect = chai.expect;
var winston = require('winston');
var _ = require("lodash");
var logger = new (winston.Logger)({
transports: [
new (winston.transports.Console)( { level: 'debug' } )
]
});
var Inflicter = require('../lib/Inflicter');
describe("harcon", function () {
var inflicter;

@@ -21,3 +14,3 @@ var marie, julie;

before(function(done){
inflicter = new Inflicter( { logger: logger, idLength: 32 } );
inflicter = new Inflicter( { logger: { file: 'test.log', level: 'debug' }, idLength: 32 } );

@@ -40,3 +33,2 @@ inflicter.addict('peter', 'greet.*', function(greetings1, greetings2, callback){

var marieFS = inflicter.addicts( marie );
console.log( marieFS.burst );

@@ -43,0 +35,0 @@ julie = {

Sorry, the diff of this file is not supported yet

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