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

@jupyter/docprovider

Package Overview
Dependencies
Maintainers
9
Versions
57
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jupyter/docprovider - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

8

lib/utils.d.ts
export declare enum MessageType {
ROOM = 124,
CHAT = 125
}
export declare enum RoomMessage {
RELOAD = 0,
OVERWRITE = 1,
FILE_CHANGED = 2,
FILE_OVERWRITTEN = 3,
DOC_OVERWRITTEN = 4
}

@@ -7,12 +7,3 @@ /* -----------------------------------------------------------------------------

(function (MessageType) {
MessageType[MessageType["ROOM"] = 124] = "ROOM";
MessageType[MessageType["CHAT"] = 125] = "CHAT";
})(MessageType || (MessageType = {}));
export var RoomMessage;
(function (RoomMessage) {
RoomMessage[RoomMessage["RELOAD"] = 0] = "RELOAD";
RoomMessage[RoomMessage["OVERWRITE"] = 1] = "OVERWRITE";
RoomMessage[RoomMessage["FILE_CHANGED"] = 2] = "FILE_CHANGED";
RoomMessage[RoomMessage["FILE_OVERWRITTEN"] = 3] = "FILE_OVERWRITTEN";
RoomMessage[RoomMessage["DOC_OVERWRITTEN"] = 4] = "DOC_OVERWRITTEN";
})(RoomMessage || (RoomMessage = {}));

@@ -43,7 +43,2 @@ import { User } from '@jupyterlab/services';

private _onSync;
private _handleRoomMessage;
private _handleFileChanged;
private _sendReloadMsg;
private _sendOverwriteMsg;
private _dialog;
private _awareness;

@@ -50,0 +45,0 @@ private _contentType;

@@ -8,7 +8,4 @@ /* -----------------------------------------------------------------------------

import { Signal } from '@lumino/signaling';
import * as decoding from 'lib0/decoding';
import * as encoding from 'lib0/encoding';
import { WebsocketProvider as YWebsocketProvider } from 'y-websocket';
import { requestDocSession } from './requests';
import { MessageType, RoomMessage } from './utils';
/**

@@ -45,3 +42,2 @@ * A class to provide Yjs synchronization over WebSocket.

};
this._dialog = null;
this._ready = new PromiseDelegate();

@@ -101,7 +97,2 @@ this._isDisposed = false;

this._yWebsocketProvider.on('connection-close', this._onConnectionClosed);
this._yWebsocketProvider.messageHandlers[MessageType.ROOM] = (encoder, decoder, provider, emitSynced, messageType) => {
const msgType = decoding.readVarUint(decoder);
const data = decoding.readVarString(decoder);
this._handleRoomMessage(msgType, data);
};
}

@@ -111,51 +102,2 @@ _onUserChanged(user) {

}
_handleRoomMessage(type, data) {
switch (type) {
case RoomMessage.FILE_CHANGED:
this._handleFileChanged(data);
break;
case RoomMessage.DOC_OVERWRITTEN:
case RoomMessage.FILE_OVERWRITTEN:
if (this._dialog) {
this._dialog.close();
this._dialog = null;
}
break;
}
}
_handleFileChanged(data) {
this._dialog = new Dialog({
title: this._trans.__('File changed'),
body: this._trans.__('Do you want to overwrite the file or reload it?'),
buttons: [
Dialog.okButton({ label: 'Reload' }),
Dialog.warnButton({ label: 'Overwrite' })
],
hasClose: false
});
this._dialog.launch().then(resp => {
if (resp.button.label === 'Reload') {
this._sendReloadMsg(data);
}
else if (resp.button.label === 'Overwrite') {
this._sendOverwriteMsg(data);
}
});
}
_sendReloadMsg(data) {
var _a;
const encoder = encoding.createEncoder();
encoding.writeVarUint(encoder, MessageType.ROOM);
encoding.writeVarUint(encoder, RoomMessage.RELOAD);
encoding.writeVarString(encoder, data);
(_a = this._yWebsocketProvider) === null || _a === void 0 ? void 0 : _a.ws.send(encoding.toUint8Array(encoder));
}
_sendOverwriteMsg(data) {
var _a;
const encoder = encoding.createEncoder();
encoding.writeVarUint(encoder, MessageType.ROOM);
encoding.writeVarUint(encoder, RoomMessage.OVERWRITE);
encoding.writeVarString(encoder, data);
(_a = this._yWebsocketProvider) === null || _a === void 0 ? void 0 : _a.ws.send(encoding.toUint8Array(encoder));
}
}

2

package.json
{
"name": "@jupyter/docprovider",
"version": "2.0.0",
"version": "2.0.1",
"description": "JupyterLab - Document Provider",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/jupyterlab/jupyter-collaboration",

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