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.0 to 1.0.1

90

lib/ES6Fixer.js

@@ -1,37 +0,51 @@

if( !Array.prototype.remove )
Array.prototype.remove = function( obj ){
var idx = this.findIndex( obj );
if( idx > -1 )
this.splice( idx, 1 );
return this;
};
if (!Array.prototype.contains)
Array.prototype.contains = function (object) {
for (var i = 0; i < this.length; i += 1) {
if (object === this[i]) return true;
/* jshint bitwise: false */
if (!Array.prototype.remove) {
Object.defineProperty(Array.prototype, 'remove', {
enumerable: false,
configurable: false,
writable: false,
value: function (obj) {
var idx = this.indexOf(obj);
if (idx > -1)
this.splice(idx, 1);
return this;
}
return false;
};
if (!Array.prototype.find)
Array.prototype.find = function (fn) {
for (var i = 0; i < this.length; i += 1) {
if (fn(this[i], i, this)) return this[i];
});
}
if (!Array.prototype.contains) {
Object.defineProperty(Array.prototype, 'contains', {
enumerable: false,
configurable: false,
writable: false,
value: function (object) {
for (var i = 0; i < this.length; i += 1) {
if (object === this[i]) return true;
}
return false;
}
return null;
};
if (!Array.prototype.findIndex)
Array.prototype.findIndex = function (fn) {
for (var i = 0; i < this.length; i += 1) {
if (fn(this[i], i, this)) return i;
});
}
if (!Array.prototype.find) {
Object.defineProperty(Array.prototype, 'find', {
enumerable: false,
configurable: false,
writable: false,
value: function (fn) {
for (var i = 0; i < this.length; i += 1) {
if (fn(this[i], i, this)) return this[i];
}
return null;
}
return -1;
};
if (!String.prototype.startsWith) {
Object.defineProperty(String.prototype, 'startsWith', {
venumerable: false,
});
}
if (!Array.prototype.findIndex) {
Object.defineProperty(Array.prototype, 'findIndex', {
enumerable: false,
configurable: false,
writable: false,
value: function(searchString, position) {
position = position || 0;
return this.lastIndexOf(searchString, position) === position;
value: function (fn) {
for (var i = 0; i < this.length; i += 1) {
if (fn(this[i], i, this)) return i;
}
return -1;
}

@@ -42,2 +56,5 @@ });

Object.defineProperty(String.prototype, 'endsWith', {
enumerable: false,
configurable: false,
writable: false,
value: function (searchString, position) {

@@ -53,2 +70,13 @@ var subjectString = this.toString();

});
}
if (!String.prototype.startsWith) {
Object.defineProperty(String.prototype, 'startsWith', {
enumerable: false,
configurable: false,
writable: false,
value: function (searchString, position) {
position = position || 0;
return this.lastIndexOf(searchString, position) === position;
}
});
}

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

var VERSION = exports.VERSION = '1.0.0';
var VERSION = exports.VERSION = '1.0.1';

@@ -11,0 +11,0 @@ function extend(obj, extension){

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

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

},
"_id": "harcon@1.0.0"
"_id": "harcon@1.0.1"
}

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

__!Note__: To use in browser, a CommonJS-enabled packager has to be applied like [browserify](http://browserify.org) or [webpack](http://webpack.github.io).
__!Note__: To use in browser, a CommonJS-enabled packager has to be applied like [browserify](http://browserify.org) or [webpack](http://webpack.github.io) or [jspm](http://jspm.io).

@@ -45,3 +45,3 @@ This library starts to shine in a highly structured and distributed environment.

// define a listener function listening every message withing the context "greet"
// define a listener function listening every message related to "greet" like "greet.goodmorning" or "greet.goodday"
inflicter.addict( null, 'peter', 'greet.*', function(greetings1, greetings2, callback){

@@ -89,2 +89,4 @@ callback(null, 'Hi there!');

#### Entities
In [harcon](https://github.com/imrefazekas/harcon), the communication unit is called simple entity.
One can define 2 type of entities:

@@ -127,5 +129,40 @@ - simple function: when you associate a function with an event-pattern. Recommended to be used as observer, job-like, surveillance-, or interface-related asset.

```
The name of every entity must be unique. Entities belong to a context as defined above. A context might be associatd to multiple entities depending on you orchestration.
Every function within an entity will be considered as service and can be called using the 'context' + 'functionName' pair.
#### Orchestration
Basically, you define service functions which can be called through its name (object-based entity) or expression evaluation (function-based entity). When you orchestrate a complex system, you define object-based entities providing functions to be called.
There are 2 orthogonal ways to orchestrate such entities in your system.
__Context__: a qualified name identifying the field/purpose the entity is operating. For example an entity parsing incoming JSON document can have the context "transfer" answering communications addressed to "transfer.parse" where __parse__ is the function provided by that entity. Within a given context, multiple entitiy can answer a communication with a given name.
```javascript
var parser = {
name: 'JSONParser',
context: 'transfer',
parse: function( document, callback ){
callback( null, 'Done.' );
}
};
var observer = {
name: 'Observer',
context: 'transfer',
parse: function( document, callback ){
callback( null, null );
}
};
```
Sending a message "transfer.parse" will be interpreted as follows:
context: "transfer"
functionSelector: "parse"
The entities published in the context "transfer" possessin the function "parse" will be notified and their service function will be invoked.
A context might contain subcontexts depending on the complexity of your system.
__Division__: divisions is a diffferent angle of orchestrating entities. A division is a closed "box" of entities, meaning that an entity can operate only within the division it is member of. Every entity belongs to a division. Divisions can be encapsulated, so a complete division-tree can be built-up in a harcon application. The reason why divisions are important, because it represents a responsibility unit. Entities within it (in normal cases) cannot see outside and an entity published to a container division can answer to messages initiated by an entity somewhere lower in the tree. This gives you a control to define surveillance-like or control-like features and much higher complexity of communication-management.
_Note_: these features are not mandatory to be used. The complexity will tell you how to orchestrate. If you only need function-based simple entities, feel free to go along with them. If you need to implement a highly structured money transaction management system in a financial environment, those features above will be urged to be defined.
#### Chain messages

@@ -132,0 +169,0 @@

@@ -12,2 +12,2 @@ module.exports = {

}
};
};
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