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

nats

Package Overview
Dependencies
Maintainers
3
Versions
195
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nats - npm Package Compare versions

Comparing version 2.5.0-1 to 2.5.0-2

4

lib/nats-base-client/encoders.d.ts
export declare const TE: TextEncoder;
export declare const TD: TextDecoder;
export declare function fastEncoder(...a: string[]): Uint8Array;
export declare function fastDecoder(a: Uint8Array): string;
export declare function encode(...a: string[]): Uint8Array;
export declare function decode(a: Uint8Array): string;

@@ -17,35 +17,40 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.fastDecoder = exports.fastEncoder = exports.TD = exports.TE = void 0;
exports.decode = exports.encode = exports.TD = exports.TE = void 0;
const types_1 = require("./types");
exports.TE = new TextEncoder();
exports.TD = new TextDecoder();
function fastEncoder(...a) {
let len = 0;
function concat(...bufs) {
let max = 0;
for (let i = 0; i < bufs.length; i++) {
max += bufs[i].length;
}
const out = new Uint8Array(max);
let index = 0;
for (let i = 0; i < bufs.length; i++) {
out.set(bufs[i], index);
index += bufs[i].length;
}
return out;
}
function encode(...a) {
const bufs = [];
for (let i = 0; i < a.length; i++) {
len += a[i] ? a[i].length : 0;
bufs.push(exports.TE.encode(a[i]));
}
if (len === 0) {
if (bufs.length === 0) {
return types_1.Empty;
}
const buf = new Uint8Array(len);
let c = 0;
for (let i = 0; i < a.length; i++) {
const s = a[i];
if (s) {
for (let j = 0; j < s.length; j++) {
buf[c] = s.charCodeAt(j);
c++;
}
}
if (bufs.length === 1) {
return bufs[0];
}
return buf;
return concat(...bufs);
}
exports.fastEncoder = fastEncoder;
function fastDecoder(a) {
exports.encode = encode;
function decode(a) {
if (!a || a.length === 0) {
return "";
}
return String.fromCharCode(...a);
return exports.TD.decode(a);
}
exports.fastDecoder = fastDecoder;
exports.decode = decode;
//# sourceMappingURL=encoders.js.map

@@ -59,4 +59,4 @@ "use strict";

exports.createInbox = createInbox;
const PONG_CMD = (0, encoders_1.fastEncoder)("PONG\r\n");
const PING_CMD = (0, encoders_1.fastEncoder)("PING\r\n");
const PONG_CMD = (0, encoders_1.encode)("PONG\r\n");
const PING_CMD = (0, encoders_1.encode)("PING\r\n");
class Connect {

@@ -339,3 +339,3 @@ constructor(transport, opts, nonce) {

return __awaiter(this, void 0, void 0, function* () {
const s = (0, encoders_1.fastDecoder)(m);
const s = (0, encoders_1.decode)(m);
const err = ProtocolHandler.toError(s);

@@ -381,3 +381,3 @@ const handled = this.subscriptions.handleError(err);

processInfo(m) {
const info = JSON.parse((0, encoders_1.fastDecoder)(m));
const info = JSON.parse((0, encoders_1.decode)(m));
this.info = info;

@@ -401,3 +401,3 @@ const updates = this.options && this.options.ignoreClusterUpdates

const cs = JSON.stringify(c);
this.transport.send((0, encoders_1.fastEncoder)(`CONNECT ${cs}${util_1.CR_LF}`));
this.transport.send((0, encoders_1.encode)(`CONNECT ${cs}${util_1.CR_LF}`));
this.transport.send(PING_CMD);

@@ -447,3 +447,3 @@ }

if (typeof cmd === "string") {
buf = (0, encoders_1.fastEncoder)(cmd);
buf = (0, encoders_1.encode)(cmd);
}

@@ -576,3 +576,3 @@ else {

if (cmds.length) {
this.transport.send((0, encoders_1.fastEncoder)(cmds.join("")));
this.transport.send((0, encoders_1.encode)(cmds.join("")));
}

@@ -579,0 +579,0 @@ }

@@ -46,3 +46,3 @@ "use strict";

const dns = require("dns");
const VERSION = "2.5.0-1";
const VERSION = "2.5.0-2";
const LANG = "nats.js";

@@ -49,0 +49,0 @@ class NodeTransport {

{
"name": "nats",
"version": "2.5.0-1",
"version": "2.5.0-2",
"description": "Node.js client for NATS, a lightweight, high-performance cloud native messaging system",

@@ -5,0 +5,0 @@ "keywords": [

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