New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@gedit/connection

Package Overview
Dependencies
Maintainers
3
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@gedit/connection - npm Package Compare versions

Comparing version 0.1.68 to 0.1.69

22

lib/browser/connection-frontend-module.js

@@ -18,20 +18,18 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
var inversify_1 = require("inversify");
var ws_connection_provider_1 = require("./ws-connection-provider");
var common_1 = require("../common");
var command_1 = require("@gedit/command");
exports.default = new inversify_1.ContainerModule(function (bind) {
const inversify_1 = require("inversify");
const ws_connection_provider_1 = require("./ws-connection-provider");
const common_1 = require("../common");
const command_1 = require("@gedit/command");
exports.default = new inversify_1.ContainerModule(bind => {
bind(common_1.IConnectionProvider).to(ws_connection_provider_1.WebSocketConnectionProvider).inSingletonScope();
bind(common_1.MessageClient).toSelf().inSingletonScope();
bind(common_1.MessageService).toSelf().inSingletonScope()
.onActivation(function (_a, messages) {
var container = _a.container;
var client = container.get(common_1.MessageClient);
var provider = container.get(common_1.IConnectionProvider);
.onActivation(({ container }, messages) => {
const client = container.get(common_1.MessageClient);
const provider = container.get(common_1.IConnectionProvider);
provider.createProxy(common_1.messageServicePath, client);
return messages;
});
bind(command_1.CommandRegistry).toSelf().inSingletonScope().onActivation(function (_a, registry) {
var container = _a.container;
var provider = container.get(common_1.IConnectionProvider);
bind(command_1.CommandRegistry).toSelf().inSingletonScope().onActivation(({ container }, registry) => {
const provider = container.get(common_1.IConnectionProvider);
provider.createProxy(command_1.commandServicePath, registry);

@@ -38,0 +36,0 @@ return registry;

@@ -17,13 +17,2 @@ "use strict";

********************************************************************************/
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {

@@ -41,53 +30,17 @@ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;

};
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
var __values = (this && this.__values) || function(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
};
var WebSocketConnectionProvider_1;
Object.defineProperty(exports, "__esModule", { value: true });
exports.WebSocketConnectionProvider = exports.WebSocketOptions = void 0;
var inversify_1 = require("inversify");
var lib_1 = require("vscode-ws-jsonrpc/lib");
var utils_1 = require("@gedit/utils");
var common_1 = require("../common");
var web_socket_channel_1 = require("../common/messaging/web-socket-channel");
var browser_1 = require("@gedit/utils/lib/browser");
var reconnecting_websocket_1 = require("reconnecting-websocket");
const inversify_1 = require("inversify");
const lib_1 = require("vscode-ws-jsonrpc/lib");
const utils_1 = require("@gedit/utils");
const common_1 = require("../common");
const web_socket_channel_1 = require("../common/messaging/web-socket-channel");
const browser_1 = require("@gedit/utils/lib/browser");
const reconnecting_websocket_1 = require("reconnecting-websocket");
(0, inversify_1.decorate)((0, inversify_1.injectable)(), common_1.JsonRpcProxyFactory);
(0, inversify_1.decorate)((0, inversify_1.unmanaged)(), common_1.JsonRpcProxyFactory, 0);
exports.WebSocketOptions = Symbol('WebSocketOptions');
var WebSocketConnectionProvider = /** @class */ (function () {
function WebSocketConnectionProvider(defaultOptions) {
var _this = this;
let WebSocketConnectionProvider = WebSocketConnectionProvider_1 = class WebSocketConnectionProvider {
constructor(defaultOptions) {
this.defaultOptions = defaultOptions;

@@ -98,26 +51,13 @@ this.channelIdSeq = 0;

this.onIncomingMessageActivity = this.onIncomingMessageActivityEmitter.event;
var url = this.createWebSocketUrl(web_socket_channel_1.WebSocketChannel.wsPath);
var socket = this.createWebSocket(url);
const url = this.createWebSocketUrl(web_socket_channel_1.WebSocketChannel.wsPath);
const socket = this.createWebSocket(url);
socket.onerror = console.error;
socket.onclose = function (_a) {
var e_1, _b;
var code = _a.code, reason = _a.reason;
try {
for (var _c = __values(__spreadArray([], __read(_this.channels.values()), false)), _d = _c.next(); !_d.done; _d = _c.next()) {
var channel = _d.value;
channel.close(code, reason);
}
socket.onclose = ({ code, reason }) => {
for (const channel of [...this.channels.values()]) {
channel.close(code, reason);
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
}
finally { if (e_1) throw e_1.error; }
}
};
socket.onmessage = function (_a) {
var data = _a.data;
var message = JSON.parse(data);
var channel = _this.channels.get(message.id);
socket.onmessage = ({ data }) => {
const message = JSON.parse(data);
const channel = this.channels.get(message.id);
if (channel) {

@@ -129,32 +69,28 @@ channel.handleMessage(message);

}
_this.onIncomingMessageActivityEmitter.fire(undefined);
this.onIncomingMessageActivityEmitter.fire(undefined);
};
this.socket = socket;
}
WebSocketConnectionProvider_1 = WebSocketConnectionProvider;
WebSocketConnectionProvider.createProxy = function (container, path, arg) {
static createProxy(container, path, arg) {
return container.get(WebSocketConnectionProvider_1).createProxy(path, arg);
};
WebSocketConnectionProvider.prototype.createProxy = function (path, arg) {
var factory = arg instanceof common_1.JsonRpcProxyFactory ? arg : new common_1.JsonRpcProxyFactory(arg);
}
createProxy(path, arg) {
const factory = arg instanceof common_1.JsonRpcProxyFactory ? arg : new common_1.JsonRpcProxyFactory(arg);
this.listen({
path: path,
onConnection: function (c) { return factory.listen(c); }
path,
onConnection: c => factory.listen(c)
});
return factory.createProxy();
};
}
/**
* Install a connection handler for the given path.
*/
WebSocketConnectionProvider.prototype.listen = function (handler, options) {
var _this = this;
this.openChannel(handler.path, function (channel) {
var connection = (0, lib_1.createWebSocketConnection)(channel, _this.createLogger());
connection.onDispose(function () { return channel.close(); });
listen(handler, options) {
this.openChannel(handler.path, channel => {
const connection = (0, lib_1.createWebSocketConnection)(channel, this.createLogger());
connection.onDispose(() => channel.close());
handler.onConnection(connection);
}, options);
};
WebSocketConnectionProvider.prototype.openChannel = function (path, handler, options) {
var _this = this;
if (options === void 0) { options = this.defaultOptions; }
}
openChannel(path, handler, options = this.defaultOptions) {
if (this.socket.readyState === WebSocket.OPEN) {

@@ -164,19 +100,18 @@ this.doOpenChannel(path, handler, options);

else {
var openChannel_1 = function () {
_this.socket.removeEventListener('open', openChannel_1);
_this.openChannel(path, handler, options);
const openChannel = () => {
this.socket.removeEventListener('open', openChannel);
this.openChannel(path, handler, options);
};
this.socket.addEventListener('open', openChannel_1);
this.socket.addEventListener('open', openChannel);
}
};
WebSocketConnectionProvider.prototype.doOpenChannel = function (path, handler, options) {
var _this = this;
var id = this.channelIdSeq++;
var channel = this.createChannel(id);
}
doOpenChannel(path, handler, options) {
const id = this.channelIdSeq++;
const channel = this.createChannel(id);
this.channels.set(id, channel);
channel.onClose(function () {
if (_this.channels.delete(channel.id)) {
var reconnecting = __assign({ reconnecting: true }, options).reconnecting;
channel.onClose(() => {
if (this.channels.delete(channel.id)) {
const { reconnecting } = Object.assign({ reconnecting: true }, options);
if (reconnecting) {
_this.openChannel(path, handler, options);
this.openChannel(path, handler, options);
}

@@ -188,28 +123,27 @@ }

});
channel.onOpen(function () { return handler(channel); });
channel.onOpen(() => handler(channel));
channel.open(path);
};
WebSocketConnectionProvider.prototype.createChannel = function (id) {
var _this = this;
return new web_socket_channel_1.WebSocketChannel(id, function (content) {
if (_this.socket.readyState < WebSocket.CLOSING) {
_this.socket.send(content);
}
createChannel(id) {
return new web_socket_channel_1.WebSocketChannel(id, content => {
if (this.socket.readyState < WebSocket.CLOSING) {
this.socket.send(content);
}
});
};
WebSocketConnectionProvider.prototype.createLogger = function () {
}
createLogger() {
return new lib_1.ConsoleLogger();
};
}
/**
* Creates a websocket URL to the current location
*/
WebSocketConnectionProvider.prototype.createWebSocketUrl = function (path) {
createWebSocketUrl(path) {
var _a;
var endpoint = new browser_1.Endpoint({ path: path }, (_a = this.defaultOptions) === null || _a === void 0 ? void 0 : _a.location);
const endpoint = new browser_1.Endpoint({ path }, (_a = this.defaultOptions) === null || _a === void 0 ? void 0 : _a.location);
return endpoint.getWebSocketUrl().toString();
};
}
/**
* Creates a web socket for the given url
*/
WebSocketConnectionProvider.prototype.createWebSocket = function (url) {
createWebSocket(url) {
return new reconnecting_websocket_1.default(url, undefined, {

@@ -223,13 +157,11 @@ maxReconnectionDelay: 10000,

});
};
var WebSocketConnectionProvider_1;
WebSocketConnectionProvider = WebSocketConnectionProvider_1 = __decorate([
(0, inversify_1.injectable)(),
__param(0, (0, inversify_1.inject)(exports.WebSocketOptions)),
__param(0, (0, inversify_1.optional)()),
__metadata("design:paramtypes", [Object])
], WebSocketConnectionProvider);
return WebSocketConnectionProvider;
}());
}
};
WebSocketConnectionProvider = WebSocketConnectionProvider_1 = __decorate([
(0, inversify_1.injectable)(),
__param(0, (0, inversify_1.inject)(exports.WebSocketOptions)),
__param(0, (0, inversify_1.optional)()),
__metadata("design:paramtypes", [Object])
], WebSocketConnectionProvider);
exports.WebSocketConnectionProvider = WebSocketConnectionProvider;
//# sourceMappingURL=ws-connection-provider.js.map

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

exports.MessageClient = exports.ProgressMessage = exports.MessageType = exports.messageServicePath = void 0;
var inversify_1 = require("inversify");
const inversify_1 = require("inversify");
exports.messageServicePath = '/services/messageService';

@@ -46,5 +46,3 @@ var MessageType;

})(ProgressMessage = exports.ProgressMessage || (exports.ProgressMessage = {}));
var MessageClient = /** @class */ (function () {
function MessageClient() {
}
let MessageClient = class MessageClient {
/**

@@ -57,6 +55,6 @@ * Show a message of the given type and possible actions to the user.

*/
MessageClient.prototype.showMessage = function (message) {
showMessage(message) {
console.info(message.text);
return Promise.resolve(undefined);
};
}
/**

@@ -67,6 +65,6 @@ * Show a progress message with possible actions to user.

*/
MessageClient.prototype.showProgress = function (progressId, message, cancellationToken) {
showProgress(progressId, message, cancellationToken) {
console.info(message.text);
return Promise.resolve(undefined);
};
}
/**

@@ -77,11 +75,10 @@ * Update a previously created progress message.

*/
MessageClient.prototype.reportProgress = function (progressId, update, message, cancellationToken) {
reportProgress(progressId, update, message, cancellationToken) {
return Promise.resolve(undefined);
};
MessageClient = __decorate([
(0, inversify_1.injectable)()
], MessageClient);
return MessageClient;
}());
}
};
MessageClient = __decorate([
(0, inversify_1.injectable)()
], MessageClient);
exports.MessageClient = MessageClient;
//# sourceMappingURL=message-service-protocol.js.map

@@ -17,13 +17,2 @@ "use strict";

********************************************************************************/
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {

@@ -41,45 +30,9 @@ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;

};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.MessageService = void 0;
var inversify_1 = require("inversify");
var message_service_protocol_1 = require("./message-service-protocol");
var utils_1 = require("@gedit/utils");
var MessageService = /** @class */ (function () {
function MessageService(client) {
const inversify_1 = require("inversify");
const message_service_protocol_1 = require("./message-service-protocol");
const utils_1 = require("@gedit/utils");
let MessageService = class MessageService {
constructor(client) {
this.client = client;

@@ -90,89 +43,66 @@ this.progressIdPrefix = Math.random().toString(36).substring(5);

// eslint-disable-next-line @typescript-eslint/no-explicit-any
MessageService.prototype.log = function (message) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
log(message, ...args) {
return this.processMessage(message_service_protocol_1.MessageType.Log, message, args);
};
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
MessageService.prototype.info = function (message) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
info(message, ...args) {
return this.processMessage(message_service_protocol_1.MessageType.Info, message, args);
};
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
MessageService.prototype.warn = function (message) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
warn(message, ...args) {
return this.processMessage(message_service_protocol_1.MessageType.Warning, message, args);
};
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
MessageService.prototype.error = function (message) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
error(message, ...args) {
return this.processMessage(message_service_protocol_1.MessageType.Error, message, args);
}
async showProgress(message, onDidCancel) {
const id = this.newProgressId();
const cancellationSource = new utils_1.CancellationTokenSource();
const report = (update) => {
this.client.reportProgress(id, update, message, cancellationSource.token);
};
const actions = new Set(message.actions);
if (message_service_protocol_1.ProgressMessage.isCancelable(message)) {
actions.delete(message_service_protocol_1.ProgressMessage.Cancel);
actions.add(message_service_protocol_1.ProgressMessage.Cancel);
}
return this.processMessage(message_service_protocol_1.MessageType.Error, message, args);
};
MessageService.prototype.showProgress = function (message, onDidCancel) {
return __awaiter(this, void 0, void 0, function () {
var id, cancellationSource, report, actions, clientMessage, result;
var _this = this;
return __generator(this, function (_a) {
id = this.newProgressId();
cancellationSource = new utils_1.CancellationTokenSource();
report = function (update) {
_this.client.reportProgress(id, update, message, cancellationSource.token);
};
actions = new Set(message.actions);
if (message_service_protocol_1.ProgressMessage.isCancelable(message)) {
actions.delete(message_service_protocol_1.ProgressMessage.Cancel);
actions.add(message_service_protocol_1.ProgressMessage.Cancel);
const clientMessage = Object.assign(Object.assign({}, message), { actions: Array.from(actions) });
const result = this.client.showProgress(id, clientMessage, cancellationSource.token);
if (message_service_protocol_1.ProgressMessage.isCancelable(message) && typeof onDidCancel === 'function') {
result.then(value => {
if (value === message_service_protocol_1.ProgressMessage.Cancel) {
onDidCancel();
}
clientMessage = __assign(__assign({}, message), { actions: Array.from(actions) });
result = this.client.showProgress(id, clientMessage, cancellationSource.token);
if (message_service_protocol_1.ProgressMessage.isCancelable(message) && typeof onDidCancel === 'function') {
result.then(function (value) {
if (value === message_service_protocol_1.ProgressMessage.Cancel) {
onDidCancel();
}
});
}
return [2 /*return*/, {
id: id,
cancel: function () { return cancellationSource.cancel(); },
result: result,
report: report
}];
});
});
};
}
return {
id,
cancel: () => cancellationSource.cancel(),
result,
report
};
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
MessageService.prototype.processMessage = function (type, text, args) {
processMessage(type, text, args) {
if (!!args && args.length > 0) {
var first = args[0];
var actions = Array.from(new Set(args.filter(function (a) { return typeof a === 'string'; })));
var options = (typeof first === 'object' && !Array.isArray(first))
const first = args[0];
const actions = Array.from(new Set(args.filter(a => typeof a === 'string')));
const options = (typeof first === 'object' && !Array.isArray(first))
? first
: undefined;
return this.client.showMessage({ type: type, options: options, text: text, actions: actions });
return this.client.showMessage({ type, options, text, actions });
}
return this.client.showMessage({ type: type, text: text });
};
MessageService.prototype.newProgressId = function () {
return "".concat(this.progressIdPrefix, "-").concat(++this.counter);
};
MessageService = __decorate([
(0, inversify_1.injectable)(),
__param(0, (0, inversify_1.inject)(message_service_protocol_1.MessageClient)),
__metadata("design:paramtypes", [message_service_protocol_1.MessageClient])
], MessageService);
return MessageService;
}());
return this.client.showMessage({ type, text });
}
newProgressId() {
return `${this.progressIdPrefix}-${++this.counter}`;
}
};
MessageService = __decorate([
(0, inversify_1.injectable)(),
__param(0, (0, inversify_1.inject)(message_service_protocol_1.MessageClient)),
__metadata("design:paramtypes", [message_service_protocol_1.MessageClient])
], MessageService);
exports.MessageService = MessageService;
//# sourceMappingURL=message-service.js.map

@@ -17,24 +17,13 @@ "use strict";

********************************************************************************/
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ConnectionErrorHandler = void 0;
var ConnectionErrorHandler = /** @class */ (function () {
function ConnectionErrorHandler(options) {
class ConnectionErrorHandler {
constructor(options) {
this.restarts = [];
this.options = __assign({ maxErrors: 3, maxRestarts: 5, restartInterval: 3 }, options);
this.options = Object.assign({ maxErrors: 3, maxRestarts: 5, restartInterval: 3 }, options);
}
ConnectionErrorHandler.prototype.shouldStop = function (error, message, count) {
shouldStop(error, message, count) {
return !count || count > this.options.maxErrors;
};
ConnectionErrorHandler.prototype.shouldRestart = function () {
}
shouldRestart() {
this.restarts.push(Date.now());

@@ -44,6 +33,6 @@ if (this.restarts.length <= this.options.maxRestarts) {

}
var diff = this.restarts[this.restarts.length - 1] - this.restarts[0];
const diff = this.restarts[this.restarts.length - 1] - this.restarts[0];
if (diff <= this.options.restartInterval * 60 * 1000) {
// eslint-disable-next-line max-len
this.options.logger.error("The ".concat(this.options.serverName, " server crashed ").concat(this.options.maxRestarts, " times in the last ").concat(this.options.restartInterval, " minutes. The server will not be restarted."));
this.options.logger.error(`The ${this.options.serverName} server crashed ${this.options.maxRestarts} times in the last ${this.options.restartInterval} minutes. The server will not be restarted.`);
return false;

@@ -53,6 +42,5 @@ }

return true;
};
return ConnectionErrorHandler;
}());
}
}
exports.ConnectionErrorHandler = ConnectionErrorHandler;
//# sourceMappingURL=connection-error-handler.js.map

@@ -17,3 +17,3 @@ /********************************************************************************

import { MessageConnection } from 'vscode-jsonrpc';
import { Emitter, Event, Disposable } from '@gedit/utils';
import { Disposable, Emitter, Event } from '@gedit/utils';
import { ConnectionHandler } from './handler';

@@ -20,0 +20,0 @@ export declare type JsonRpcServer<Client> = Disposable & {

@@ -17,82 +17,20 @@ "use strict";

********************************************************************************/
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.JsonRpcProxyFactory = exports.JsonRpcConnectionHandler = void 0;
/* eslint-disable @typescript-eslint/no-explicit-any */
var vscode_jsonrpc_1 = require("vscode-jsonrpc");
var application_common_1 = require("@gedit/application-common");
var utils_1 = require("@gedit/utils");
var JsonRpcConnectionHandler = /** @class */ (function () {
function JsonRpcConnectionHandler(path, targetFactory) {
const vscode_jsonrpc_1 = require("vscode-jsonrpc");
const application_common_1 = require("@gedit/application-common");
const utils_1 = require("@gedit/utils");
class JsonRpcConnectionHandler {
constructor(path, targetFactory) {
this.path = path;
this.targetFactory = targetFactory;
}
JsonRpcConnectionHandler.prototype.onConnection = function (connection) {
var factory = new JsonRpcProxyFactory(this.path);
var proxy = factory.createProxy();
onConnection(connection) {
const factory = new JsonRpcProxyFactory(this.path);
const proxy = factory.createProxy();
factory.target = this.targetFactory(proxy);
factory.listen(connection);
};
return JsonRpcConnectionHandler;
}());
}
}
exports.JsonRpcConnectionHandler = JsonRpcConnectionHandler;

@@ -141,3 +79,3 @@ /**

*/
var JsonRpcProxyFactory = /** @class */ (function () {
class JsonRpcProxyFactory {
/**

@@ -149,3 +87,3 @@ * Build a new JsonRpcProxyFactory.

*/
function JsonRpcProxyFactory(target) {
constructor(target) {
this.target = target;

@@ -162,32 +100,9 @@ this.onDidOpenConnectionEmitter = new utils_1.Emitter();

*/
JsonRpcProxyFactory.prototype.listen = function (connection) {
var _this = this;
if (this.target) {
var _loop_1 = function (prop) {
if (typeof this_1.target[prop] === 'function') {
connection.onRequest(prop, function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return _this.onRequest.apply(_this, __spreadArray([prop], __read(args), false));
});
connection.onNotification(prop, function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return _this.onNotification.apply(_this, __spreadArray([prop], __read(args), false));
});
}
};
var this_1 = this;
for (var prop in this.target) {
_loop_1(prop);
}
}
connection.onDispose(function () { return _this.waitForConnection(); });
listen(connection) {
connection.onRequest((prop, ...args) => this.onRequest(prop, ...args));
connection.onNotification((prop, ...args) => this.onNotification(prop, ...args));
connection.onDispose(() => this.waitForConnection());
connection.listen();
this.connectionPromiseResolve(connection);
};
}
/**

@@ -200,6 +115,6 @@ * Create a Proxy exposing the interface of an object of type T. This Proxy

*/
JsonRpcProxyFactory.prototype.createProxy = function () {
var result = new Proxy(this, this);
createProxy() {
const result = new Proxy(this, this);
return result;
};
}
/**

@@ -227,11 +142,10 @@ * Get a callable object that executes a JSON-RPC method call.

*/
JsonRpcProxyFactory.prototype.get = function (target, p, receiver) {
var _this = this;
get(target, p, receiver) {
if (p === 'setClient') {
return function (client) {
_this.target = client;
return (client) => {
this.target = client;
};
}
if (p === 'getClient') {
return function () { return _this.target; };
return () => this.target;
}

@@ -244,43 +158,32 @@ if (p === 'onDidOpenConnection') {

}
var isNotify = this.isNotification(p);
return function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
var method = p.toString();
var capturedError = new Error("Request '".concat(method, "' failed"));
return _this.connectionPromise.then(function (connection) {
return new Promise(function (resolve, reject) {
try {
if (isNotify) {
connection.sendNotification.apply(connection, __spreadArray([method], __read(args), false));
resolve();
}
else {
var resultPromise = connection.sendRequest.apply(connection, __spreadArray([method], __read(args), false));
resultPromise
.catch(function (err) { return reject(_this.deserializeError(capturedError, err)); })
.then(function (result) { return resolve(result); });
}
const isNotify = this.isNotification(p);
return (...args) => {
const method = p.toString();
const capturedError = new Error(`Request '${method}' failed`);
return this.connectionPromise.then(connection => new Promise((resolve, reject) => {
try {
if (isNotify) {
connection.sendNotification(method, ...args);
resolve();
}
catch (err) {
reject(err);
else {
const resultPromise = connection.sendRequest(method, ...args);
resultPromise
.catch((err) => reject(this.deserializeError(capturedError, err)))
.then((result) => resolve(result));
}
});
});
}
catch (err) {
reject(err);
}
}));
};
};
JsonRpcProxyFactory.prototype.waitForConnection = function () {
var _this = this;
this.connectionPromise = new Promise(function (resolve) {
return _this.connectionPromiseResolve = resolve;
}
waitForConnection() {
this.connectionPromise = new Promise(resolve => this.connectionPromiseResolve = resolve);
this.connectionPromise.then(connection => {
connection.onClose(() => this.onDidCloseConnectionEmitter.fire(undefined));
this.onDidOpenConnectionEmitter.fire(undefined);
});
this.connectionPromise.then(function (connection) {
connection.onClose(function () {
return _this.onDidCloseConnectionEmitter.fire(undefined);
});
_this.onDidOpenConnectionEmitter.fire(undefined);
});
};
}
/**

@@ -298,31 +201,17 @@ * Process an incoming JSON-RPC method call.

*/
JsonRpcProxyFactory.prototype.onRequest = function (method) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
async onRequest(method, ...args) {
try {
return await this.target[method](...args);
}
return __awaiter(this, void 0, void 0, function () {
var error_1, e, reason, stack;
var _a;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
_b.trys.push([0, 2, , 3]);
return [4 /*yield*/, (_a = this.target)[method].apply(_a, __spreadArray([], __read(args), false))];
case 1: return [2 /*return*/, _b.sent()];
case 2:
error_1 = _b.sent();
e = this.serializeError(error_1);
if (e instanceof vscode_jsonrpc_1.ResponseError) {
throw e;
}
reason = e.message || '';
stack = e.stack || '';
console.error("Request ".concat(method, " failed with error: ").concat(reason), stack);
throw e;
case 3: return [2 /*return*/];
}
});
});
};
catch (error) {
const e = this.serializeError(error);
if (e instanceof vscode_jsonrpc_1.ResponseError) {
throw e;
}
const reason = e.message || '';
const stack = e.stack || '';
console.error(`Request ${method} failed with error: ${reason}`, stack);
throw e;
}
}
/**

@@ -334,10 +223,5 @@ * Process an incoming JSON-RPC notification.

*/
JsonRpcProxyFactory.prototype.onNotification = function (method) {
var _a;
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
(_a = this.target)[method].apply(_a, __spreadArray([], __read(args), false));
};
onNotification(method, ...args) {
this.target[method](...args);
}
/**

@@ -352,6 +236,6 @@ * Return whether the given property represents a notification.

*/
JsonRpcProxyFactory.prototype.isNotification = function (p) {
isNotification(p) {
return p.toString().startsWith('notify') || p.toString().startsWith('on');
};
JsonRpcProxyFactory.prototype.serializeError = function (e) {
}
serializeError(e) {
if (application_common_1.ApplicationError.is(e)) {

@@ -361,12 +245,12 @@ return new vscode_jsonrpc_1.ResponseError(e.code, '', Object.assign({ kind: 'application' }, e.toJson()));

return e;
};
JsonRpcProxyFactory.prototype.deserializeError = function (capturedError, e) {
}
deserializeError(capturedError, e) {
if (e instanceof vscode_jsonrpc_1.ResponseError) {
var capturedStack = capturedError.stack || '';
const capturedStack = capturedError.stack || '';
if (e.data && e.data.kind === 'application') {
var _a = e.data, stack = _a.stack, data = _a.data, message = _a.message;
const { stack, data, message } = e.data;
return application_common_1.ApplicationError.fromJson(e.code, {
message: message || capturedError.message,
data: data,
stack: "".concat(capturedStack, "\nCaused by: ").concat(stack)
data,
stack: `${capturedStack}\nCaused by: ${stack}`
});

@@ -377,6 +261,5 @@ }

return e;
};
return JsonRpcProxyFactory;
}());
}
}
exports.JsonRpcProxyFactory = JsonRpcProxyFactory;
//# sourceMappingURL=proxy-factory.js.map

@@ -17,23 +17,7 @@ "use strict";

********************************************************************************/
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.WebSocketChannel = void 0;
var utils_1 = require("@gedit/utils");
var WebSocketChannel = /** @class */ (function () {
function WebSocketChannel(id, doSend) {
const utils_1 = require("@gedit/utils");
class WebSocketChannel {
constructor(id, doSend) {
this.id = id;

@@ -44,13 +28,13 @@ this.doSend = doSend;

this.closing = false;
this.fireError = function () {
this.fireError = () => {
};
this.fireOpen = function () {
this.fireOpen = () => {
};
this.fireMessage = function () {
this.fireMessage = () => {
};
}
WebSocketChannel.prototype.dispose = function () {
dispose() {
this.toDispose.dispose();
};
WebSocketChannel.prototype.handleMessage = function (message) {
}
handleMessage(message) {
if (message.kind === 'ready') {

@@ -65,4 +49,4 @@ this.fireOpen();

}
};
WebSocketChannel.prototype.open = function (path) {
}
open(path) {
this.checkNotDisposed();

@@ -72,6 +56,6 @@ this.doSend(JSON.stringify({

id: this.id,
path: path
path
}));
};
WebSocketChannel.prototype.ready = function () {
}
ready() {
this.checkNotDisposed();

@@ -82,4 +66,4 @@ this.doSend(JSON.stringify({

}));
};
WebSocketChannel.prototype.send = function (content) {
}
send(content) {
this.checkNotDisposed();

@@ -89,8 +73,6 @@ this.doSend(JSON.stringify({

id: this.id,
content: content
content
}));
};
WebSocketChannel.prototype.close = function (code, reason) {
if (code === void 0) { code = 1000; }
if (reason === void 0) { reason = ''; }
}
close(code = 1000, reason = '') {
if (this.closing) {

@@ -104,10 +86,8 @@ // Do not try to close the channel if it is already closing.

id: this.id,
code: code,
reason: reason
code,
reason
}));
this.fireClose(code, reason);
};
WebSocketChannel.prototype.tryClose = function (code, reason) {
if (code === void 0) { code = 1000; }
if (reason === void 0) { reason = ''; }
}
tryClose(code = 1000, reason = '') {
if (this.closing || this.toDispose.disposed) {

@@ -120,41 +100,35 @@ // Do not try to close the channel if it is already closing or disposed.

id: this.id,
code: code,
reason: reason
code,
reason
}));
this.fireClose(code, reason);
};
WebSocketChannel.prototype.onOpen = function (cb) {
var _this = this;
}
onOpen(cb) {
this.checkNotDisposed();
this.fireOpen = cb;
this.toDispose.push(utils_1.Disposable.create(function () { return _this.fireOpen = function () {
}; }));
};
WebSocketChannel.prototype.onMessage = function (cb) {
var _this = this;
this.toDispose.push(utils_1.Disposable.create(() => this.fireOpen = () => {
}));
}
onMessage(cb) {
this.checkNotDisposed();
this.fireMessage = cb;
this.toDispose.push(utils_1.Disposable.create(function () { return _this.fireMessage = function () {
}; }));
};
WebSocketChannel.prototype.onError = function (cb) {
var _this = this;
this.toDispose.push(utils_1.Disposable.create(() => this.fireMessage = () => {
}));
}
onError(cb) {
this.checkNotDisposed();
this.fireError = cb;
this.toDispose.push(utils_1.Disposable.create(function () { return _this.fireError = function () {
}; }));
};
WebSocketChannel.prototype.onClose = function (cb) {
this.toDispose.push(utils_1.Disposable.create(() => this.fireError = () => {
}));
}
onClose(cb) {
this.checkNotDisposed();
return this.closeEmitter.event(function (_a) {
var _b = __read(_a, 2), code = _b[0], reason = _b[1];
return cb(code, reason);
});
};
WebSocketChannel.prototype.checkNotDisposed = function () {
return this.closeEmitter.event(([code, reason]) => cb(code, reason));
}
checkNotDisposed() {
if (this.toDispose.disposed) {
throw new Error('The channel has been disposed.');
}
};
WebSocketChannel.prototype.fireClose = function (code, reason) {
}
fireClose(code, reason) {
if (this.closing) {

@@ -171,7 +145,6 @@ return;

this.dispose();
};
WebSocketChannel.wsPath = '/services';
return WebSocketChannel;
}());
}
}
exports.WebSocketChannel = WebSocketChannel;
WebSocketChannel.wsPath = '/services';
//# sourceMappingURL=web-socket-channel.js.map

@@ -17,13 +17,2 @@ "use strict";

********************************************************************************/
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {

@@ -38,128 +27,73 @@ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;

};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ProgressService = void 0;
var inversify_1 = require("inversify");
var message_service_protocol_1 = require("./message-service-protocol");
var utils_1 = require("@gedit/utils");
var progress_service_protocol_1 = require("./progress-service-protocol");
var message_service_1 = require("./message-service");
var ProgressService = /** @class */ (function () {
function ProgressService() {
const inversify_1 = require("inversify");
const message_service_protocol_1 = require("./message-service-protocol");
const utils_1 = require("@gedit/utils");
const progress_service_protocol_1 = require("./progress-service-protocol");
const message_service_1 = require("./message-service");
let ProgressService = class ProgressService {
constructor() {
this.progressIdPrefix = Math.random().toString(36).substring(5);
this.counter = 0;
}
ProgressService.prototype.showProgress = function (message, onDidCancel) {
return __awaiter(this, void 0, void 0, function () {
var id, cancellationSource, report, actions, clientMessage, result;
var _this = this;
return __generator(this, function (_a) {
if (this.shouldDelegate(message)) {
return [2 /*return*/, this.messageService.showProgress(message, onDidCancel)];
async showProgress(message, onDidCancel) {
if (this.shouldDelegate(message)) {
return this.messageService.showProgress(message, onDidCancel);
}
const id = this.newProgressId();
const cancellationSource = new utils_1.CancellationTokenSource();
const report = (update) => {
this.client.reportProgress(id, update, message, cancellationSource.token);
};
const actions = new Set(message.actions);
if (message_service_protocol_1.ProgressMessage.isCancelable(message)) {
actions.delete(message_service_protocol_1.ProgressMessage.Cancel);
actions.add(message_service_protocol_1.ProgressMessage.Cancel);
}
const clientMessage = Object.assign(Object.assign({}, message), { actions: Array.from(actions) });
const result = this.client.showProgress(id, clientMessage, cancellationSource.token);
if (message_service_protocol_1.ProgressMessage.isCancelable(message) && typeof onDidCancel === 'function') {
result.then(value => {
if (value === message_service_protocol_1.ProgressMessage.Cancel) {
onDidCancel();
}
id = this.newProgressId();
cancellationSource = new utils_1.CancellationTokenSource();
report = function (update) {
_this.client.reportProgress(id, update, message, cancellationSource.token);
};
actions = new Set(message.actions);
if (message_service_protocol_1.ProgressMessage.isCancelable(message)) {
actions.delete(message_service_protocol_1.ProgressMessage.Cancel);
actions.add(message_service_protocol_1.ProgressMessage.Cancel);
}
clientMessage = __assign(__assign({}, message), { actions: Array.from(actions) });
result = this.client.showProgress(id, clientMessage, cancellationSource.token);
if (message_service_protocol_1.ProgressMessage.isCancelable(message) && typeof onDidCancel === 'function') {
result.then(function (value) {
if (value === message_service_protocol_1.ProgressMessage.Cancel) {
onDidCancel();
}
});
}
return [2 /*return*/, {
id: id,
cancel: function () { return cancellationSource.cancel(); },
result: result,
report: report
}];
});
});
};
ProgressService.prototype.withProgress = function (text, locationId, task) {
return __awaiter(this, void 0, void 0, function () {
var progress;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.showProgress({ text: text, options: { cancelable: true, location: locationId } })];
case 1:
progress = _a.sent();
_a.label = 2;
case 2:
_a.trys.push([2, , 4, 5]);
return [4 /*yield*/, task()];
case 3: return [2 /*return*/, _a.sent()];
case 4:
progress.cancel();
return [7 /*endfinally*/];
case 5: return [2 /*return*/];
}
});
});
};
ProgressService.prototype.shouldDelegate = function (message) {
var location = message.options && message.options.location;
}
return {
id,
cancel: () => cancellationSource.cancel(),
result,
report
};
}
async withProgress(text, locationId, task) {
const progress = await this.showProgress({ text, options: { cancelable: true, location: locationId } });
try {
return await task();
}
finally {
progress.cancel();
}
}
shouldDelegate(message) {
const location = message.options && message.options.location;
return location === 'notification';
};
ProgressService.prototype.newProgressId = function () {
return "".concat(this.progressIdPrefix, "-").concat(++this.counter);
};
__decorate([
(0, inversify_1.inject)(progress_service_protocol_1.ProgressClient),
__metadata("design:type", Object)
], ProgressService.prototype, "client", void 0);
__decorate([
(0, inversify_1.inject)(message_service_1.MessageService),
__metadata("design:type", message_service_1.MessageService)
], ProgressService.prototype, "messageService", void 0);
ProgressService = __decorate([
(0, inversify_1.injectable)()
], ProgressService);
return ProgressService;
}());
}
newProgressId() {
return `${this.progressIdPrefix}-${++this.counter}`;
}
};
__decorate([
(0, inversify_1.inject)(progress_service_protocol_1.ProgressClient),
__metadata("design:type", Object)
], ProgressService.prototype, "client", void 0);
__decorate([
(0, inversify_1.inject)(message_service_1.MessageService),
__metadata("design:type", message_service_1.MessageService)
], ProgressService.prototype, "messageService", void 0);
ProgressService = __decorate([
(0, inversify_1.injectable)()
], ProgressService);
exports.ProgressService = ProgressService;
//# sourceMappingURL=progress-service.js.map
{
"name": "@gedit/connection",
"version": "0.1.68",
"version": "0.1.69",
"license": "MIT",

@@ -12,4 +12,4 @@ "main": "lib/common/index",

"dependencies": {
"@gedit/application-common": "^0.1.68",
"@gedit/utils": "^0.1.69",
"@gedit/application-common": "^0.1.69",
"@gedit/utils": "^0.1.70",
"@types/lodash.throttle": "^4.1.3",

@@ -36,3 +36,3 @@ "lodash.throttle": "^4.1.1",

},
"gitHead": "1bb1a2c9de07b987e6e1c15053e7278766cbe23c"
"gitHead": "8bdf36b3a3898da871ec15be92760865fc6a182a"
}

@@ -21,3 +21,3 @@ /********************************************************************************

import { ApplicationError } from '@gedit/application-common';
import { Emitter, Event, Disposable } from '@gedit/utils';
import { Disposable, Emitter, Event } from '@gedit/utils';
import { ConnectionHandler } from './handler';

@@ -124,10 +124,4 @@

listen(connection: MessageConnection): void {
if (this.target) {
for (const prop in this.target) {
if (typeof this.target[prop] === 'function') {
connection.onRequest(prop, (...args) => this.onRequest(prop, ...args));
connection.onNotification(prop, (...args) => this.onNotification(prop, ...args));
}
}
}
connection.onRequest((prop, ...args) => this.onRequest(prop, ...args));
connection.onNotification((prop, ...args) => this.onNotification(prop, ...args));
connection.onDispose(() => this.waitForConnection());

@@ -134,0 +128,0 @@ connection.listen();

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

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

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