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

@silenteer/natsu-port-server

Package Overview
Dependencies
Maintainers
2
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@silenteer/natsu-port-server - npm Package Compare versions

Comparing version 0.0.26 to 0.0.27

2

dist/configuration.js

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

const yup = (0, tslib_1.__importStar)(require("yup"));
const dotenv_1 = (0, tslib_1.__importDefault)(require("dotenv"));
dotenv_1.default.config();
const schema = yup.object({

@@ -8,0 +10,0 @@ natsURI: yup.string().trim().required(),

@@ -0,1 +1,2 @@

import 'colors';
declare function start(): void;

@@ -2,0 +3,0 @@ declare const _default: {

@@ -10,2 +10,3 @@ "use strict";

const fastify_websocket_1 = (0, tslib_1.__importDefault)(require("fastify-websocket"));
require("colors");
const configuration_1 = (0, tslib_1.__importDefault)(require("./configuration"));

@@ -38,3 +39,8 @@ const service_nats_1 = (0, tslib_1.__importDefault)(require("./service-nats"));

var _a;
const subject = request.headers['nats-subject'];
try {
console.log(`----- [${subject}]Begin validate -----`, {
headers: request.headers,
body: request.body,
});
const validationResult = validateHttpRequest(request);

@@ -45,2 +51,4 @@ if (validationResult.code === 400) {

}
console.log(`----- [${subject}]End validate -----`, validationResult);
console.log(`----- [${subject}]Begin authenticate -----`);
const authenticationResult = yield authenticate(request);

@@ -54,2 +62,4 @@ if (authenticationResult.code !== 'OK') {

}
console.log(`----- [${subject}]End authenticate -----`);
console.log(`----- [${subject}]Begin send nats request -----`);
const response = yield sendNatsRequest({

@@ -59,6 +69,7 @@ httpRequest: request,

});
console.log(`----- [${subject}]End send nats request -----`);
reply.send(response);
}
catch (error) {
console.error(request.headers['nats-subject'], error);
console.error(subject, error);
if (error.code) {

@@ -172,2 +183,3 @@ reply.send(error);

if (shouldAuthenticate) {
console.log(`----- [${subject}]Begin send nats auth request -----`);
const natsAuthResponse = yield sendNatsAuthRequest(request);

@@ -179,3 +191,2 @@ if (natsAuthResponse.code !== 200) {

};
return result;
}

@@ -187,4 +198,5 @@ else {

};
return result;
}
console.log(`----- [${subject}]End send nats auth request -----`);
return result;
}

@@ -235,2 +247,3 @@ result = { code: 'OK' };

};
console.log(`----- [${request.headers['nats-subject']}][${subject}] Sending -----`, natsRequest);
const message = yield service_nats_1.default.request({

@@ -241,2 +254,3 @@ subject,

natsResponse = responseCodec.decode(message.data);
console.log(`----- [${request.headers['nats-subject']}][${subject}] Ending -----`, natsResponse);
if (natsResponse.code !== 200) {

@@ -257,2 +271,3 @@ break;

};
console.log(`----- [${natsRequest.headers['nats-subject']}] Sending -----`, natsRequest);
const message = yield service_nats_1.default.request({

@@ -267,2 +282,3 @@ subject: httpRequest.headers['nats-subject'],

};
console.log(`----- [${natsRequest.headers['nats-subject']}] Ending -----`, portResponse);
return portResponse;

@@ -269,0 +285,0 @@ });

3

dist/service-nats.js

@@ -49,3 +49,4 @@ "use strict";

const { subject, data, options } = params;
return (yield getConnection()).request(subject, data, Object.assign(Object.assign({}, defaultRequestOptions), options));
const connection = yield getConnection();
return connection.request(subject, data, Object.assign(Object.assign({}, defaultRequestOptions), options));
});

@@ -52,0 +53,0 @@ }

{
"name": "@silenteer/natsu-port-server",
"version": "0.0.26",
"version": "0.0.27",
"license": "MIT",

@@ -27,6 +27,9 @@ "private": false,

"cli-table3": "0.6.0",
"colors": "^1.4.0",
"dotenv": "^16.0.0",
"fastify": "3.21.0",
"fastify-cors": "6.0.2",
"fastify-websocket": "4.0.0",
"nats": "2.2.0",
"nats": "2.6.1",
"uri-js": "^4.4.1",
"yup": "0.32.9"

@@ -33,0 +36,0 @@ },

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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