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

@orion-js/echoes

Package Overview
Dependencies
Maintainers
2
Versions
123
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@orion-js/echoes - npm Package Compare versions

Comparing version 2.1.0 to 2.2.1

lib/echo/types.js

18

lib/echo/index.js

@@ -8,7 +8,9 @@ "use strict";

});
exports.default = _default;
exports.default = void 0;
var _deserialize = _interopRequireDefault(require("./deserialize"));
function _default(options) {
var _types = _interopRequireDefault(require("./types"));
const echo = function (options) {
return { ...options,

@@ -27,4 +29,14 @@ onMessage: async messageData => {

await options.resolve(data.params, context);
},
onRequest: async serializedParams => {
const context = {};
const params = (0, _deserialize.default)(serializedParams);
const result = await options.resolve(params, context);
return result;
}
};
}
};
echo.types = _types.default;
var _default = echo;
exports.default = _default;

@@ -26,2 +26,8 @@ "use strict";

});
Object.defineProperty(exports, "request", {
enumerable: true,
get: function () {
return _request.default;
}
});

@@ -32,2 +38,4 @@ var _startService = _interopRequireDefault(require("./startService"));

var _echo = _interopRequireDefault(require("./echo"));
var _echo = _interopRequireDefault(require("./echo"));
var _request = _interopRequireDefault(require("./request"));

@@ -14,2 +14,6 @@ "use strict";

var _requestsHandler = _interopRequireDefault(require("../requestsHandler"));
var _types = _interopRequireDefault(require("../echo/types"));
async function _default(options) {

@@ -23,3 +27,3 @@ const kafka = new _kafkajs.Kafka(options.client);

for (const topic in options.echoes) {
await _config.default.consumer.subscribe({
_config.default.consumer.subscribe({
topic

@@ -29,9 +33,19 @@ });

await _config.default.consumer.run({
_config.default.consumer.run({
eachMessage: async params => {
const echo = options.echoes[params.topic];
if (!echo) return;
if (echo.type !== _types.default.event) return;
await echo.onMessage(params);
}
});
if (options.requests) {
_config.default.requests = options.requests;
_config.default.echoes = options.echoes;
if (_config.default.requests.startHandler) {
_config.default.requests.startHandler(_requestsHandler.default);
}
}
}

6

package.json
{
"name": "@orion-js/echoes",
"version": "2.1.0",
"version": "2.2.1",
"main": "lib/index.js",

@@ -16,2 +16,4 @@ "author": "nicolaslopezj",

"@orion-js/helpers": "^2.1.0",
"axios": "^0.23.0",
"jssha": "^3.2.0",
"kafkajs": "^1.15.0",

@@ -30,3 +32,3 @@ "serialize-javascript": "^5.0.1"

},
"gitHead": "000b9799ae0f89d0aa64b444510a305c1393352e"
"gitHead": "60107059b7c8ebe1ef8cab2992ac528263d425b5"
}
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