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

@jupyterlab/docprovider

Package Overview
Dependencies
Maintainers
27
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.1.0-alpha.10 to 3.1.0-alpha.11

30

lib/yprovider.d.ts
import { WebsocketProvider } from 'y-websocket';
import { IDocumentProviderFactory } from './tokens';
/**
* A class to provide Yjs synchronization over Websocket.
* A class to provide Yjs synchronization over WebSocket.
*/

@@ -17,10 +17,30 @@ export declare class WebSocketProviderWithLocks extends WebsocketProvider {

requestInitialContent(): Promise<boolean>;
onConnectionStatus(status: {
status: 'connected' | 'disconnected';
}): Promise<void>;
/**
* Put the initialized state.
*/
putInitializedState(): void;
/**
* Acquire a lock.
* Returns a Promise that resolves to the lock number.
*/
acquireLock(): Promise<number>;
/**
* Release a lock.
*
* @param lock The lock to release.
*/
releaseLock(lock: number): void;
/**
* Send a new message to WebSocket server.
*
* @param message The message to send
*/
private _sendMessage;
isInitialized: boolean;
/**
* Handle a change to the connection status.
*
* @param status The connection status.
*/
private _onConnectionStatus;
private _isInitialized;
private _currentLockRequest;

@@ -27,0 +47,0 @@ private _initialContentRequest;

52

lib/yprovider.js

@@ -10,3 +10,3 @@ /* -----------------------------------------------------------------------------

/**
* A class to provide Yjs synchronization over Websocket.
* A class to provide Yjs synchronization over WebSocket.
*/

@@ -51,5 +51,5 @@ export class WebSocketProviderWithLocks extends WebsocketProvider {

};
this.isInitialized = false;
this.onConnectionStatus = this.onConnectionStatus.bind(this);
this.on('status', this.onConnectionStatus);
this._isInitialized = false;
this._onConnectionStatus = this._onConnectionStatus.bind(this);
this.on('status', this._onConnectionStatus);
}

@@ -77,12 +77,5 @@ /**

}
async onConnectionStatus(status) {
if (this.isInitialized && status.status === 'connected') {
const lock = await this.acquireLock();
const contentIsInitialized = await this.requestInitialContent();
if (!contentIsInitialized) {
this.putInitializedState();
}
this.releaseLock(lock);
}
}
/**
* Put the initialized state.
*/
putInitializedState() {

@@ -93,4 +86,8 @@ const encoder = encoding.createEncoder();

this._sendMessage(encoding.toUint8Array(encoder));
this.isInitialized = true;
this._isInitialized = true;
}
/**
* Acquire a lock.
* Returns a Promise that resolves to the lock number.
*/
acquireLock() {

@@ -120,2 +117,7 @@ if (this._currentLockRequest) {

}
/**
* Release a lock.
*
* @param lock The lock to release.
*/
releaseLock(lock) {

@@ -129,2 +131,7 @@ const encoder = encoding.createEncoder();

}
/**
* Send a new message to WebSocket server.
*
* @param message The message to send
*/
_sendMessage(message) {

@@ -144,3 +151,18 @@ // send once connected

}
/**
* Handle a change to the connection status.
*
* @param status The connection status.
*/
async _onConnectionStatus(status) {
if (this._isInitialized && status.status === 'connected') {
const lock = await this.acquireLock();
const contentIsInitialized = await this.requestInitialContent();
if (!contentIsInitialized) {
this.putInitializedState();
}
this.releaseLock(lock);
}
}
}
//# sourceMappingURL=yprovider.js.map
{
"name": "@jupyterlab/docprovider",
"version": "3.1.0-alpha.10",
"version": "3.1.0-alpha.11",
"description": "JupyterLab - Document Provider",

@@ -41,10 +41,10 @@ "homepage": "https://github.com/jupyterlab/jupyterlab",

"dependencies": {
"@jupyterlab/shared-models": "^3.1.0-alpha.10",
"@jupyterlab/shared-models": "^3.1.0-alpha.11",
"@lumino/coreutils": "^1.5.3",
"lib0": "^0.2.41",
"y-websocket": "^1.3.11",
"yjs": "^13.5.3"
"lib0": "^0.2.42",
"y-websocket": "^1.3.15",
"yjs": "^13.5.6"
},
"devDependencies": {
"@jupyterlab/testutils": "^3.1.0-alpha.10",
"@jupyterlab/testutils": "^3.1.0-alpha.11",
"@types/jest": "^26.0.10",

@@ -59,3 +59,3 @@ "jest": "^26.4.2",

},
"gitHead": "f6fe5dec3231027d3270d785ced6c126b9e55755"
"gitHead": "98427f4503f8e6f7b8cec181f0626b798f46dc47"
}

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