Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Tests

on:
push:
branches:
- main
pull_request:
branches:
- main

defaults:
run:
shell: bash -l {0}

jobs:
build:
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ['3.14']

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Conda environment with Micromamba
uses: mamba-org/setup-micromamba@v1
with:
environment-name: ci
channels: conda-forge
create-args: >-
python=${{ matrix.python-version }}
jupyterlab
python-build

- name: Test TS build
run: |
jlpm
jlpm run build

- name: Test Python build
run: python -m build
10 changes: 5 additions & 5 deletions packages/my-shared-docprovider-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@
"watch:labextension": "jupyter labextension watch ."
},
"dependencies": {
"@jupyter/collaborative-drive": "^4.0.0",
"@jupyter/collaborative-drive": "^4.1.1",
"@jupyter/my-shared-docprovider": "^0.2.1",
"@jupyterlab/filebrowser": "^4.4.0",
"@jupyterlab/fileeditor": "^4.4.0",
"@jupyterlab/notebook": "^4.4.0"
"@jupyterlab/filebrowser": "^4.5.0",
"@jupyterlab/fileeditor": "^4.5.0",
"@jupyterlab/notebook": "^4.5.0"
},
"devDependencies": {
"@jupyterlab/builder": "^4.4.0",
"@jupyterlab/builder": "^4.5.0",
"npm-run-all": "^4.1.5",
"rimraf": "^4.1.2",
"typescript": "~5.0.4"
Expand Down
3 changes: 1 addition & 2 deletions packages/my-shared-docprovider-extension/src/filebrowser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ export const rtcContentProvider: JupyterFrontEndPlugin<ICollaborativeContentProv
);
}
const rtcContentProvider = new RtcContentProvider(app, {
apiEndpoint: '/api/contents',
serverSettings: defaultDrive.serverSettings,
currentDrive: defaultDrive,
user: app.serviceManager.user,
trans
});
Expand Down
8 changes: 4 additions & 4 deletions packages/my-shared-docprovider/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@
"watch": "tsc -b --watch"
},
"dependencies": {
"@jupyter/collaborative-drive": "^4.0.0",
"@jupyter/collaborative-drive": "^4.1.1",
"@jupyter/ydoc": "^2.0.0 || ^3.0.0",
"@jupyterlab/application": "^4.4.0",
"@jupyterlab/services": "^7.4.0",
"@jupyterlab/translation": "^4.4.0",
"@jupyterlab/application": "^4.5.0",
"@jupyterlab/services": "^7.5.0",
"@jupyterlab/translation": "^4.5.0",
"@lumino/signaling": "^2.1.0"
},
"devDependencies": {
Expand Down
30 changes: 19 additions & 11 deletions packages/my-shared-docprovider/src/drive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { TranslationBundle } from '@jupyterlab/translation';
import {
Contents,
IContentProvider,
RestContentProvider,
SharedDocumentFactory,
User
} from '@jupyterlab/services';
Expand All @@ -21,26 +20,24 @@ import {
} from '@jupyter/collaborative-drive';

namespace RtcContentProvider {
export interface IOptions extends RestContentProvider.IOptions {
export interface IOptions {
currentDrive: Contents.IDrive;
user: User.IManager;
trans: TranslationBundle;
}
}

export class RtcContentProvider
extends RestContentProvider
implements IContentProvider
{
export class RtcContentProvider implements IContentProvider {
/**
* Construct a new drive object.
*
* @param user - The user manager to add the identity to the awareness of documents.
*/
constructor(app: JupyterFrontEnd, options: RtcContentProvider.IOptions) {
super(options);
this._app = app;
this._user = options.user;
this._trans = options.trans;
this._currentDrive = options.currentDrive;
this._providers = new Map<string, MyProvider>();
this.sharedModelFactory = new SharedModelFactory(this._onCreate);
this._saveLock = new AsyncLock();
Expand Down Expand Up @@ -80,7 +77,11 @@ export class RtcContentProvider
// Use `Promise.all` to reject as soon as possible. The Context will
// show a dialog to the user.
const [model] = await Promise.all([
super.get(localPath, { ...options, content: false }),
this._currentDrive.get(localPath, {
...options,
content: false,
contentProviderId: undefined
}),
provider.ready
]);
// The server doesn't return a model with a format when content is false,
Expand All @@ -89,7 +90,10 @@ export class RtcContentProvider
}
}

return await super.get(localPath, options);
return await this._currentDrive.get(localPath, {
...options,
contentProviderId: undefined
});
}

async listCheckpoints(path: string): Promise<Contents.ICheckpointModel[]> {
Expand Down Expand Up @@ -132,7 +136,7 @@ export class RtcContentProvider
*/
async save(
localPath: string,
options: Partial<Contents.IModel> = {}
options: Partial<Contents.IModel> & Contents.IContentProvisionOptions = {}
): Promise<Contents.IModel> {
// Check that there is a provider - it won't e.g. if the document model is not collaborative.
if (options.format && options.type) {
Expand All @@ -150,7 +154,10 @@ export class RtcContentProvider
}
}

return await super.save(localPath, options);
return await this._currentDrive.save(localPath, {
...options,
contentProviderId: undefined
});
}

/**
Expand Down Expand Up @@ -254,6 +261,7 @@ export class RtcContentProvider
return sharedModel;
};

private _currentDrive: Contents.IDrive;
private _app: JupyterFrontEnd;
private _user: User.IManager;
private _trans: TranslationBundle;
Expand Down
4 changes: 1 addition & 3 deletions typedoc.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
{
"entryPointStrategy": "packages",
"entryPoints": [
"packages/my-shared-docprovider"
],
"entryPoints": ["packages/my-shared-docprovider"],
"externalSymbolLinkMappings": {
"@codemirror/state": {
"Extension": "https://codemirror.net/docs/ref/#state.Extension"
Expand Down
Loading
Loading