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

horpyna

Package Overview
Dependencies
Maintainers
1
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

horpyna - npm Package Compare versions

Comparing version 0.7.4 to 0.7.5

49

dist/index.js

@@ -147,3 +147,3 @@ require("source-map-support").install();

value: function onProcess(request, response) {
response.send(request.input);
response.send(request.data);
}

@@ -159,5 +159,5 @@

key: "run",
value: function run(input, endCallback) {
value: function run(inputData, endCallback) {
this.rootComponent.run(endCallback);
this._runProcess([input]);
this._runProcess([inputData]);
}

@@ -171,3 +171,3 @@

key: "_runProcess",
value: function _runProcess(inputList) {
value: function _runProcess(inputDataList) {
var _this = this;

@@ -177,3 +177,3 @@

setTimeout(function () {
return _this.onProcess(new _request2.default(inputList), new _response2.default(_this));
return _this.onProcess(new _request2.default(inputDataList), new _response2.default(_this));
}, 0);

@@ -191,3 +191,3 @@ }

if (this.parentChannelManager.isDone()) {
this._runProcess(this.parentChannelManager.getOutput());
this._runProcess(this.parentChannelManager.getChannelsData());
}

@@ -400,3 +400,3 @@ }

this.connectedChildrenComponents = [];
this.output = null;
this.data = null;
}

@@ -460,6 +460,6 @@

}, {
key: "getOutput",
value: function getOutput() {
key: "getChannelsData",
value: function getChannelsData() {
return this.channels.map(function (channel) {
return channel.output;
return channel.data;
});

@@ -510,2 +510,7 @@ }

/**
* Object which is passed to component onProcess method.
* It allow to set responses to channels of components and then pass it to child components in Request
*/
var Response = function () {

@@ -523,3 +528,3 @@ function Response(component) {

channel.status = STATUS.INIT;
channel.output = null;
channel.data = null;
});

@@ -529,3 +534,3 @@ }

key: "prepare",
value: function prepare(output, channelName) {
value: function prepare(data, channelName) {
if (this.component.rootComponent.status === STATUS.PROCESS) {

@@ -535,3 +540,3 @@ channelName = channelName || CHANNEL.DEFAULT_CHANNEL;

channel.status = STATUS.DONE;
channel.output = output;
channel.data = data;
}

@@ -569,5 +574,5 @@ }

key: "send",
value: function send(output, channelName) {
value: function send(data, channelName) {
this.init();
this.prepare(output, channelName);
this.prepare(data, channelName);
this.done();

@@ -605,6 +610,16 @@ }

var Request = function Request(outputList) {
/**
* Request object which is passed to component onProcess method.
* It contains calculated data from parent components channels
*/
var Request =
/**
*
* @param data array from parent components channels which are bind to this component
*/
function Request(data) {
_classCallCheck(this, Request);
this.input = outputList;
this.data = data;
};

@@ -611,0 +626,0 @@

{
"name": "horpyna",
"version": "0.7.4",
"version": "0.7.5",
"description": "utility to manage async processes",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -9,3 +9,3 @@ import * as STATUS from "../constants/statuses";

this.connectedChildrenComponents = [];
this.output = null;
this.data = null;
}

@@ -12,0 +12,0 @@

@@ -30,3 +30,3 @@ import Root from "./root";

onProcess(request, response) {
response.send(request.input);
response.send(request.data);
}

@@ -39,5 +39,5 @@

*/
run(input, endCallback) {
run(inputData, endCallback) {
this.rootComponent.run(endCallback);
this._runProcess([input]);
this._runProcess([inputData]);
}

@@ -48,5 +48,5 @@

*/
_runProcess(inputList) {
_runProcess(inputDataList) {
this.status = STATUS.PROCESS;
setTimeout(() => this.onProcess(new Request(inputList), new Response(this)), 0);
setTimeout(() => this.onProcess(new Request(inputDataList), new Response(this)), 0);
}

@@ -60,3 +60,3 @@

if (this.parentChannelManager.isDone()) {
this._runProcess(this.parentChannelManager.getOutput());
this._runProcess(this.parentChannelManager.getChannelsData());
}

@@ -63,0 +63,0 @@ }

@@ -13,4 +13,4 @@ import Channel from "./channel";

getOutput() {
return this.channels.map(channel => channel.output);
getChannelsData() {
return this.channels.map(channel => channel.data);
}

@@ -17,0 +17,0 @@

@@ -0,4 +1,12 @@

/**
* Request object which is passed to component onProcess method.
* It contains calculated data from parent components channels
*/
class Request {
constructor(outputList) {
this.input = outputList;
/**
*
* @param data array from parent components channels which are bind to this component
*/
constructor(data) {
this.data = data;
}

@@ -5,0 +13,0 @@ }

import * as STATUS from "../constants/statuses";
import * as CHANNEL from "../constants/channels";
/**
* Object which is passed to component onProcess method.
* It allow to set responses to channels of components and then pass it to child components in Request
*/
class Response {

@@ -12,7 +16,7 @@ constructor(component) {

channel.status = STATUS.INIT;
channel.output = null;
channel.data = null;
});
}
prepare(output, channelName) {
prepare(data, channelName) {
if(this.component.rootComponent.status === STATUS.PROCESS) {

@@ -22,3 +26,3 @@ channelName = channelName || CHANNEL.DEFAULT_CHANNEL;

channel.status = STATUS.DONE;
channel.output = output;
channel.data = data;
}

@@ -48,5 +52,5 @@ }

send(output, channelName) {
send(data, channelName) {
this.init();
this.prepare(output, channelName);
this.prepare(data, channelName);
this.done();

@@ -53,0 +57,0 @@ }

@@ -31,3 +31,3 @@ import sinon from "sinon";

expect(spyCustomFunc.calledBefore(spyComponent)).to.be.true;
expect(channelList[0].output).to.be.equal(TEST_MESSAGE_A);
expect(channelList[0].data).to.be.equal(TEST_MESSAGE_A);
done();

@@ -64,3 +64,3 @@ });

expect(spyCustomFunc.calledBefore(spyComponent)).to.be.true;
expect(channelList[0].output).to.be.equal(TEST_MESSAGE_B);
expect(channelList[0].data).to.be.equal(TEST_MESSAGE_B);
done();

@@ -75,4 +75,4 @@ });

expect(channelList.length).to.be.equal(1);
expect(channelList[0].output.length).to.be.equal(1);
expect(channelList[0].output[0]).to.be.equal(TEST_MESSAGE_A);
expect(channelList[0].data.length).to.be.equal(1);
expect(channelList[0].data[0]).to.be.equal(TEST_MESSAGE_A);
done();

@@ -86,3 +86,3 @@ });

onProcess(request, response) {
response.send(request.input[0]);
response.send(request.data[0]);
}

@@ -92,3 +92,3 @@ };

onProcess(request, response) {
expect(request.input[0]).to.be.equal(TEST_MESSAGE_A);
expect(request.data[0]).to.be.equal(TEST_MESSAGE_A);
response.send();

@@ -103,3 +103,3 @@ done();

it("next component should have request object with string input and count 1 if one parent send response", done => {
it("next component should have request object with data property and count 1 if one parent send response", done => {
let componentParent = new class extends Horpyna.Component {

@@ -112,4 +112,4 @@ onProcess(request, response) {

onProcess(request, response) {
expect(request.input[0]).to.be.equal(TEST_MESSAGE_A);
expect(request.input.length).to.be.equal(1);
expect(request.data[0]).to.be.equal(TEST_MESSAGE_A);
expect(request.data.length).to.be.equal(1);
done();

@@ -123,3 +123,3 @@ }

it("next component should have request object with string array input and count 2 if one parent send response", done => {
it("next component should have request object with data array property and count 2 if one parent send response", done => {
let componentGrandParent = new class extends Horpyna.Component {

@@ -142,3 +142,3 @@ onProcess(request, response) {

onProcess(request, response) {
expect(request.input.length).to.be.equal(2);
expect(request.data.length).to.be.equal(2);
done();

@@ -280,3 +280,3 @@ }

spyB();
expect(request.input[0]).to.be.equal(TEST_MESSAGE_A);
expect(request.data[0]).to.be.equal(TEST_MESSAGE_A);
response.send();

@@ -309,3 +309,3 @@ }

onProcess(request, response) {
if (request.input[0]) {
if (request.data[0]) {
spyAB();

@@ -312,0 +312,0 @@ response.send(null, CHANNEL_AB);

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