🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

jayson

Package Overview
Dependencies
Maintainers
1
Versions
58
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jayson - npm Package Compare versions

Comparing version

to
4.2.0

19

lib/utils.js
'use strict';
const JSONStream = require('JSONStream');
const StreamValues = require('stream-json/streamers/StreamValues');
const Verifier = require('stream-json/utils/Verifier');
const JSONstringify = require('json-stringify-safe');

@@ -67,3 +68,3 @@ const uuid = require('uuid').v4;

/**
* Parses an incoming stream for requests using JSONStream
* Parses an incoming stream for requests using stream-json
* @param {Stream} stream

@@ -74,9 +75,10 @@ * @param {Object} options

Utils.parseStream = function(stream, options, onRequest) {
const onError = Utils.once(onRequest);
const onSuccess = (...args) => onRequest(null, ...args);
const result = JSONStream.parse();
const verifier = new Verifier({jsonStreaming: true});
const parser = StreamValues.withParser();
result.on('data', function(data) {
parser.on('data', function(obj) {
let data = obj.value;

@@ -91,7 +93,8 @@ // apply reviver walk function to prevent stringify/parse again

result.on('error', onError);
parser.on('error', onError);
verifier.on('error', onError);
stream.on('error', onError);
stream.pipe(result);
stream.pipe(verifier);
stream.pipe(parser);
};

@@ -98,0 +101,0 @@

{
"name": "jayson",
"version": "4.1.3",
"version": "4.2.0",
"description": "JSON-RPC 1.0/2.0 compliant server and client",

@@ -26,3 +26,5 @@ "license": "MIT",

"author": "Tedde Lundgren <mail@tedeh.net> (https://tedeh.net)",
"maintainers": "Tedde Lundgren <mail@tedeh.net> (https://tedeh.net)",
"maintainers": [
"Tedde Lundgren <mail@tedeh.net> (https://tedeh.net)"
],
"bin": "./bin/jayson.js",

@@ -62,3 +64,3 @@ "repository": {

"json-stringify-safe": "^5.0.1",
"JSONStream": "^1.3.5",
"stream-json": "^1.9.1",
"uuid": "^8.3.2",

@@ -71,3 +73,3 @@ "ws": "^7.5.10"

"connect": "^3.7.0",
"coveralls": "^3.1.0",
"coveralls-next": "^4.2.1",
"es6-promise": "^4.2.8",

@@ -79,4 +81,4 @@ "express": "^4.17.1",

"mocha": "^10.2.0",
"node-fetch": "^2.6.7",
"nyc": "^14.1.1",
"node-fetch": "^2.7.0",
"nyc": "^17.1.0",
"pass-stream": "^1.0.0",

@@ -89,3 +91,4 @@ "should": "^13.2.3",

"node": ">=8"
}
},
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
}