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

harcon-radiation

Package Overview
Dependencies
Maintainers
1
Versions
235
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

harcon-radiation - npm Package Compare versions

Comparing version 2.1.1 to 2.5.0

test/Invisible.js

6

lib/DefaultConfig.js

@@ -15,2 +15,8 @@ var attributesRespected = [ 'user', 'files' ];

inboundShifts: false,
mimesis: {
enabled: false,
name: 'Nimesis',
rest: true,
websocket: true
},
rest: {

@@ -17,0 +23,0 @@ closeRest: false,

4

lib/ext/Rester.js

@@ -62,2 +62,6 @@ var Clerobee = require('clerobee');

if( self.options.mimesis ){
}
self.toREST.forEach( function( reference ){

@@ -64,0 +68,0 @@ self.options.logger.radiationlog( null, 'Posteriorly executed publishing for REST...', { name: reference.firestarter.name }, self.options.logLevel );

@@ -85,2 +85,5 @@ 'use strict';

if( self.options.mimesis ){
}
self.toWebsocket.forEach( function( reference ){

@@ -87,0 +90,0 @@ self.options.logger.radiationlog( null, 'Posteriorly executed publishing for Websocket...', { name: reference.firestarter.name }, self.options.logLevel );

var ES7 = require('./ES7Fixer');
var async = require('async');
var _ = require('isa.js');

@@ -9,3 +11,3 @@ var assigner = require('assign.js');

var VERSION = exports.VERSION = '2.1.0';
var VERSION = exports.VERSION = '2.5.0';

@@ -85,2 +87,38 @@ var DefaultConfig = require('./DefaultConfig');

this.divisions = {};
if( self.options.mimesis && self.options.mimesis.enabled ){
var readEntity = function( entityDef, callback ){
try{
var Module = module.constructor;
var m = new Module();
m._compile(entityDef, 'Nimesis.js');
self.mimicEntity = inflicter.addicts( m.exports, {}, callback );
}
catch( err ){ callback(err); }
};
self.mimesis = inflicter.addicts( {
name: self.options.mimesis.name || 'Nimesis',
rest: !!self.options.mimesis.rest,
websocket: !!self.options.mimesis.websocket,
mimic: function( entityDef, terms, ignite, callback ){
var fns = [];
if( self.mimicEntity )
fns.push( function(cb){
self.inflicter.detracts( self.mimicEntity, cb );
self.mimicEntity = null;
} );
fns.push( function(cb){
readEntity( entityDef, cb );
} );
async.series( fns, function( err, res ){
callback(err, 'Done.');
} );
}
} );
}
}

@@ -87,0 +125,0 @@

7

package.json
{
"name": "harcon-radiation",
"version": "2.1.1",
"version": "2.5.0",
"description": "REST and Websocket plugin for harcon",

@@ -26,6 +26,7 @@ "keywords": [

"dependencies": {
"assign.js": "^0.1.1",
"assign.js": "^0.2.0",
"async": "^1.5.2",
"clerobee": "latest",
"connect-rest": "~2",
"harcon": ">=2.10.0",
"harcon": "^2.10.1",
"isa.js": "~1",

@@ -32,0 +33,0 @@ "socket.io": "~1"

@@ -191,2 +191,17 @@ Harcon-Radiation - An extension to the [harcon](https://github.com/imrefazekas/harcon) library to automatically expose selected entities through REST and/or Websocket.

## Nimesis
Nimesis is a built-in entity of [harcon-radiation](https://github.com/imrefazekas/harcon-radiation) providing one single service:
```javascript
mimic: function( entityDef ... callback ){
```
It accepts harcon entity definitions as string and converts them to entity definitions then publishes it according its configuration. By default, all services will be exposed through REST and Websockets as well.
Serves well when dynamic extension or ability to publish services on-the-fly is a requirement.
The Nimesis Will hold only 1 definition as reference. When a new definition incomes, the previous one will be destructed.
Note: this feature is serving special purposes, use it with adequate caution.
## License

@@ -193,0 +208,0 @@

@@ -25,2 +25,3 @@ var chai = require('chai'),

var fs = require('fs');
var path = require('path');

@@ -36,3 +37,4 @@ var Publisher = require('./Publisher');

rest: { jsonrpcPath: '/RPCTwo', harconrpcPath: '/Harcon' },
websocket: { socketPath: '/KingSocket', jsonrpcPath: '/RPCTwo' }
websocket: { socketPath: '/KingSocket', jsonrpcPath: '/RPCTwo' },
mimesis: { enabled: true }
} );

@@ -233,2 +235,16 @@ radiation.listen( {

});
it('Mimic-test', function(done){
var invisibleDef = fs.readFileSync( path.join(__dirname, 'Invisible.js'), 'utf8' );
httphelper.generalCall( 'http://localhost:8080/King/Nimesis/mimic', 'POST', {'x-api-key': '849b7648-14b8-4154-9ef2-8d1dc4c2b7e9'}, null, { params: [ invisibleDef ] }, 'application/json', logger, function(err, result, status){
should.not.exist(err);
httphelper.generalCall( 'http://localhost:8080/King/Invisible/greet', 'POST', {'x-api-key': '849b7648-14b8-4154-9ef2-8d1dc4c2b7e9'}, null, { params: [ 'Hello!' ] }, 'application/json', logger, function(err, result, status){
should.not.exist(err);
expect( result ).to.include( 'Hello!' );
done( );
} );
} );
});
});

@@ -235,0 +251,0 @@

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