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

bograch

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bograch - npm Package Compare versions

Comparing version 0.0.9 to 0.0.10

bograch-0.0.10.tgz

9

lib/client.js

@@ -64,9 +64,2 @@ 'use strict';

if (methodName == 'methodList') {
console.log('---||---');
console.log(arguments);
console.log(args);
console.log(cb);
}
var publicMethodName = createPublicMethodName(this._name, methodName);

@@ -83,3 +76,3 @@ this._transporter.call(publicMethodName, args, cb);

this.methods[method] = function () {
var args = [method].concat(arguments);
var args = [method].concat(Array.prototype.slice.call(arguments));
this.call.apply(this, args);

@@ -86,0 +79,0 @@ }.bind(this);

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

this._transporter.on(publicMethodName, function (args, cb) {
args.push(cb);
args.push(cb || function () {});
method.apply({}, args);

@@ -46,0 +46,0 @@ });

{
"name": "bograch",
"version": "0.0.9",
"version": "0.0.10",
"description": "A communication gateway for NodeJS microservices.",

@@ -10,2 +10,3 @@ "main": "./lib",

"keywords": [
"bograch",
"microservice",

@@ -16,2 +17,6 @@ "node",

"author": "Zoltan Kochan",
"repository": {
"type": "git",
"url": "git://github.com/zkochan/bograch.git"
},
"license": "MIT",

@@ -18,0 +23,0 @@ "devDependencies": {

@@ -64,2 +64,20 @@ 'use strict';

describe('method', function () {
it('should pass argumets to transporter', function (done) {
boClient.register(['fooBar']);
transporter._onCall.push(function (method, args, cb) {
expect(method).to.be.equal('test.fooBar');
expect(args.length).to.be.equal(3);
expect(args[0]).to.be.equal(1);
expect(args[1]).to.be.equal(2);
expect(args[2]).to.be.equal(3);
expect(typeof cb).to.be.equal('function');
done();
transporter._onCall.pop();
});
boClient.methods.fooBar(1, 2, 3, noop);
});
});
describe('proxy', function () {

@@ -66,0 +84,0 @@ it('returned by the server', function (done) {

'use strict';
var Server = require('../lib/server');
var Client = require('../lib/client');
var expect = require('chai').expect;

@@ -37,2 +38,18 @@ var TransporterMock = require('./transporter-mock');

});
});
describe('Bograch client/server communication', function () {
var boClient = new Client(transporter, {
name: 'test'
});
it('should pass all the arguments', function (done) {
boServer.on('sum', function (a, b, cb) {
expect(a).to.be.equal(32);
expect(b).to.be.equal(54);
expect(typeof cb).to.be.equal('function');
done();
});
boClient.call('sum', 32, 54);
});
});

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

this._methods = {};
this._onCall = [];
}

@@ -14,2 +15,5 @@

Transporter.prototype.call = function (method, args, cb) {
this._onCall.forEach(function (fn) {
fn(method, args, cb);
});
if (this._methods[method]) {

@@ -16,0 +20,0 @@ this._methods[method](args, cb);

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