@jupyterlite/services-extension 0.6.0-alpha.4 → 0.6.0-alpha.6
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 +2 -2
- package/lib/index.js +47 -33
- package/lib/index.js.map +1 -1
- package/package.json +8 -8
- package/src/index.ts +56 -38
package/lib/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ConfigSection, Contents, Event, Kernel, KernelSpec, NbConvert,
|
|
1
|
+
import { ConfigSection, Contents, Event, Kernel, KernelSpec, NbConvert, ServiceManagerPlugin, Session, Setting, User } from '@jupyterlab/services';
|
|
2
2
|
import { IKernelSpecs } from '@jupyterlite/kernel';
|
|
3
3
|
import { ILocalForage } from '@jupyterlite/localforage';
|
|
4
|
-
declare const _default: (ServiceManagerPlugin<ConfigSection.IManager> | ServiceManagerPlugin<Contents.IDrive> | ServiceManagerPlugin<Event.IManager> | ServiceManagerPlugin<Kernel.IManager> | ServiceManagerPlugin<KernelSpec.IManager> | ServiceManagerPlugin<Kernel.IKernelAPIClient> | ServiceManagerPlugin<IKernelSpecs> | ServiceManagerPlugin<ILocalForage> | ServiceManagerPlugin<NbConvert.IManager> | ServiceManagerPlugin<
|
|
4
|
+
declare const _default: (ServiceManagerPlugin<ConfigSection.IManager> | ServiceManagerPlugin<Contents.IDrive> | ServiceManagerPlugin<Event.IManager> | ServiceManagerPlugin<Kernel.IManager> | ServiceManagerPlugin<KernelSpec.IKernelSpecAPIClient> | ServiceManagerPlugin<KernelSpec.IManager> | ServiceManagerPlugin<Kernel.IKernelAPIClient> | ServiceManagerPlugin<IKernelSpecs> | ServiceManagerPlugin<ILocalForage> | ServiceManagerPlugin<NbConvert.IManager> | ServiceManagerPlugin<Session.IManager> | ServiceManagerPlugin<Setting.IManager> | ServiceManagerPlugin<User.IManager>)[];
|
|
5
5
|
export default _default;
|
package/lib/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// Copyright (c) Jupyter Development Team.
|
|
2
2
|
// Distributed under the terms of the Modified BSD License.
|
|
3
3
|
import { PageConfig } from '@jupyterlab/coreutils';
|
|
4
|
-
import { ConfigSection, IConfigSectionManager, IDefaultDrive, IEventManager, IKernelManager, IKernelSpecManager, INbConvertManager, IServerSettings, ISessionManager, ISettingManager, IUserManager, NbConvertManager, ServerConnection, SessionManager, UserManager, } from '@jupyterlab/services';
|
|
4
|
+
import { ConfigSection, IConfigSectionManager, IDefaultDrive, IEventManager, IKernelManager, IKernelSpecManager, INbConvertManager, IServerSettings, ISessionManager, ISettingManager, IUserManager, KernelManager, KernelSpecManager, NbConvertManager, ServerConnection, SessionManager, UserManager, } from '@jupyterlab/services';
|
|
5
5
|
import { BrowserStorageDrive } from '@jupyterlite/contents';
|
|
6
|
-
import { IKernelClient, IKernelSpecs, KernelSpecs, LiteKernelClient,
|
|
6
|
+
import { IKernelClient, IKernelSpecClient, IKernelSpecs, KernelSpecs, LiteKernelClient, LiteKernelSpecClient, } from '@jupyterlite/kernel';
|
|
7
7
|
import { ILocalForage, ensureMemoryStorage } from '@jupyterlite/localforage';
|
|
8
8
|
import { LiteSessionClient } from '@jupyterlite/session';
|
|
9
9
|
import { Settings as JupyterLiteSettings } from '@jupyterlite/settings';
|
|
@@ -69,10 +69,32 @@ const kernelManagerPlugin = {
|
|
|
69
69
|
description: 'The kernel manager plugin.',
|
|
70
70
|
autoStart: true,
|
|
71
71
|
provides: IKernelManager,
|
|
72
|
-
requires: [
|
|
72
|
+
requires: [IKernelClient, IKernelSpecClient],
|
|
73
73
|
optional: [IServerSettings],
|
|
74
|
-
activate: (_,
|
|
75
|
-
return new
|
|
74
|
+
activate: (_, kernelAPIClient, kernelSpecAPIClient, serverSettings) => {
|
|
75
|
+
return new KernelManager({
|
|
76
|
+
kernelAPIClient,
|
|
77
|
+
kernelSpecAPIClient,
|
|
78
|
+
serverSettings: {
|
|
79
|
+
...ServerConnection.makeSettings(),
|
|
80
|
+
...serverSettings,
|
|
81
|
+
WebSocket,
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* The client for managing in-browser kernel specs
|
|
88
|
+
*/
|
|
89
|
+
const kernelSpecClientPlugin = {
|
|
90
|
+
id: '@jupyterlite/services-extension:kernel-spec-client',
|
|
91
|
+
description: 'The client for managing in-browser kernel specs',
|
|
92
|
+
autoStart: true,
|
|
93
|
+
requires: [IKernelSpecs],
|
|
94
|
+
optional: [IServerSettings],
|
|
95
|
+
provides: IKernelSpecClient,
|
|
96
|
+
activate: (_, kernelSpecs, serverSettings) => {
|
|
97
|
+
return new LiteKernelSpecClient({ kernelSpecs, serverSettings });
|
|
76
98
|
},
|
|
77
99
|
};
|
|
78
100
|
/**
|
|
@@ -83,10 +105,20 @@ const kernelSpecManagerPlugin = {
|
|
|
83
105
|
description: 'The kernel spec manager plugin.',
|
|
84
106
|
autoStart: true,
|
|
85
107
|
provides: IKernelSpecManager,
|
|
86
|
-
requires: [
|
|
87
|
-
optional: [IServerSettings],
|
|
88
|
-
activate: (_, kernelSpecs, serverSettings) => {
|
|
89
|
-
|
|
108
|
+
requires: [IKernelSpecClient],
|
|
109
|
+
optional: [IKernelSpecs, IServerSettings],
|
|
110
|
+
activate: (_, kernelSpecAPIClient, kernelSpecs, serverSettings) => {
|
|
111
|
+
const kernelSpecManager = new KernelSpecManager({
|
|
112
|
+
kernelSpecAPIClient,
|
|
113
|
+
serverSettings,
|
|
114
|
+
});
|
|
115
|
+
if (kernelSpecs) {
|
|
116
|
+
// refresh the kernel spec manager when new lite specs are added
|
|
117
|
+
kernelSpecs.changed.connect(() => {
|
|
118
|
+
void kernelSpecManager.refreshSpecs();
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
return kernelSpecManager;
|
|
90
122
|
},
|
|
91
123
|
};
|
|
92
124
|
/**
|
|
@@ -100,7 +132,10 @@ const kernelClientPlugin = {
|
|
|
100
132
|
optional: [IServerSettings],
|
|
101
133
|
provides: IKernelClient,
|
|
102
134
|
activate: (_, kernelSpecs, serverSettings) => {
|
|
103
|
-
return new LiteKernelClient({
|
|
135
|
+
return new LiteKernelClient({
|
|
136
|
+
kernelSpecs,
|
|
137
|
+
serverSettings,
|
|
138
|
+
});
|
|
104
139
|
},
|
|
105
140
|
};
|
|
106
141
|
/**
|
|
@@ -148,27 +183,6 @@ const nbConvertManagerPlugin = {
|
|
|
148
183
|
return nbConvertManager;
|
|
149
184
|
},
|
|
150
185
|
};
|
|
151
|
-
/**
|
|
152
|
-
* The default server settings plugin.
|
|
153
|
-
*/
|
|
154
|
-
const serverSettingsPlugin = {
|
|
155
|
-
id: '@jupyterlite/services-extension:server-settings',
|
|
156
|
-
description: 'The default server settings plugin.',
|
|
157
|
-
autoStart: true,
|
|
158
|
-
provides: IServerSettings,
|
|
159
|
-
activate: (_) => {
|
|
160
|
-
return {
|
|
161
|
-
...ServerConnection.makeSettings(),
|
|
162
|
-
WebSocket,
|
|
163
|
-
fetch: async (req, init) => {
|
|
164
|
-
const request = new Request(req, init !== null && init !== void 0 ? init : undefined);
|
|
165
|
-
const url = new URL(request.url);
|
|
166
|
-
console.error(`Unhandled fetch request path: ${url.pathname}`);
|
|
167
|
-
return new Response(JSON.stringify({}));
|
|
168
|
-
},
|
|
169
|
-
};
|
|
170
|
-
},
|
|
171
|
-
};
|
|
172
186
|
/**
|
|
173
187
|
* The session manager plugin.
|
|
174
188
|
*/
|
|
@@ -235,12 +249,12 @@ export default [
|
|
|
235
249
|
defaultDrivePlugin,
|
|
236
250
|
eventManagerPlugin,
|
|
237
251
|
kernelManagerPlugin,
|
|
238
|
-
kernelSpecManagerPlugin,
|
|
239
252
|
kernelClientPlugin,
|
|
253
|
+
kernelSpecClientPlugin,
|
|
254
|
+
kernelSpecManagerPlugin,
|
|
240
255
|
liteKernelSpecManagerPlugin,
|
|
241
256
|
localforagePlugin,
|
|
242
257
|
nbConvertManagerPlugin,
|
|
243
|
-
serverSettingsPlugin,
|
|
244
258
|
sessionManagerPlugin,
|
|
245
259
|
settingsPlugin,
|
|
246
260
|
userManagerPlugin,
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAE3D,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,EACL,aAAa,EAGb,qBAAqB,EACrB,aAAa,EACb,aAAa,EACb,cAAc,EACd,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,eAAe,EACf,YAAY,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAE3D,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,EACL,aAAa,EAGb,qBAAqB,EACrB,aAAa,EACb,aAAa,EACb,cAAc,EACd,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,eAAe,EACf,YAAY,EAEZ,aAAa,EAEb,iBAAiB,EAEjB,gBAAgB,EAChB,gBAAgB,EAGhB,cAAc,EAGd,WAAW,GACZ,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,oBAAoB,GACrB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,EAAE,QAAQ,IAAI,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAExE,OAAO,WAAW,MAAM,aAAa,CAAC;A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,oBAAoB;IACpB,kBAAkB;IAClB,kBAAkB;IAClB,mBAAmB;IACnB,kBAAkB;IAClB,sBAAsB;IACtB,uBAAuB;IACvB,2BAA2B;IAC3B,iBAAiB;IACjB,sBAAsB;IACtB,oBAAoB;IACpB,cAAc;IACd,iBAAiB;CAClB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jupyterlite/services-extension",
|
|
3
|
-
"version": "0.6.0-alpha.
|
|
3
|
+
"version": "0.6.0-alpha.6",
|
|
4
4
|
"description": "JupyterLite - Services Extension",
|
|
5
5
|
"homepage": "https://github.com/jupyterlite/jupyterlite",
|
|
6
6
|
"bugs": {
|
|
@@ -31,13 +31,13 @@
|
|
|
31
31
|
"watch": "tsc -b --watch"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@jupyterlab/coreutils": "~6.4.0-
|
|
35
|
-
"@jupyterlab/services": "~7.4.0-
|
|
36
|
-
"@jupyterlite/contents": "^0.6.0-alpha.
|
|
37
|
-
"@jupyterlite/kernel": "^0.6.0-alpha.
|
|
38
|
-
"@jupyterlite/localforage": "^0.6.0-alpha.
|
|
39
|
-
"@jupyterlite/session": "^0.6.0-alpha.
|
|
40
|
-
"@jupyterlite/settings": "^0.6.0-alpha.
|
|
34
|
+
"@jupyterlab/coreutils": "~6.4.0-rc.0",
|
|
35
|
+
"@jupyterlab/services": "~7.4.0-rc.0",
|
|
36
|
+
"@jupyterlite/contents": "^0.6.0-alpha.6",
|
|
37
|
+
"@jupyterlite/kernel": "^0.6.0-alpha.6",
|
|
38
|
+
"@jupyterlite/localforage": "^0.6.0-alpha.6",
|
|
39
|
+
"@jupyterlite/session": "^0.6.0-alpha.6",
|
|
40
|
+
"@jupyterlite/settings": "^0.6.0-alpha.6",
|
|
41
41
|
"@lumino/coreutils": "^2.2.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
package/src/index.ts
CHANGED
|
@@ -18,7 +18,9 @@ import {
|
|
|
18
18
|
ISettingManager,
|
|
19
19
|
IUserManager,
|
|
20
20
|
Kernel,
|
|
21
|
+
KernelManager,
|
|
21
22
|
KernelSpec,
|
|
23
|
+
KernelSpecManager,
|
|
22
24
|
NbConvert,
|
|
23
25
|
NbConvertManager,
|
|
24
26
|
ServerConnection,
|
|
@@ -34,11 +36,11 @@ import { BrowserStorageDrive } from '@jupyterlite/contents';
|
|
|
34
36
|
|
|
35
37
|
import {
|
|
36
38
|
IKernelClient,
|
|
39
|
+
IKernelSpecClient,
|
|
37
40
|
IKernelSpecs,
|
|
38
41
|
KernelSpecs,
|
|
39
42
|
LiteKernelClient,
|
|
40
|
-
|
|
41
|
-
LiteKernelSpecs,
|
|
43
|
+
LiteKernelSpecClient,
|
|
42
44
|
} from '@jupyterlite/kernel';
|
|
43
45
|
|
|
44
46
|
import { ILocalForage, ensureMemoryStorage } from '@jupyterlite/localforage';
|
|
@@ -121,15 +123,42 @@ const kernelManagerPlugin: ServiceManagerPlugin<Kernel.IManager> = {
|
|
|
121
123
|
description: 'The kernel manager plugin.',
|
|
122
124
|
autoStart: true,
|
|
123
125
|
provides: IKernelManager,
|
|
124
|
-
requires: [
|
|
126
|
+
requires: [IKernelClient, IKernelSpecClient],
|
|
125
127
|
optional: [IServerSettings],
|
|
126
128
|
activate: (
|
|
127
129
|
_: null,
|
|
128
|
-
|
|
129
|
-
|
|
130
|
+
kernelAPIClient: IKernelClient,
|
|
131
|
+
kernelSpecAPIClient: IKernelSpecClient,
|
|
130
132
|
serverSettings: ServerConnection.ISettings | undefined,
|
|
131
133
|
): Kernel.IManager => {
|
|
132
|
-
return new
|
|
134
|
+
return new KernelManager({
|
|
135
|
+
kernelAPIClient,
|
|
136
|
+
kernelSpecAPIClient,
|
|
137
|
+
serverSettings: {
|
|
138
|
+
...ServerConnection.makeSettings(),
|
|
139
|
+
...serverSettings,
|
|
140
|
+
WebSocket,
|
|
141
|
+
},
|
|
142
|
+
});
|
|
143
|
+
},
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* The client for managing in-browser kernel specs
|
|
148
|
+
*/
|
|
149
|
+
const kernelSpecClientPlugin: ServiceManagerPlugin<KernelSpec.IKernelSpecAPIClient> = {
|
|
150
|
+
id: '@jupyterlite/services-extension:kernel-spec-client',
|
|
151
|
+
description: 'The client for managing in-browser kernel specs',
|
|
152
|
+
autoStart: true,
|
|
153
|
+
requires: [IKernelSpecs],
|
|
154
|
+
optional: [IServerSettings],
|
|
155
|
+
provides: IKernelSpecClient,
|
|
156
|
+
activate: (
|
|
157
|
+
_: null,
|
|
158
|
+
kernelSpecs: IKernelSpecs,
|
|
159
|
+
serverSettings?: ServerConnection.ISettings,
|
|
160
|
+
): IKernelSpecClient => {
|
|
161
|
+
return new LiteKernelSpecClient({ kernelSpecs, serverSettings });
|
|
133
162
|
},
|
|
134
163
|
};
|
|
135
164
|
|
|
@@ -141,14 +170,25 @@ const kernelSpecManagerPlugin: ServiceManagerPlugin<KernelSpec.IManager> = {
|
|
|
141
170
|
description: 'The kernel spec manager plugin.',
|
|
142
171
|
autoStart: true,
|
|
143
172
|
provides: IKernelSpecManager,
|
|
144
|
-
requires: [
|
|
145
|
-
optional: [IServerSettings],
|
|
173
|
+
requires: [IKernelSpecClient],
|
|
174
|
+
optional: [IKernelSpecs, IServerSettings],
|
|
146
175
|
activate: (
|
|
147
176
|
_: null,
|
|
148
|
-
|
|
177
|
+
kernelSpecAPIClient: IKernelSpecClient,
|
|
178
|
+
kernelSpecs: IKernelSpecs | null,
|
|
149
179
|
serverSettings: ServerConnection.ISettings | undefined,
|
|
150
180
|
): KernelSpec.IManager => {
|
|
151
|
-
|
|
181
|
+
const kernelSpecManager = new KernelSpecManager({
|
|
182
|
+
kernelSpecAPIClient,
|
|
183
|
+
serverSettings,
|
|
184
|
+
});
|
|
185
|
+
if (kernelSpecs) {
|
|
186
|
+
// refresh the kernel spec manager when new lite specs are added
|
|
187
|
+
kernelSpecs.changed.connect(() => {
|
|
188
|
+
void kernelSpecManager.refreshSpecs();
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
return kernelSpecManager;
|
|
152
192
|
},
|
|
153
193
|
};
|
|
154
194
|
|
|
@@ -167,7 +207,10 @@ const kernelClientPlugin: ServiceManagerPlugin<Kernel.IKernelAPIClient> = {
|
|
|
167
207
|
kernelSpecs: IKernelSpecs,
|
|
168
208
|
serverSettings?: ServerConnection.ISettings,
|
|
169
209
|
): IKernelClient => {
|
|
170
|
-
return new LiteKernelClient({
|
|
210
|
+
return new LiteKernelClient({
|
|
211
|
+
kernelSpecs,
|
|
212
|
+
serverSettings,
|
|
213
|
+
});
|
|
171
214
|
},
|
|
172
215
|
};
|
|
173
216
|
|
|
@@ -227,31 +270,6 @@ const nbConvertManagerPlugin: ServiceManagerPlugin<NbConvert.IManager> = {
|
|
|
227
270
|
},
|
|
228
271
|
};
|
|
229
272
|
|
|
230
|
-
/**
|
|
231
|
-
* The default server settings plugin.
|
|
232
|
-
*/
|
|
233
|
-
const serverSettingsPlugin: ServiceManagerPlugin<ServerConnection.ISettings> = {
|
|
234
|
-
id: '@jupyterlite/services-extension:server-settings',
|
|
235
|
-
description: 'The default server settings plugin.',
|
|
236
|
-
autoStart: true,
|
|
237
|
-
provides: IServerSettings,
|
|
238
|
-
activate: (_: null): ServerConnection.ISettings => {
|
|
239
|
-
return {
|
|
240
|
-
...ServerConnection.makeSettings(),
|
|
241
|
-
WebSocket,
|
|
242
|
-
fetch: async (
|
|
243
|
-
req: RequestInfo,
|
|
244
|
-
init?: RequestInit | null | undefined,
|
|
245
|
-
): Promise<Response> => {
|
|
246
|
-
const request = new Request(req, init ?? undefined);
|
|
247
|
-
const url = new URL(request.url);
|
|
248
|
-
console.error(`Unhandled fetch request path: ${url.pathname}`);
|
|
249
|
-
return new Response(JSON.stringify({}));
|
|
250
|
-
},
|
|
251
|
-
};
|
|
252
|
-
},
|
|
253
|
-
};
|
|
254
|
-
|
|
255
273
|
/**
|
|
256
274
|
* The session manager plugin.
|
|
257
275
|
*/
|
|
@@ -335,12 +353,12 @@ export default [
|
|
|
335
353
|
defaultDrivePlugin,
|
|
336
354
|
eventManagerPlugin,
|
|
337
355
|
kernelManagerPlugin,
|
|
338
|
-
kernelSpecManagerPlugin,
|
|
339
356
|
kernelClientPlugin,
|
|
357
|
+
kernelSpecClientPlugin,
|
|
358
|
+
kernelSpecManagerPlugin,
|
|
340
359
|
liteKernelSpecManagerPlugin,
|
|
341
360
|
localforagePlugin,
|
|
342
361
|
nbConvertManagerPlugin,
|
|
343
|
-
serverSettingsPlugin,
|
|
344
362
|
sessionManagerPlugin,
|
|
345
363
|
settingsPlugin,
|
|
346
364
|
userManagerPlugin,
|