Socket
Socket
Sign inDemoInstall

@jupyter/ydoc

Package Overview
Dependencies
Maintainers
7
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jupyter/ydoc - npm Package Compare versions

Comparing version 0.3.0-a2 to 0.3.0-a3

41

lib/api.d.ts

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

/**
* A factory interface for creating `ISharedDocument` objects.
*/
export interface IFactory {
/**
* Create a new `ISharedDocument` instance.
*/
createNew(options: IFactory.IOptions): ISharedDocument;
}
/**
* The namespace for `IFactory`.
*/
export declare namespace IFactory {
/**
* The options used to instantiate a ISharedDocument
*/
interface IOptions {
/**
* The path of the file.
*/
path: string;
/**
* The format of the document.
*/
format: string;
/**
* The content type of the document.
*/
contentType: string;
/**
* Wether the document is collaborative or not.
*
* The default value is `true`.
*/
collaborative?: boolean;
}
}
/**
* ISharedBase defines common operations that can be performed on any shared object.

@@ -298,2 +335,6 @@ */

disableDocumentWideUndoRedo?: boolean;
/**
* The language preference for the model.
*/
languagePreference?: string;
}

@@ -300,0 +341,0 @@ }

2

lib/ynotebook.d.ts

@@ -34,3 +34,3 @@ import type * as nbformat from '@jupyterlab/nbformat';

*/
static create(): YNotebook;
static create(options?: ISharedNotebook.IOptions): YNotebook;
/**

@@ -37,0 +37,0 @@ * YJS map for the notebook metadata

@@ -165,5 +165,14 @@ /* -----------------------------------------------------------------------------

*/
static create() {
const ynotebook = new YNotebook();
ynotebook.ymeta.set('metadata', new Y.Map());
static create(options = {}) {
var _a, _b;
const ynotebook = new YNotebook({
disableDocumentWideUndoRedo: (_a = options.disableDocumentWideUndoRedo) !== null && _a !== void 0 ? _a : false
});
const ymetadata = new Y.Map();
ymetadata.set('language_info', { name: (_b = options.languagePreference) !== null && _b !== void 0 ? _b : '' });
ymetadata.set('kernelspec', {
name: '',
display_name: ''
});
ynotebook.ymeta.set('metadata', ymetadata);
return ynotebook;

@@ -370,3 +379,3 @@ }

else {
if (!JSONExt.deepEqual(this.metadata, metadata)) {
if (!this.metadata || !JSONExt.deepEqual(this.metadata, metadata)) {
const clone = JSONExt.deepCopy(metadata);

@@ -419,3 +428,12 @@ const ymetadata = this.ymeta.get('metadata');

}
this.metadata = metadata;
if (!this.metadata) {
const ymetadata = new Y.Map();
for (const [key, value] of Object.entries(metadata)) {
ymetadata.set(key, value);
}
this.ymeta.set('metadata', ymetadata);
}
else {
this.metadata = metadata;
}
const useId = value.nbformat === 4 && value.nbformat_minor >= 5;

@@ -422,0 +440,0 @@ const ycells = value.cells.map(cell => {

{
"name": "@jupyter/ydoc",
"version": "0.3.0-a2",
"version": "0.3.0-a3",
"type": "module",

@@ -5,0 +5,0 @@ "description": "Jupyter document structures for collaborative editing using YJS",

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