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

@jupyterlab/docprovider

Package Overview
Dependencies
Maintainers
29
Versions
126
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jupyterlab/docprovider - npm Package Compare versions

Comparing version 3.3.0-alpha.15 to 3.3.0-alpha.16

5

lib/yprovider.d.ts
import { WebsocketProvider } from 'y-websocket';
import { IDocumentProvider, IDocumentProviderFactory } from './tokens';
import { IStateDB } from '@jupyterlab/statedb';
/**

@@ -73,7 +72,3 @@ * A class to provide Yjs synchronization over WebSocket.

url: string;
/**
* The state database
*/
state: IStateDB | null;
}
}

51

lib/yprovider.js

@@ -12,4 +12,2 @@ /* -----------------------------------------------------------------------------

import * as env from 'lib0/environment';
const PREFIX = '@jupyterlab/docprovider:yprovider';
const USER = `${PREFIX}:user`;
/**

@@ -41,6 +39,13 @@ * A class to provide Yjs synchronization over WebSocket.

this._serverUrl = options.url;
const color = '#' + env.getParam('--usercolor', getRandomColor().slice(1));
const name = env.getParam('--username', getAnonymousUserName());
const awareness = options.ymodel.awareness;
const currState = awareness.getLocalState();
let color = '#' + env.getParam('--usercolor', '');
let name = env.getParam('--username', '');
// only set if this was not already set by another plugin
if (currState && ((_a = currState.user) === null || _a === void 0 ? void 0 : _a.name) == null) {
options.ymodel.awareness.setLocalStateField('user', {
name,
color
});
}
// Message handler that confirms when a lock has been acquired

@@ -75,40 +80,2 @@ this.messageHandlers[127] = (encoder, decoder, provider, emitSynced, messageType) => {

this.on('status', this._onConnectionStatus);
const state = options.state;
if (name != '' || color != '#' || state == null) {
if (name == '') {
name = getAnonymousUserName();
}
if (color == '#') {
color = '#' + getRandomColor().slice(1);
}
// only set if this was not already set by another plugin
if (currState && ((_a = currState.user) === null || _a === void 0 ? void 0 : _a.name) == null) {
options.ymodel.awareness.setLocalStateField('user', {
name,
color
});
}
return;
}
const user = state.fetch(USER);
void user.then(param => {
var _a;
if (param === undefined) {
name = getAnonymousUserName();
color = '#' + getRandomColor().slice(1);
void state.save(USER, { userName: name, userColor: color });
}
else {
const { userName, userColor } = param;
name = userName;
color = userColor;
}
// only set if this was not already set by another plugin
if (currState && ((_a = currState.user) === null || _a === void 0 ? void 0 : _a.name) == null) {
options.ymodel.awareness.setLocalStateField('user', {
name,
color
});
}
});
}

@@ -115,0 +82,0 @@ setPath(newPath) {

9

package.json
{
"name": "@jupyterlab/docprovider",
"version": "3.3.0-alpha.15",
"version": "3.3.0-alpha.16",
"description": "JupyterLab - Document Provider",

@@ -40,5 +40,4 @@ "homepage": "https://github.com/jupyterlab/jupyterlab",

"dependencies": {
"@jupyterlab/shared-models": "^3.3.0-alpha.15",
"@jupyterlab/statedb": "^3.3.0-alpha.15",
"@lumino/coreutils": "^1.10.0",
"@jupyterlab/shared-models": "^3.3.0-alpha.16",
"@lumino/coreutils": "^1.5.3",
"lib0": "^0.2.42",

@@ -49,3 +48,3 @@ "y-websocket": "^1.3.15",

"devDependencies": {
"@jupyterlab/testutils": "^3.3.0-alpha.15",
"@jupyterlab/testutils": "^3.3.0-alpha.16",
"@types/jest": "^26.0.10",

@@ -52,0 +51,0 @@ "jest": "^26.4.2",

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