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

vscode-jsonrpc

Package Overview
Dependencies
Maintainers
11
Versions
130
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vscode-jsonrpc - npm Package Compare versions

Comparing version 6.0.0 to 6.1.0-next.1

45

lib/common/connection.js

@@ -85,2 +85,5 @@ "use strict";

function fromString(value) {
if (!Is.string(value)) {
return TraceFormat.Text;
}
value = value.toLowerCase();

@@ -203,2 +206,3 @@ if (value === 'json') {

let responsePromises = Object.create(null);
let knownCanceledRequests = new Set();
let requestTokens = Object.create(null);

@@ -309,3 +313,4 @@ let trace = Trace.Off;

if (messages_1.isNotificationMessage(message) && message.method === CancelNotification.type.method) {
const key = createRequestQueueKey(message.params.id);
const cancelId = message.params.id;
const key = createRequestQueueKey(cancelId);
const toCancel = messageQueue.get(key);

@@ -323,2 +328,15 @@ if (messages_1.isRequestMessage(toCancel)) {

}
const tokenKey = String(cancelId);
const cancellationToken = requestTokens[tokenKey];
// The request is already running. Cancel the token
if (cancellationToken !== undefined) {
cancellationToken.cancel();
traceReceivedNotification(message);
return;
}
else {
// Remember the cancel but still queue the message to
// clean up state in process message.
knownCanceledRequests.add(cancelId);
}
}

@@ -386,2 +404,5 @@ addMessageToQueue(messageQueue, message);

const cancellationSource = cancellationStrategy.receiver.createCancellationTokenSource(tokenKey);
if (requestMessage.id !== null && knownCanceledRequests.has(requestMessage.id)) {
cancellationSource.cancel();
}
requestTokens[tokenKey] = cancellationSource;

@@ -393,3 +414,3 @@ try {

if (type !== undefined && type.numberOfParams !== 0) {
replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InvalidParams, `Request ${requestMessage.method} defines ${type.numberOfParams} params but recevied none.`), requestMessage.method, startTime);
replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InvalidParams, `Request ${requestMessage.method} defines ${type.numberOfParams} params but received none.`), requestMessage.method, startTime);
return;

@@ -511,9 +532,6 @@ }

if (message.method === CancelNotification.type.method) {
notificationHandler = (params) => {
const id = params.id;
const source = requestTokens[String(id)];
if (source) {
source.cancel();
}
};
const cancelId = message.params.id;
knownCanceledRequests.delete(cancelId);
traceReceivedNotification(message);
return;
}

@@ -534,3 +552,3 @@ else {

if (type.numberOfParams !== 0 && type.parameterStructures !== messages_1.ParameterStructures.byName) {
logger.error(`Notification ${message.method} defines ${type.numberOfParams} params but recevied none.`);
logger.error(`Notification ${message.method} defines ${type.numberOfParams} params but received none.`);
}

@@ -778,3 +796,3 @@ }

if (!isNamedParam(param)) {
throw new Error(`Recevied parameters by name but param is not an object literal.`);
throw new Error(`Received parameters by name but param is not an object literal.`);
}

@@ -837,3 +855,3 @@ return nullToUndefined(param);

if (parameterStructures === messages_1.ParameterStructures.byName) {
throw new Error(`Recevied ${numberOfParams} parameters for 'by Name' notification parameter structure.`);
throw new Error(`Received ${numberOfParams} parameters for 'by Name' notification parameter structure.`);
}

@@ -930,3 +948,3 @@ messageParams = args.slice(paramStart, paramEnd).map(value => undefinedToNull(value));

if (parameterStructures === messages_1.ParameterStructures.byName) {
throw new Error(`Recevied ${numberOfParams} parameters for 'by Name' request parameter structure.`);
throw new Error(`Received ${numberOfParams} parameters for 'by Name' request parameter structure.`);
}

@@ -1061,2 +1079,3 @@ messageParams = args.slice(paramStart, paramEnd).map(value => undefinedToNull(value));

requestTokens = Object.create(null);
knownCanceledRequests = new Set();
messageQueue = new linkedMap_1.LinkedMap();

@@ -1063,0 +1082,0 @@ // Test for backwards compatibility

{
"name": "vscode-jsonrpc",
"description": "A json rpc implementation over streams",
"version": "6.0.0",
"version": "6.1.0-next.1",
"author": "Microsoft Corporation",

@@ -34,2 +34,3 @@ "license": "MIT",

"clean": "node ../node_modules/rimraf/bin.js lib && node ../node_modules/rimraf/bin.js dist",
"lint": "node ../node_modules/eslint/bin/eslint.js ./src/**/*.ts",
"test": "npm run test:node && npm run test:browser",

@@ -36,0 +37,0 @@ "test:node": "node ../node_modules/mocha/bin/_mocha",

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