@jupyter/docprovider 3.0.0-beta.5 → 3.0.0-beta.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.d.ts CHANGED
@@ -7,5 +7,4 @@ export * from './notebookCellExecutor';
7
7
  export * from './requests';
8
8
  export * from './ydrive';
9
9
  export * from './yprovider';
10
- export * from './tokens';
11
10
  export * from './TimelineSlider';
package/lib/index.js CHANGED
@@ -11,5 +11,4 @@ export * from './notebookCellExecutor';
11
11
  export * from './requests';
12
12
  export * from './ydrive';
13
13
  export * from './yprovider';
14
- export * from './tokens';
15
14
  export * from './TimelineSlider';
package/lib/ydrive.d.ts CHANGED
@@ -2,7 +2,7 @@ import { TranslationBundle } from '@jupyterlab/translation';
2
2
  import { Contents, Drive, User } from '@jupyterlab/services';
3
3
  import { ISignal } from '@lumino/signaling';
4
4
  import { WebSocketProvider } from './yprovider';
5
- import { ICollaborativeDrive, ISharedModelFactory } from './tokens';
5
+ import { ICollaborativeDrive, ISharedModelFactory } from '@jupyter/collaborative-drive';
6
6
  import { Awareness } from 'y-protocols/awareness';
7
7
  export interface IForkProvider {
8
8
  connectToForkDoc: (forkRoomId: string, sessionId: string) => Promise<void>;
package/lib/ydrive.js CHANGED
@@ -195,7 +195,7 @@ class SharedModelFactory {
195
195
  * Whether the IDrive supports real-time collaboration or not.
196
196
  */
197
197
  this.collaborative = !DISABLE_RTC;
198
- this._documentFactories = new Map();
198
+ this.documentFactories = new Map();
199
199
  }
200
200
  /**
201
201
  * Register a SharedDocumentFactory.
@@ -204,10 +204,10 @@ class SharedModelFactory {
204
204
  * @param factory Document factory
205
205
  */
206
206
  registerDocumentFactory(type, factory) {
207
- if (this._documentFactories.has(type)) {
207
+ if (this.documentFactories.has(type)) {
208
208
  throw new Error(`The content type ${type} already exists`);
209
209
  }
210
- this._documentFactories.set(type, factory);
210
+ this.documentFactories.set(type, factory);
211
211
  }
212
212
  /**
213
213
  * Create a new `ISharedDocument` instance.
@@ -224,8 +224,8 @@ class SharedModelFactory {
224
224
  // the `sharedModel` will be the default one.
225
225
  return;
226
226
  }
227
- if (this._documentFactories.has(options.contentType)) {
228
- const factory = this._documentFactories.get(options.contentType);
227
+ if (this.documentFactories.has(options.contentType)) {
228
+ const factory = this.documentFactories.get(options.contentType);
229
229
  const sharedModel = factory(options);
230
230
  this._onCreate(options, sharedModel);
231
231
  return sharedModel;
@@ -1,18 +1,9 @@
1
+ import { IDocumentProvider } from '@jupyter/collaborative-drive';
1
2
  import { User } from '@jupyterlab/services';
2
3
  import { TranslationBundle } from '@jupyterlab/translation';
3
- import { IDisposable } from '@lumino/disposable';
4
4
  import { DocumentChange, YDocument } from '@jupyter/ydoc';
5
5
  import { WebsocketProvider as YWebsocketProvider } from 'y-websocket';
6
6
  import { IForkProvider } from './ydrive';
7
- /**
8
- * An interface for a document provider.
9
- */
10
- export interface IDocumentProvider extends IDisposable {
11
- /**
12
- * Returns a Promise that resolves when the document provider is ready.
13
- */
14
- readonly ready: Promise<void>;
15
- }
16
7
  /**
17
8
  * A class to provide Yjs synchronization over WebSocket.
18
9
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jupyter/docprovider",
3
- "version": "3.0.0-beta.5",
3
+ "version": "3.0.0-beta.8",
4
4
  "description": "JupyterLab - Document Provider",
5
5
  "homepage": "https://github.com/jupyterlab/jupyter-collaboration",
6
6
  "bugs": {
@@ -41,6 +41,7 @@
41
41
  "watch": "tsc -b --watch"
42
42
  },
43
43
  "dependencies": {
44
+ "@jupyter/collaborative-drive": "^3.0.0-beta.8",
44
45
  "@jupyter/ydoc": "^2.0.0 || ^3.0.0-a3",
45
46
  "@jupyterlab/apputils": "^4.2.0",
46
47
  "@jupyterlab/cells": "^4.2.0",
@@ -70,5 +71,13 @@
70
71
  "entryPoint": "./src/index.ts",
71
72
  "displayName": "@jupyter/docprovider",
72
73
  "tsconfig": "./tsconfig.json"
74
+ },
75
+ "jupyterlab": {
76
+ "sharedPackages": {
77
+ "@jupyter/collaborative-drive": {
78
+ "bundled": true,
79
+ "singleton": true
80
+ }
81
+ }
73
82
  }
74
83
  }
package/lib/tokens.d.ts DELETED
@@ -1,39 +0,0 @@
1
- import { DocumentChange, YDocument } from '@jupyter/ydoc';
2
- import { Contents } from '@jupyterlab/services';
3
- import { Token } from '@lumino/coreutils';
4
- import { WebSocketProvider } from './yprovider';
5
- /**
6
- * The collaborative drive.
7
- */
8
- export declare const ICollaborativeDrive: Token<ICollaborativeDrive>;
9
- /**
10
- * The global awareness token.
11
- */
12
- export declare const IGlobalAwareness: Token<import("y-protocols/awareness").Awareness>;
13
- /**
14
- * A document factory for registering shared models
15
- */
16
- export type SharedDocumentFactory = (options: Contents.ISharedFactoryOptions) => YDocument<DocumentChange>;
17
- /**
18
- * A Collaborative implementation for an `IDrive`, talking to the
19
- * server using the Jupyter REST API and a WebSocket connection.
20
- */
21
- export interface ICollaborativeDrive extends Contents.IDrive {
22
- /**
23
- * SharedModel factory for the YDrive.
24
- */
25
- readonly sharedModelFactory: ISharedModelFactory;
26
- readonly providers: Map<string, WebSocketProvider>;
27
- }
28
- /**
29
- * Yjs sharedModel factory for real-time collaboration.
30
- */
31
- export interface ISharedModelFactory extends Contents.ISharedFactory {
32
- /**
33
- * Register a SharedDocumentFactory.
34
- *
35
- * @param type Document type
36
- * @param factory Document factory
37
- */
38
- registerDocumentFactory(type: Contents.ContentType, factory: SharedDocumentFactory): void;
39
- }
package/lib/tokens.js DELETED
@@ -1,11 +0,0 @@
1
- // Copyright (c) Jupyter Development Team.
2
- // Distributed under the terms of the Modified BSD License.
3
- import { Token } from '@lumino/coreutils';
4
- /**
5
- * The collaborative drive.
6
- */
7
- export const ICollaborativeDrive = new Token('@jupyter/collaboration-extension:ICollaborativeDrive');
8
- /**
9
- * The global awareness token.
10
- */
11
- export const IGlobalAwareness = new Token('@jupyter/collaboration:IGlobalAwareness');