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

vscode-jsonrpc

Package Overview
Dependencies
Maintainers
9
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 0.10.0-pre.12 to 0.10.0-pre.13

3

lib/is.d.ts

@@ -8,1 +8,4 @@ export declare function defined(value: any): boolean;

export declare function error(value: any): value is Error;
export declare function func(value: any): value is Function;
export declare function array<T>(value: any): value is T[];
export declare function stringArray(value: any): value is string[];

@@ -34,1 +34,13 @@ /*---------------------------------------------------------

exports.error = error;
function func(value) {
return toString.call(value) === '[object Function]';
}
exports.func = func;
function array(value) {
return Array.isArray(value);
}
exports.array = array;
function stringArray(value) {
return array(value) && value.every(function (elem) { return string(elem); });
}
exports.stringArray = stringArray;

@@ -18,2 +18,3 @@ import { RequestType, ResponseError, ErrorCodes, NotificationType } from './messages';

onNotification<P>(type: NotificationType<P>, handler: INotificationHandler<P>): void;
listen(): any;
dispose(): void;

@@ -20,0 +21,0 @@ }

78

lib/main.js

@@ -19,39 +19,2 @@ /*---------------------------------------------------------

var eventHandlers = Object.create(null);
var connection = {
sendNotification: function (type, params) {
var notificatioMessage = {
jsonrpc: version,
method: type.method,
params: params
};
protocolWriter.write(notificatioMessage);
},
onNotification: function (type, handler) {
eventHandlers[type.method] = handler;
},
dispose: function () {
}
};
if (client) {
connection.sendRequest = function (type, params) {
return new Promise(function (resolve, reject) {
var id = sequenceNumber++;
var requestMessage = {
jsonrpc: version,
id: id,
method: type.method,
params: params
};
responseHandlers[String(id)] = { method: type.method, resolve: resolve, reject: reject };
protocolWriter.write(requestMessage);
});
};
}
else {
connection.onRequest = function (type, handler) {
requestHandlers[type.method] = handler;
};
}
inputStream.on('end', function () { return outputStream.end(); });
inputStream.on('close', function () { return outputStream.end(); });
function handleRequest(requestMessage) {

@@ -193,3 +156,42 @@ function reply(resultOrError) {

}
new messageReader_1.MessageReader(inputStream, callback);
var connection = {
sendNotification: function (type, params) {
var notificatioMessage = {
jsonrpc: version,
method: type.method,
params: params
};
protocolWriter.write(notificatioMessage);
},
onNotification: function (type, handler) {
eventHandlers[type.method] = handler;
},
dispose: function () {
},
listen: function () {
new messageReader_1.MessageReader(inputStream, callback);
}
};
if (client) {
connection.sendRequest = function (type, params) {
return new Promise(function (resolve, reject) {
var id = sequenceNumber++;
var requestMessage = {
jsonrpc: version,
id: id,
method: type.method,
params: params
};
responseHandlers[String(id)] = { method: type.method, resolve: resolve, reject: reject };
protocolWriter.write(requestMessage);
});
};
}
else {
connection.onRequest = function (type, handler) {
requestHandlers[type.method] = handler;
};
}
inputStream.on('end', function () { return outputStream.end(); });
inputStream.on('close', function () { return outputStream.end(); });
return connection;

@@ -196,0 +198,0 @@ }

{
"name": "vscode-jsonrpc",
"description": "A json rpc implementation over streams",
"version": "0.10.0-pre.12",
"version": "0.10.0-pre.13",
"author": "Visual Studio Code Team",

@@ -6,0 +6,0 @@ "license": "MIT",

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