@jupyter/docprovider-extension 3.0.0-alpha.2 → 3.0.0-beta.1

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/executor.js CHANGED
@@ -4,8 +4,8 @@
4
4
  * @packageDocumentation
5
5
  * @module docprovider-extension
6
6
  */
7
- import { PageConfig, URLExt } from '@jupyterlab/coreutils';
8
- import { ServerConnection } from '@jupyterlab/services';
7
+ import { NotebookCellServerExecutor } from '@jupyter/docprovider';
8
+ import { PageConfig } from '@jupyterlab/coreutils';
9
9
  import { INotebookCellExecutor, runCell } from '@jupyterlab/notebook';
10
10
  export const notebookCellExecutor = {
11
11
  id: '@jupyter/docprovider-extension:notebook-cell-executor',
@@ -14,40 +14,10 @@ export const notebookCellExecutor = {
14
14
  provides: INotebookCellExecutor,
15
15
  activate: (app) => {
16
16
  if (PageConfig.getOption('serverSideExecution') === 'true') {
17
- return Object.freeze({ runCell: runCellServerSide });
17
+ return new NotebookCellServerExecutor({
18
+ serverSettings: app.serviceManager.serverSettings
19
+ });
18
20
  }
19
21
  return Object.freeze({ runCell });
20
22
  }
21
23
  };
22
- async function runCellServerSide({ cell, notebook, notebookConfig, onCellExecuted, onCellExecutionScheduled, sessionContext, sessionDialogs, translator }) {
23
- var _a, _b;
24
- switch (cell.model.type) {
25
- case 'markdown':
26
- cell.rendered = true;
27
- cell.inputHidden = false;
28
- onCellExecuted({ cell, success: true });
29
- break;
30
- case 'code': {
31
- const kernelId = (_b = (_a = sessionContext === null || sessionContext === void 0 ? void 0 : sessionContext.session) === null || _a === void 0 ? void 0 : _a.kernel) === null || _b === void 0 ? void 0 : _b.id;
32
- const settings = ServerConnection.makeSettings();
33
- const apiURL = URLExt.join(settings.baseUrl, `api/kernels/${kernelId}/execute`);
34
- const cellId = cell.model.sharedModel.getId();
35
- const documentId = `json:notebook:${notebook.sharedModel.getState('file_id')}`;
36
- const body = `{"cell_id":"${cellId}","document_id":"${documentId}"}`;
37
- const init = {
38
- method: 'POST',
39
- body
40
- };
41
- try {
42
- await ServerConnection.makeRequest(apiURL, init, settings);
43
- }
44
- catch (error) {
45
- throw new ServerConnection.NetworkError(error);
46
- }
47
- break;
48
- }
49
- default:
50
- break;
51
- }
52
- return Promise.resolve(true);
53
- }
@@ -11,7 +11,7 @@ import { INotebookTracker } from '@jupyterlab/notebook';
11
11
  import { ISettingRegistry } from '@jupyterlab/settingregistry';
12
12
  import { ITranslator, nullTranslator } from '@jupyterlab/translation';
13
13
  import { YFile, YNotebook } from '@jupyter/ydoc';
14
- import { ICollaborativeDrive, YDrive } from '@jupyter/docprovider';
14
+ import { ICollaborativeDrive, IGlobalAwareness, YDrive } from '@jupyter/docprovider';
15
15
  /**
16
16
  * The command IDs used by the file browser plugin.
17
17
  */
@@ -27,10 +27,10 @@ export const drive = {
27
27
  description: 'The default collaborative drive provider',
28
28
  provides: ICollaborativeDrive,
29
29
  requires: [ITranslator],
30
- optional: [],
31
- activate: (app, translator) => {
30
+ optional: [IGlobalAwareness],
31
+ activate: (app, translator, globalAwareness) => {
32
32
  const trans = translator.load('jupyter_collaboration');
33
- const drive = new YDrive(app.serviceManager.user, trans);
33
+ const drive = new YDrive(app.serviceManager.user, trans, globalAwareness);
34
34
  app.serviceManager.contents.addDrive(drive);
35
35
  return drive;
36
36
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jupyter/docprovider-extension",
3
- "version": "3.0.0-alpha.2",
3
+ "version": "3.0.0-beta.1",
4
4
  "description": "JupyterLab - Collaborative Shared Models",
5
5
  "keywords": [
6
6
  "jupyter",
@@ -53,7 +53,7 @@
53
53
  "watch:labextension": "jupyter labextension watch ."
54
54
  },
55
55
  "dependencies": {
56
- "@jupyter/docprovider": "^3.0.0-alpha.2",
56
+ "@jupyter/docprovider": "^3.0.0-beta.1",
57
57
  "@jupyter/ydoc": "^2.0.0",
58
58
  "@jupyterlab/application": "^4.2.0",
59
59
  "@jupyterlab/apputils": "^4.2.0",
@@ -70,8 +70,8 @@
70
70
  "yjs": "^13.5.40"
71
71
  },
72
72
  "devDependencies": {
73
- "@jupyterlab/builder": "^4.0.5",
74
- "@types/react": "~18.0.26",
73
+ "@jupyterlab/builder": "^4.0.0",
74
+ "@types/react": "~18.3.1",
75
75
  "npm-run-all": "^4.1.5",
76
76
  "rimraf": "^4.1.2",
77
77
  "typescript": "~5.0.4"
@@ -101,6 +101,10 @@
101
101
  "bundled": false,
102
102
  "singleton": true
103
103
  },
104
+ "@jupyter/collaboration": {
105
+ "bundled": false,
106
+ "singleton": true
107
+ },
104
108
  "@jupyter/docprovider": {
105
109
  "bundled": true,
106
110
  "singleton": true