Huge News!Announcing our $40M Series B led by Abstract Ventures.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 1.0.7 to 1.1.0

31

lib/Firestarter.js

@@ -12,2 +12,19 @@ var Communication = require('./Communication');

var STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg;
var ARGUMENT_NAMES = /([^\s,]+)/g;
function parameterNames( func ) {
var fnStr = func.toString().replace(STRIP_COMMENTS, '');
var result = fnStr.slice(fnStr.indexOf('(')+1, fnStr.indexOf(')')).match(ARGUMENT_NAMES);
if(result === null)
result = [];
return result;
}
function isLast(array, value){
var element = array.pop();
var found = Array.isArray(value) ? value.indexOf(element)>-1 : element===value;
if( !found )
array.push( element );
return found;
}
/**

@@ -39,3 +56,17 @@ * Firestarter is an abstract type to define a wrapper for listeners

firestarter.parameters = function( service ){
throw new Error('To be implemented...');
};
firestarter.parametersOf = function( fn ){
if( !fn ) return null;
var params = parameterNames( fn );
if( params.length === 0 ) return params;
var found = isLast( params, ['callback','cb'] ) || isLast( params, 'ignite' ) || isLast( params, 'terms' );
return params;
};
/**

@@ -42,0 +73,0 @@ * Validates division of an incoming message

4

lib/Firestormstarter.js

@@ -65,2 +65,6 @@ var Firestarter = require('./Firestarter');

firestorm.parameters = function( service ){
return this.parametersOf( this.object[service] );
};
firestorm.matches = function( division, eventName ){

@@ -67,0 +71,0 @@ if( !this.sameDivision( division ) ) return false;

@@ -50,2 +50,6 @@ var Communication = require('./Communication');

flamestarter.parameters = function( service ){
return this.parametersOf( this.fn );
};
flamestarter.innerMatches = function( eventName ){

@@ -52,0 +56,0 @@ if( this.event === '*' )

2

lib/Inflicter.js

@@ -8,3 +8,3 @@ var Communication = require('../lib/Communication');

var VERSION = exports.VERSION = '1.0.7';
var VERSION = exports.VERSION = '1.1.0';

@@ -11,0 +11,0 @@ var _ = require('lodash');

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

@@ -49,3 +49,3 @@ "keywords": [

},
"_id": "harcon@1.0.7"
"_id": "harcon@1.1.0"
}

@@ -219,2 +219,20 @@ Harcon - Messaging/Service Bus for the harmonic convergence of node-based enterprise entities or in-browser communication between web components

That logger instance will be used as logging facility all over the system, including internal services and entities.
Each entity receives a function: _harconlog_ with the signature:
```javascript
function( err, message, obj, level ){ ... }
```
That function can be used anything within your entity object:
```javascript
var Marie = {
name: 'Marie',
context: 'greet',
whiny: function (greetings, callback) {
this.harconlog( null, 'Some logging', { data: greetings }, 'silly' );
callback( null, 'Pas du tout!' );
}
};
```
That function should be used for any logging activity you need during the flow of your app.
#### Unique messages

@@ -307,2 +325,26 @@

## Entity configuration
Entities can be configured easily. The _init_ method of an entity if present, will be called at the end of its publishing process withing the [harcon](https://github.com/imrefazekas/harcon).
The function can be used to set up DB connections or anything required for your entities.
```javascript
module.exports = {
name: 'Claire',
context: 'greet',
init: function (options, callback) {
console.log('Init...', options);
callback();
}
};
```
The method receives a configuration object and a callback to be called when the init method finishes.
That configuration object can be passed when an entity is published:
```javascript
inflicter.addicts( Claire, config );
```
or even before, when [harcon](https://github.com/imrefazekas/harcon) is created.
```javascript
inflicter = new Inflicter( { logger: logger, idLength: 32, Claire: {greetings: 'Hi!'} } );
```
## Extension

@@ -358,2 +400,4 @@

- 1.0.X : serious fixes
- 1.0.0 : first stable release
- 0.9.0 : small redesign to allow to use in a Browserify/Webpack environment

@@ -360,0 +404,0 @@ - 0.8.0 : automated (re/un)deployment added, rewritten event coordination subsystem

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