@difizen/libro-kernel 0.0.2-alpha.0
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/LICENSE +21 -0
- package/README.md +1 -0
- package/es/basemanager.d.ts +94 -0
- package/es/basemanager.d.ts.map +1 -0
- package/es/basemanager.js +110 -0
- package/es/contents/contents-drive.d.ts +189 -0
- package/es/contents/contents-drive.d.ts.map +1 -0
- package/es/contents/contents-drive.js +792 -0
- package/es/contents/contents-manager.d.ts +229 -0
- package/es/contents/contents-manager.d.ts.map +1 -0
- package/es/contents/contents-manager.js +551 -0
- package/es/contents/contents-module.d.ts +3 -0
- package/es/contents/contents-module.d.ts.map +1 -0
- package/es/contents/contents-module.js +4 -0
- package/es/contents/contents-protocol.d.ts +487 -0
- package/es/contents/contents-protocol.d.ts.map +1 -0
- package/es/contents/contents-protocol.js +1 -0
- package/es/contents/index.d.ts +6 -0
- package/es/contents/index.d.ts.map +1 -0
- package/es/contents/index.js +5 -0
- package/es/contents/validate.d.ts +10 -0
- package/es/contents/validate.d.ts.map +1 -0
- package/es/contents/validate.js +22 -0
- package/es/index.d.ts +10 -0
- package/es/index.d.ts.map +1 -0
- package/es/index.js +9 -0
- package/es/index.less +0 -0
- package/es/kernel/comm.d.ts +92 -0
- package/es/kernel/comm.d.ts.map +1 -0
- package/es/kernel/comm.js +216 -0
- package/es/kernel/future.d.ts +178 -0
- package/es/kernel/future.d.ts.map +1 -0
- package/es/kernel/future.js +587 -0
- package/es/kernel/index.d.ts +8 -0
- package/es/kernel/index.d.ts.map +1 -0
- package/es/kernel/index.js +8 -0
- package/es/kernel/kernel-connection.d.ts +550 -0
- package/es/kernel/kernel-connection.d.ts.map +1 -0
- package/es/kernel/kernel-connection.js +1957 -0
- package/es/kernel/kernel-module.d.ts +3 -0
- package/es/kernel/kernel-module.d.ts.map +1 -0
- package/es/kernel/kernel-module.js +32 -0
- package/es/kernel/libro-kernel-manager.d.ts +69 -0
- package/es/kernel/libro-kernel-manager.d.ts.map +1 -0
- package/es/kernel/libro-kernel-manager.js +349 -0
- package/es/kernel/libro-kernel-protocol.d.ts +675 -0
- package/es/kernel/libro-kernel-protocol.d.ts.map +1 -0
- package/es/kernel/libro-kernel-protocol.js +60 -0
- package/es/kernel/libro-kernel-utils.d.ts +95 -0
- package/es/kernel/libro-kernel-utils.d.ts.map +1 -0
- package/es/kernel/libro-kernel-utils.js +130 -0
- package/es/kernel/libro-kernel.d.ts +14 -0
- package/es/kernel/libro-kernel.d.ts.map +1 -0
- package/es/kernel/libro-kernel.js +54 -0
- package/es/kernel/messages.d.ts +845 -0
- package/es/kernel/messages.d.ts.map +1 -0
- package/es/kernel/messages.js +457 -0
- package/es/kernel/restapi.d.ts +78 -0
- package/es/kernel/restapi.d.ts.map +1 -0
- package/es/kernel/restapi.js +367 -0
- package/es/kernel/serialize.d.ts +10 -0
- package/es/kernel/serialize.d.ts.map +1 -0
- package/es/kernel/serialize.js +214 -0
- package/es/kernel/validate.d.ts +15 -0
- package/es/kernel/validate.d.ts.map +1 -0
- package/es/kernel/validate.js +125 -0
- package/es/kernelspec/index.d.ts +5 -0
- package/es/kernelspec/index.d.ts.map +1 -0
- package/es/kernelspec/index.js +4 -0
- package/es/kernelspec/kernelspec-module.d.ts +3 -0
- package/es/kernelspec/kernelspec-module.d.ts.map +1 -0
- package/es/kernelspec/kernelspec-module.js +4 -0
- package/es/kernelspec/kernelspec.d.ts +33 -0
- package/es/kernelspec/kernelspec.d.ts.map +1 -0
- package/es/kernelspec/kernelspec.js +1 -0
- package/es/kernelspec/manager.d.ts +81 -0
- package/es/kernelspec/manager.d.ts.map +1 -0
- package/es/kernelspec/manager.js +248 -0
- package/es/kernelspec/restapi.d.ts +71 -0
- package/es/kernelspec/restapi.d.ts.map +1 -0
- package/es/kernelspec/restapi.js +107 -0
- package/es/kernelspec/validate.d.ts +10 -0
- package/es/kernelspec/validate.d.ts.map +1 -0
- package/es/kernelspec/validate.js +69 -0
- package/es/libro-kernel-connection-manager.d.ts +19 -0
- package/es/libro-kernel-connection-manager.d.ts.map +1 -0
- package/es/libro-kernel-connection-manager.js +142 -0
- package/es/module.d.ts +3 -0
- package/es/module.d.ts.map +1 -0
- package/es/module.js +9 -0
- package/es/page-config.d.ts +36 -0
- package/es/page-config.d.ts.map +1 -0
- package/es/page-config.js +129 -0
- package/es/protocol.d.ts +13 -0
- package/es/protocol.d.ts.map +1 -0
- package/es/protocol.js +8 -0
- package/es/server/connection-error.d.ts +36 -0
- package/es/server/connection-error.d.ts.map +1 -0
- package/es/server/connection-error.js +109 -0
- package/es/server/index.d.ts +6 -0
- package/es/server/index.d.ts.map +1 -0
- package/es/server/index.js +5 -0
- package/es/server/server-connection-protocol.d.ts +49 -0
- package/es/server/server-connection-protocol.d.ts.map +1 -0
- package/es/server/server-connection-protocol.js +0 -0
- package/es/server/server-connection.d.ts +25 -0
- package/es/server/server-connection.d.ts.map +1 -0
- package/es/server/server-connection.js +159 -0
- package/es/server/server-manager.d.ts +22 -0
- package/es/server/server-manager.d.ts.map +1 -0
- package/es/server/server-manager.js +163 -0
- package/es/server/server-module.d.ts +3 -0
- package/es/server/server-module.d.ts.map +1 -0
- package/es/server/server-module.js +4 -0
- package/es/session/index.d.ts +5 -0
- package/es/session/index.d.ts.map +1 -0
- package/es/session/index.js +4 -0
- package/es/session/libro-session-manager.d.ts +71 -0
- package/es/session/libro-session-manager.d.ts.map +1 -0
- package/es/session/libro-session-manager.js +539 -0
- package/es/session/libro-session-protocol.d.ts +50 -0
- package/es/session/libro-session-protocol.d.ts.map +1 -0
- package/es/session/libro-session-protocol.js +21 -0
- package/es/session/libro-session.d.ts +12 -0
- package/es/session/libro-session.d.ts.map +1 -0
- package/es/session/libro-session.js +19 -0
- package/es/session/restapi.d.ts +28 -0
- package/es/session/restapi.d.ts.map +1 -0
- package/es/session/restapi.js +214 -0
- package/es/session/session-module.d.ts +3 -0
- package/es/session/session-module.d.ts.map +1 -0
- package/es/session/session-module.js +18 -0
- package/es/session/validate.d.ts +14 -0
- package/es/session/validate.d.ts.map +1 -0
- package/es/session/validate.js +37 -0
- package/es/utils.d.ts +4 -0
- package/es/utils.d.ts.map +1 -0
- package/es/utils.js +29 -0
- package/es/validate-property.d.ts +2 -0
- package/es/validate-property.d.ts.map +1 -0
- package/es/validate-property.js +35 -0
- package/package.json +62 -0
- package/src/basemanager.ts +133 -0
- package/src/contents/contents-drive.ts +495 -0
- package/src/contents/contents-manager.ts +465 -0
- package/src/contents/contents-module.ts +6 -0
- package/src/contents/contents-protocol.ts +604 -0
- package/src/contents/index.ts +5 -0
- package/src/contents/validate.ts +29 -0
- package/src/index.tsx +9 -0
- package/src/kernel/comm.ts +220 -0
- package/src/kernel/future.ts +474 -0
- package/src/kernel/index.ts +7 -0
- package/src/kernel/kernel-connection.ts +1770 -0
- package/src/kernel/kernel-module.ts +50 -0
- package/src/kernel/libro-kernel-manager.ts +199 -0
- package/src/kernel/libro-kernel-protocol.ts +858 -0
- package/src/kernel/libro-kernel-utils.ts +152 -0
- package/src/kernel/libro-kernel.ts +39 -0
- package/src/kernel/messages.ts +1104 -0
- package/src/kernel/restapi.ts +183 -0
- package/src/kernel/serialize.ts +262 -0
- package/src/kernel/validate.ts +101 -0
- package/src/kernelspec/index.ts +5 -0
- package/src/kernelspec/kernelspec-module.ts +9 -0
- package/src/kernelspec/kernelspec.ts +37 -0
- package/src/kernelspec/manager.ts +173 -0
- package/src/kernelspec/restapi.ts +104 -0
- package/src/kernelspec/validate.ts +80 -0
- package/src/libro-kernel-connection-manager.ts +73 -0
- package/src/module.ts +19 -0
- package/src/page-config.ts +106 -0
- package/src/protocol.ts +24 -0
- package/src/server/connection-error.ts +60 -0
- package/src/server/index.ts +5 -0
- package/src/server/server-connection-protocol.ts +57 -0
- package/src/server/server-connection.ts +144 -0
- package/src/server/server-manager.ts +76 -0
- package/src/server/server-module.ts +9 -0
- package/src/session/index.ts +4 -0
- package/src/session/libro-session-manager.ts +377 -0
- package/src/session/libro-session-protocol.ts +61 -0
- package/src/session/libro-session.ts +33 -0
- package/src/session/restapi.ts +126 -0
- package/src/session/session-module.ts +26 -0
- package/src/session/validate.ts +39 -0
- package/src/utils.ts +28 -0
- package/src/validate-property.ts +38 -0
|
@@ -0,0 +1,487 @@
|
|
|
1
|
+
import type { Disposable, Event as ManaEvent } from '@difizen/mana-app';
|
|
2
|
+
import type { ISettings } from '../server/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* The options used to fetch a file.
|
|
5
|
+
*/
|
|
6
|
+
export interface IContentsRequestOptions {
|
|
7
|
+
baseUrl?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* A contents file type. It can be anything but `jupyter-server`
|
|
11
|
+
* has special treatment for `notebook` and `directory` types.
|
|
12
|
+
* Anything else is considered as `file` type.
|
|
13
|
+
*/
|
|
14
|
+
export type ContentType = string;
|
|
15
|
+
/**
|
|
16
|
+
* A contents file format.
|
|
17
|
+
*/
|
|
18
|
+
export type ContentsFileFormat = 'json' | 'text' | 'base64' | null;
|
|
19
|
+
/**
|
|
20
|
+
* A contents model.
|
|
21
|
+
*/
|
|
22
|
+
export interface IContentsModel extends IContentsRequestOptions {
|
|
23
|
+
/**
|
|
24
|
+
* Name of the contents file.
|
|
25
|
+
*
|
|
26
|
+
* #### Notes
|
|
27
|
+
* Equivalent to the last part of the `path` field.
|
|
28
|
+
*/
|
|
29
|
+
readonly name: string;
|
|
30
|
+
/**
|
|
31
|
+
* The full file path.
|
|
32
|
+
*
|
|
33
|
+
* #### Notes
|
|
34
|
+
* It will *not* start with `/`, and it will be `/`-delimited.
|
|
35
|
+
*/
|
|
36
|
+
readonly path: string;
|
|
37
|
+
/**
|
|
38
|
+
* The type of file.
|
|
39
|
+
*/
|
|
40
|
+
readonly type: ContentType;
|
|
41
|
+
/**
|
|
42
|
+
* Whether the requester has permission to edit the file.
|
|
43
|
+
*/
|
|
44
|
+
readonly writable: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* File creation timestamp.
|
|
47
|
+
*/
|
|
48
|
+
readonly created: string;
|
|
49
|
+
/**
|
|
50
|
+
* Last modified timestamp.
|
|
51
|
+
*/
|
|
52
|
+
readonly last_modified: string;
|
|
53
|
+
/**
|
|
54
|
+
* Specify the mime-type of file contents.
|
|
55
|
+
*
|
|
56
|
+
* #### Notes
|
|
57
|
+
* Only non-`null` when `content` is present and `type` is `"file"`.
|
|
58
|
+
*/
|
|
59
|
+
readonly mimetype?: string;
|
|
60
|
+
/**
|
|
61
|
+
* The optional file content.
|
|
62
|
+
*/
|
|
63
|
+
readonly content: any;
|
|
64
|
+
/**
|
|
65
|
+
* The chunk of the file upload.
|
|
66
|
+
*/
|
|
67
|
+
readonly chunk?: number;
|
|
68
|
+
/**
|
|
69
|
+
* The format of the file `content`.
|
|
70
|
+
*
|
|
71
|
+
* #### Notes
|
|
72
|
+
* Only relevant for type: 'file'
|
|
73
|
+
*/
|
|
74
|
+
readonly format?: ContentsFileFormat;
|
|
75
|
+
/**
|
|
76
|
+
* The size of then file in bytes.
|
|
77
|
+
*/
|
|
78
|
+
readonly size?: number;
|
|
79
|
+
/**
|
|
80
|
+
* The indices of the matched characters in the name.
|
|
81
|
+
*/
|
|
82
|
+
indices?: readonly number[] | null;
|
|
83
|
+
message?: string;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* The options used to fetch a file.
|
|
87
|
+
*/
|
|
88
|
+
export interface IContentsFetchOptions extends IContentsRequestOptions {
|
|
89
|
+
/**
|
|
90
|
+
* The override file type for the request.
|
|
91
|
+
*/
|
|
92
|
+
type?: ContentType;
|
|
93
|
+
/**
|
|
94
|
+
* The override file format for the request.
|
|
95
|
+
*/
|
|
96
|
+
format?: ContentsFileFormat;
|
|
97
|
+
/**
|
|
98
|
+
* Whether to include the file content.
|
|
99
|
+
*
|
|
100
|
+
* The default is `true`.
|
|
101
|
+
*/
|
|
102
|
+
content?: boolean;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* The options used to create a file.
|
|
106
|
+
*/
|
|
107
|
+
export interface IContentsCreateOptions extends IContentsRequestOptions {
|
|
108
|
+
/**
|
|
109
|
+
* The directory in which to create the file.
|
|
110
|
+
*/
|
|
111
|
+
path?: string;
|
|
112
|
+
/**
|
|
113
|
+
* The optional file extension for the new file (e.g. `".txt"`).
|
|
114
|
+
*
|
|
115
|
+
* #### Notes
|
|
116
|
+
* This ignored if `type` is `'notebook'`.
|
|
117
|
+
*/
|
|
118
|
+
ext?: string;
|
|
119
|
+
/**
|
|
120
|
+
* The file type.
|
|
121
|
+
*/
|
|
122
|
+
type?: ContentType;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Checkpoint model.
|
|
126
|
+
*/
|
|
127
|
+
export interface IContentsCheckpointModel {
|
|
128
|
+
/**
|
|
129
|
+
* The unique identifier for the checkpoint.
|
|
130
|
+
*/
|
|
131
|
+
readonly id: string;
|
|
132
|
+
/**
|
|
133
|
+
* Last modified timestamp.
|
|
134
|
+
*/
|
|
135
|
+
readonly last_modified: string;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* The change args for a file change.
|
|
139
|
+
*/
|
|
140
|
+
export interface IContentsChangedArgs {
|
|
141
|
+
/**
|
|
142
|
+
* The type of change.
|
|
143
|
+
*/
|
|
144
|
+
type: 'new' | 'delete' | 'rename' | 'save';
|
|
145
|
+
/**
|
|
146
|
+
* The new contents.
|
|
147
|
+
*/
|
|
148
|
+
oldValue: Partial<IContentsModel> | null;
|
|
149
|
+
/**
|
|
150
|
+
* The old contents.
|
|
151
|
+
*/
|
|
152
|
+
newValue: Partial<IContentsModel> | null;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* The interface for a contents manager.
|
|
156
|
+
*/
|
|
157
|
+
export interface IContentsManager extends Disposable {
|
|
158
|
+
/**
|
|
159
|
+
* A signal emitted when a file operation takes place.
|
|
160
|
+
*/
|
|
161
|
+
readonly fileChanged: ManaEvent<IContentsChangedArgs>;
|
|
162
|
+
/**
|
|
163
|
+
* The server settings associated with the manager.
|
|
164
|
+
*/
|
|
165
|
+
/**
|
|
166
|
+
* Add an `IContentsDrive` to the manager.
|
|
167
|
+
*/
|
|
168
|
+
addDrive: (drive: IContentsDrive) => void;
|
|
169
|
+
/**
|
|
170
|
+
* Given a path of the form `drive:local/portion/of/it.txt`
|
|
171
|
+
* get the local part of it.
|
|
172
|
+
*
|
|
173
|
+
* @param path: the path.
|
|
174
|
+
*
|
|
175
|
+
* @returns The local part of the path.
|
|
176
|
+
*/
|
|
177
|
+
localPath: (path: string) => string;
|
|
178
|
+
/**
|
|
179
|
+
* Normalize a global path. Reduces '..' and '.' parts, and removes
|
|
180
|
+
* leading slashes from the local part of the path, while retaining
|
|
181
|
+
* the drive name if it exists.
|
|
182
|
+
*
|
|
183
|
+
* @param path: the path.
|
|
184
|
+
*
|
|
185
|
+
* @returns The normalized path.
|
|
186
|
+
*/
|
|
187
|
+
normalize: (path: string) => string;
|
|
188
|
+
/**
|
|
189
|
+
* Resolve a global path, starting from the root path. Behaves like
|
|
190
|
+
* posix-path.resolve, with 3 differences:
|
|
191
|
+
* - will never prepend cwd
|
|
192
|
+
* - if root has a drive name, the result is prefixed with "<drive>:"
|
|
193
|
+
* - before adding drive name, leading slashes are removed
|
|
194
|
+
*
|
|
195
|
+
* @param path: the path.
|
|
196
|
+
*
|
|
197
|
+
* @returns The normalized path.
|
|
198
|
+
*/
|
|
199
|
+
resolvePath: (root: string, path: string) => string;
|
|
200
|
+
/**
|
|
201
|
+
* Given a path of the form `drive:local/portion/of/it.txt`
|
|
202
|
+
* get the name of the drive. If the path is missing
|
|
203
|
+
* a drive portion, returns an empty string.
|
|
204
|
+
*
|
|
205
|
+
* @param path: the path.
|
|
206
|
+
*
|
|
207
|
+
* @returns The drive name for the path, or the empty string.
|
|
208
|
+
*/
|
|
209
|
+
driveName: (path: string) => string;
|
|
210
|
+
/**
|
|
211
|
+
* Given a path, get a ModelDB.IFactory from the
|
|
212
|
+
* relevant backend. Returns `null` if the backend
|
|
213
|
+
* does not provide one.
|
|
214
|
+
*/
|
|
215
|
+
/**
|
|
216
|
+
* Get a file or directory.
|
|
217
|
+
*
|
|
218
|
+
* @param path: The path to the file.
|
|
219
|
+
*
|
|
220
|
+
* @param options: The options used to fetch the file.
|
|
221
|
+
*
|
|
222
|
+
* @returns A promise which resolves with the file content.
|
|
223
|
+
*/
|
|
224
|
+
get: (path: string, options?: IContentsFetchOptions) => Promise<IContentsModel>;
|
|
225
|
+
/**
|
|
226
|
+
* Get an encoded download url given a file path.
|
|
227
|
+
*
|
|
228
|
+
* @param A promise which resolves with the absolute POSIX
|
|
229
|
+
* file path on the server.
|
|
230
|
+
*
|
|
231
|
+
* #### Notes
|
|
232
|
+
* The returned URL may include a query parameter.
|
|
233
|
+
*/
|
|
234
|
+
getDownloadUrl: (path: string, options?: IContentsRequestOptions) => Promise<string>;
|
|
235
|
+
/**
|
|
236
|
+
* Create a new untitled file or directory in the specified directory path.
|
|
237
|
+
*
|
|
238
|
+
* @param options: The options used to create the file.
|
|
239
|
+
*
|
|
240
|
+
* @returns A promise which resolves with the created file content when the
|
|
241
|
+
* file is created.
|
|
242
|
+
*/
|
|
243
|
+
newUntitled: (options?: IContentsCreateOptions) => Promise<IContentsModel>;
|
|
244
|
+
/**
|
|
245
|
+
* Delete a file.
|
|
246
|
+
*
|
|
247
|
+
* @param path - The path to the file.
|
|
248
|
+
*
|
|
249
|
+
* @returns A promise which resolves when the file is deleted.
|
|
250
|
+
*/
|
|
251
|
+
delete: (path: string, options?: IContentsRequestOptions) => Promise<void>;
|
|
252
|
+
/**
|
|
253
|
+
* Rename a file or directory.
|
|
254
|
+
*
|
|
255
|
+
* @param path - The original file path.
|
|
256
|
+
*
|
|
257
|
+
* @param newPath - The new file path.
|
|
258
|
+
*
|
|
259
|
+
* @returns A promise which resolves with the new file content model when the
|
|
260
|
+
* file is renamed.
|
|
261
|
+
*/
|
|
262
|
+
rename: (path: string, newPath: string, options?: IContentsRequestOptions) => Promise<IContentsModel>;
|
|
263
|
+
/**
|
|
264
|
+
* Save a file.
|
|
265
|
+
*
|
|
266
|
+
* @param path - The desired file path.
|
|
267
|
+
*
|
|
268
|
+
* @param options - Optional overrides to the model.
|
|
269
|
+
*
|
|
270
|
+
* @returns A promise which resolves with the file content model when the
|
|
271
|
+
* file is saved.
|
|
272
|
+
*/
|
|
273
|
+
save: (path: string, options?: Partial<IContentsModel>) => Promise<IContentsModel>;
|
|
274
|
+
/**
|
|
275
|
+
* Copy a file into a given directory.
|
|
276
|
+
*
|
|
277
|
+
* @param path - The original file path.
|
|
278
|
+
*
|
|
279
|
+
* @param toDir - The destination directory path.
|
|
280
|
+
*
|
|
281
|
+
* @returns A promise which resolves with the new content model when the
|
|
282
|
+
* file is copied.
|
|
283
|
+
*/
|
|
284
|
+
copy: (path: string, toDir: string, options?: IContentsRequestOptions) => Promise<IContentsModel>;
|
|
285
|
+
/**
|
|
286
|
+
* Create a checkpoint for a file.
|
|
287
|
+
*
|
|
288
|
+
* @param path - The path of the file.
|
|
289
|
+
*
|
|
290
|
+
* @returns A promise which resolves with the new checkpoint model when the
|
|
291
|
+
* checkpoint is created.
|
|
292
|
+
*/
|
|
293
|
+
createCheckpoint: (path: string, options?: IContentsRequestOptions) => Promise<IContentsCheckpointModel>;
|
|
294
|
+
/**
|
|
295
|
+
* List available checkpoints for a file.
|
|
296
|
+
*
|
|
297
|
+
* @param path - The path of the file.
|
|
298
|
+
*
|
|
299
|
+
* @returns A promise which resolves with a list of checkpoint models for
|
|
300
|
+
* the file.
|
|
301
|
+
*/
|
|
302
|
+
listCheckpoints: (path: string, options?: IContentsRequestOptions) => Promise<IContentsCheckpointModel[]>;
|
|
303
|
+
/**
|
|
304
|
+
* Restore a file to a known checkpoint state.
|
|
305
|
+
*
|
|
306
|
+
* @param path - The path of the file.
|
|
307
|
+
*
|
|
308
|
+
* @param checkpointID - The id of the checkpoint to restore.
|
|
309
|
+
*
|
|
310
|
+
* @returns A promise which resolves when the checkpoint is restored.
|
|
311
|
+
*/
|
|
312
|
+
restoreCheckpoint: (path: string, checkpointID: string, options?: IContentsRequestOptions) => Promise<void>;
|
|
313
|
+
/**
|
|
314
|
+
* Delete a checkpoint for a file.
|
|
315
|
+
*
|
|
316
|
+
* @param path - The path of the file.
|
|
317
|
+
*
|
|
318
|
+
* @param checkpointID - The id of the checkpoint to delete.
|
|
319
|
+
*
|
|
320
|
+
* @returns A promise which resolves when the checkpoint is deleted.
|
|
321
|
+
*/
|
|
322
|
+
deleteCheckpoint: (path: string, checkpointID: string, options?: IContentsRequestOptions) => Promise<void>;
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* The interface for a network drive that can be mounted
|
|
326
|
+
* in the contents manager.
|
|
327
|
+
*/
|
|
328
|
+
export interface IContentsDrive extends Disposable {
|
|
329
|
+
/**
|
|
330
|
+
* The name of the drive, which is used at the leading
|
|
331
|
+
* component of file paths.
|
|
332
|
+
*/
|
|
333
|
+
readonly name: string;
|
|
334
|
+
/**
|
|
335
|
+
* The server settings of the manager.
|
|
336
|
+
*/
|
|
337
|
+
/**
|
|
338
|
+
* An optional ModelDB.IFactory instance for the
|
|
339
|
+
* drive.
|
|
340
|
+
*/
|
|
341
|
+
/**
|
|
342
|
+
* A signal emitted when a file operation takes place.
|
|
343
|
+
*/
|
|
344
|
+
fileChanged: ManaEvent<IContentsChangedArgs>;
|
|
345
|
+
/**
|
|
346
|
+
* Get a file or directory.
|
|
347
|
+
*
|
|
348
|
+
* @param localPath: The path to the file.
|
|
349
|
+
*
|
|
350
|
+
* @param options: The options used to fetch the file.
|
|
351
|
+
*
|
|
352
|
+
* @returns A promise which resolves with the file content.
|
|
353
|
+
*/
|
|
354
|
+
get: (localPath: string, options?: IContentsFetchOptions) => Promise<IContentsModel>;
|
|
355
|
+
/**
|
|
356
|
+
* Get an encoded download url given a file path.
|
|
357
|
+
*
|
|
358
|
+
* @param A promise which resolves with the absolute POSIX
|
|
359
|
+
* file path on the server.
|
|
360
|
+
*
|
|
361
|
+
* #### Notes
|
|
362
|
+
* The returned URL may include a query parameter.
|
|
363
|
+
*/
|
|
364
|
+
getDownloadUrl: (localPath: string, options?: IContentsRequestOptions) => Promise<string>;
|
|
365
|
+
/**
|
|
366
|
+
* Create a new untitled file or directory in the specified directory path.
|
|
367
|
+
*
|
|
368
|
+
* @param options: The options used to create the file.
|
|
369
|
+
*
|
|
370
|
+
* @returns A promise which resolves with the created file content when the
|
|
371
|
+
* file is created.
|
|
372
|
+
*/
|
|
373
|
+
newUntitled: (options?: IContentsCreateOptions) => Promise<IContentsModel>;
|
|
374
|
+
/**
|
|
375
|
+
* Delete a file.
|
|
376
|
+
*
|
|
377
|
+
* @param localPath - The path to the file.
|
|
378
|
+
*
|
|
379
|
+
* @returns A promise which resolves when the file is deleted.
|
|
380
|
+
*/
|
|
381
|
+
delete: (localPath: string, options?: IContentsRequestOptions) => Promise<void>;
|
|
382
|
+
/**
|
|
383
|
+
* Rename a file or directory.
|
|
384
|
+
*
|
|
385
|
+
* @param oldLocalPath - The original file path.
|
|
386
|
+
*
|
|
387
|
+
* @param newLocalPath - The new file path.
|
|
388
|
+
*
|
|
389
|
+
* @returns A promise which resolves with the new file content model when the
|
|
390
|
+
* file is renamed.
|
|
391
|
+
*/
|
|
392
|
+
rename: (oldLocalPath: string, newLocalPath: string, options?: IContentsRequestOptions) => Promise<IContentsModel>;
|
|
393
|
+
/**
|
|
394
|
+
* Save a file.
|
|
395
|
+
*
|
|
396
|
+
* @param localPath - The desired file path.
|
|
397
|
+
*
|
|
398
|
+
* @param options - Optional overrides to the model.
|
|
399
|
+
*
|
|
400
|
+
* @returns A promise which resolves with the file content model when the
|
|
401
|
+
* file is saved.
|
|
402
|
+
*/
|
|
403
|
+
save: (localPath: string, options?: Partial<IContentsModel>) => Promise<IContentsModel>;
|
|
404
|
+
/**
|
|
405
|
+
* Copy a file into a given directory.
|
|
406
|
+
*
|
|
407
|
+
* @param localPath - The original file path.
|
|
408
|
+
*
|
|
409
|
+
* @param toLocalDir - The destination directory path.
|
|
410
|
+
*
|
|
411
|
+
* @returns A promise which resolves with the new content model when the
|
|
412
|
+
* file is copied.
|
|
413
|
+
*/
|
|
414
|
+
copy: (localPath: string, toLocalDir: string, options?: IContentsRequestOptions) => Promise<IContentsModel>;
|
|
415
|
+
/**
|
|
416
|
+
* Create a checkpoint for a file.
|
|
417
|
+
*
|
|
418
|
+
* @param localPath - The path of the file.
|
|
419
|
+
*
|
|
420
|
+
* @returns A promise which resolves with the new checkpoint model when the
|
|
421
|
+
* checkpoint is created.
|
|
422
|
+
*/
|
|
423
|
+
createCheckpoint: (localPath: string, options?: IContentsRequestOptions) => Promise<IContentsCheckpointModel>;
|
|
424
|
+
/**
|
|
425
|
+
* List available checkpoints for a file.
|
|
426
|
+
*
|
|
427
|
+
* @param localPath - The path of the file.
|
|
428
|
+
*
|
|
429
|
+
* @returns A promise which resolves with a list of checkpoint models for
|
|
430
|
+
* the file.
|
|
431
|
+
*/
|
|
432
|
+
listCheckpoints: (localPath: string, options?: IContentsRequestOptions) => Promise<IContentsCheckpointModel[]>;
|
|
433
|
+
/**
|
|
434
|
+
* Restore a file to a known checkpoint state.
|
|
435
|
+
*
|
|
436
|
+
* @param localPath - The path of the file.
|
|
437
|
+
*
|
|
438
|
+
* @param checkpointID - The id of the checkpoint to restore.
|
|
439
|
+
*
|
|
440
|
+
* @returns A promise which resolves when the checkpoint is restored.
|
|
441
|
+
*/
|
|
442
|
+
restoreCheckpoint: (localPath: string, checkpointID: string, options?: IContentsRequestOptions) => Promise<void>;
|
|
443
|
+
/**
|
|
444
|
+
* Delete a checkpoint for a file.
|
|
445
|
+
*
|
|
446
|
+
* @param localPath - The path of the file.
|
|
447
|
+
*
|
|
448
|
+
* @param checkpointID - The id of the checkpoint to delete.
|
|
449
|
+
*
|
|
450
|
+
* @returns A promise which resolves when the checkpoint is deleted.
|
|
451
|
+
*/
|
|
452
|
+
deleteCheckpoint: (localPath: string, checkpointID: string, options?: IContentsRequestOptions) => Promise<void>;
|
|
453
|
+
}
|
|
454
|
+
/**
|
|
455
|
+
* The options used to initialize a contents manager.
|
|
456
|
+
*/
|
|
457
|
+
export interface IContentsManagerOptions {
|
|
458
|
+
/**
|
|
459
|
+
* The default drive backend for the contents manager.
|
|
460
|
+
*/
|
|
461
|
+
defaultDrive?: IContentsDrive;
|
|
462
|
+
/**
|
|
463
|
+
* The server settings associated with the manager.
|
|
464
|
+
*/
|
|
465
|
+
serverSettings?: ISettings;
|
|
466
|
+
}
|
|
467
|
+
/**
|
|
468
|
+
* The options used to initialize a `Drive`.
|
|
469
|
+
*/
|
|
470
|
+
export interface IDriveOptions {
|
|
471
|
+
/**
|
|
472
|
+
* The name for the `Drive`, which is used in file
|
|
473
|
+
* paths to disambiguate it from other drives.
|
|
474
|
+
*/
|
|
475
|
+
name?: string;
|
|
476
|
+
/**
|
|
477
|
+
* The server settings for the server.
|
|
478
|
+
*/
|
|
479
|
+
serverSettings?: ISettings;
|
|
480
|
+
/**
|
|
481
|
+
* A REST endpoint for drive requests.
|
|
482
|
+
* If not given, defaults to the Jupyter
|
|
483
|
+
* REST API given by [Jupyter Notebook API](http://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter/notebook/master/notebook/services/api/api.yaml#!/contents).
|
|
484
|
+
*/
|
|
485
|
+
apiEndpoint?: string;
|
|
486
|
+
}
|
|
487
|
+
//# sourceMappingURL=contents-protocol.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contents-protocol.d.ts","sourceRoot":"","sources":["../../src/contents/contents-protocol.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAExE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEpD;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;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contents/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IContentsCheckpointModel, IContentsModel } from './contents-protocol.js';
|
|
2
|
+
/**
|
|
3
|
+
* Validate an `IContentsModel` object.
|
|
4
|
+
*/
|
|
5
|
+
export declare function validateContentsModel(model: IContentsModel): asserts model is IContentsModel;
|
|
6
|
+
/**
|
|
7
|
+
* Validate an `IContentsCheckpointModel` object.
|
|
8
|
+
*/
|
|
9
|
+
export declare function validateCheckpointModel(model: IContentsCheckpointModel): asserts model is IContentsCheckpointModel;
|
|
10
|
+
//# sourceMappingURL=validate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/contents/validate.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,wBAAwB,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAEvF;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,cAAc,GACpB,OAAO,CAAC,KAAK,IAAI,cAAc,CASjC;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,wBAAwB,GAC9B,OAAO,CAAC,KAAK,IAAI,wBAAwB,CAG3C"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { validateProperty } from "../validate-property.js";
|
|
2
|
+
/**
|
|
3
|
+
* Validate an `IContentsModel` object.
|
|
4
|
+
*/
|
|
5
|
+
export function validateContentsModel(model) {
|
|
6
|
+
validateProperty(model, 'name', 'string');
|
|
7
|
+
validateProperty(model, 'path', 'string');
|
|
8
|
+
validateProperty(model, 'type', 'string');
|
|
9
|
+
validateProperty(model, 'created', 'string');
|
|
10
|
+
validateProperty(model, 'last_modified', 'string');
|
|
11
|
+
validateProperty(model, 'mimetype', 'object');
|
|
12
|
+
validateProperty(model, 'content', 'object');
|
|
13
|
+
validateProperty(model, 'format', 'object');
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Validate an `IContentsCheckpointModel` object.
|
|
18
|
+
*/
|
|
19
|
+
export function validateCheckpointModel(model) {
|
|
20
|
+
validateProperty(model, 'id', 'string');
|
|
21
|
+
validateProperty(model, 'last_modified', 'string');
|
|
22
|
+
}
|
package/es/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from './module.js';
|
|
2
|
+
export * from './contents/index.js';
|
|
3
|
+
export * from './kernel/index.js';
|
|
4
|
+
export * from './session/index.js';
|
|
5
|
+
export * from './server/index.js';
|
|
6
|
+
export * from './kernelspec/index.js';
|
|
7
|
+
export * from './libro-kernel-connection-manager.js';
|
|
8
|
+
export * from './page-config.js';
|
|
9
|
+
export * from './protocol.js';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sCAAsC,CAAC;AACrD,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC"}
|
package/es/index.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from "./module.js";
|
|
2
|
+
export * from "./contents/index.js";
|
|
3
|
+
export * from "./kernel/index.js";
|
|
4
|
+
export * from "./session/index.js";
|
|
5
|
+
export * from "./server/index.js";
|
|
6
|
+
export * from "./kernelspec/index.js";
|
|
7
|
+
export * from "./libro-kernel-connection-manager.js";
|
|
8
|
+
export * from "./page-config.js";
|
|
9
|
+
export * from "./protocol.js";
|
package/es/index.less
ADDED
|
File without changes
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import type { JSONObject } from '@difizen/libro-common';
|
|
2
|
+
import type { IComm, IShellFuture, IKernelConnection } from './libro-kernel-protocol.js';
|
|
3
|
+
import * as KernelMessage from './messages.js';
|
|
4
|
+
/**
|
|
5
|
+
* Comm channel handler.
|
|
6
|
+
*/
|
|
7
|
+
export declare class CommHandler implements IComm {
|
|
8
|
+
protected _target: string;
|
|
9
|
+
protected _id: string;
|
|
10
|
+
protected _kernel: IKernelConnection;
|
|
11
|
+
protected _onClose: (msg: KernelMessage.ICommCloseMsg<'iopub' | 'shell'>) => void | PromiseLike<void>;
|
|
12
|
+
protected _onMsg: (msg: KernelMessage.ICommMsgMsg) => void | PromiseLike<void>;
|
|
13
|
+
protected disposeCb: () => void;
|
|
14
|
+
disposed: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Construct a new comm channel.
|
|
17
|
+
*/
|
|
18
|
+
constructor(target: string, id: string, kernel: IKernelConnection, disposeCb: () => void);
|
|
19
|
+
dispose(): void;
|
|
20
|
+
/**
|
|
21
|
+
* The unique id for the comm channel.
|
|
22
|
+
*/
|
|
23
|
+
get commId(): string;
|
|
24
|
+
/**
|
|
25
|
+
* The target name for the comm channel.
|
|
26
|
+
*/
|
|
27
|
+
get targetName(): string;
|
|
28
|
+
/**
|
|
29
|
+
* Get the callback for a comm close event.
|
|
30
|
+
*
|
|
31
|
+
* #### Notes
|
|
32
|
+
* This is called when the comm is closed from either the server or client.
|
|
33
|
+
*
|
|
34
|
+
* **See also:** [[ICommClose]], [[close]]
|
|
35
|
+
*/
|
|
36
|
+
get onClose(): (msg: KernelMessage.ICommCloseMsg) => void | PromiseLike<void>;
|
|
37
|
+
/**
|
|
38
|
+
* Set the callback for a comm close event.
|
|
39
|
+
*
|
|
40
|
+
* #### Notes
|
|
41
|
+
* This is called when the comm is closed from either the server or client. If
|
|
42
|
+
* the function returns a promise, and the kernel was closed from the server,
|
|
43
|
+
* kernel message processing will pause until the returned promise is
|
|
44
|
+
* fulfilled.
|
|
45
|
+
*
|
|
46
|
+
* **See also:** [[close]]
|
|
47
|
+
*/
|
|
48
|
+
set onClose(cb: (msg: KernelMessage.ICommCloseMsg) => void | PromiseLike<void>);
|
|
49
|
+
/**
|
|
50
|
+
* Get the callback for a comm message received event.
|
|
51
|
+
*/
|
|
52
|
+
get onMsg(): (msg: KernelMessage.ICommMsgMsg) => void | PromiseLike<void>;
|
|
53
|
+
/**
|
|
54
|
+
* Set the callback for a comm message received event.
|
|
55
|
+
*
|
|
56
|
+
* #### Notes
|
|
57
|
+
* This is called when a comm message is received. If the function returns a
|
|
58
|
+
* promise, kernel message processing will pause until it is fulfilled.
|
|
59
|
+
*/
|
|
60
|
+
set onMsg(cb: (msg: KernelMessage.ICommMsgMsg) => void | PromiseLike<void>);
|
|
61
|
+
/**
|
|
62
|
+
* Open a comm with optional data and metadata.
|
|
63
|
+
*
|
|
64
|
+
* #### Notes
|
|
65
|
+
* This sends a `comm_open` message to the server.
|
|
66
|
+
*
|
|
67
|
+
* **See also:** [[ICommOpen]]
|
|
68
|
+
*/
|
|
69
|
+
open(data?: JSONObject, metadata?: JSONObject, buffers?: (ArrayBuffer | ArrayBufferView)[]): IShellFuture;
|
|
70
|
+
/**
|
|
71
|
+
* Send a `comm_msg` message to the kernel.
|
|
72
|
+
*
|
|
73
|
+
* #### Notes
|
|
74
|
+
* This is a no-op if the comm has been closed.
|
|
75
|
+
*
|
|
76
|
+
* **See also:** [[ICommMsg]]
|
|
77
|
+
*/
|
|
78
|
+
send(data: JSONObject, metadata?: JSONObject, buffers?: (ArrayBuffer | ArrayBufferView)[], disposeOnDone?: boolean): IShellFuture;
|
|
79
|
+
/**
|
|
80
|
+
* Close the comm.
|
|
81
|
+
*
|
|
82
|
+
* #### Notes
|
|
83
|
+
* This will send a `comm_close` message to the kernel, and call the
|
|
84
|
+
* `onClose` callback if set.
|
|
85
|
+
*
|
|
86
|
+
* This is a no-op if the comm is already closed.
|
|
87
|
+
*
|
|
88
|
+
* **See also:** [[ICommClose]], [[onClose]]
|
|
89
|
+
*/
|
|
90
|
+
close(data?: JSONObject, metadata?: JSONObject, buffers?: (ArrayBuffer | ArrayBufferView)[]): IShellFuture;
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=comm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comm.d.ts","sourceRoot":"","sources":["../../src/kernel/comm.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,KAAK,EACV,KAAK,EACL,YAAY,EACZ,iBAAiB,EAClB,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,aAAa,MAAM,eAAe,CAAC;AAE/C;;GAEG;AACH,qBAAa,WAAY,YAAW,KAAK;IACvC,SAAS,CAAC,OAAO,SAAM;IACvB,SAAS,CAAC,GAAG,SAAM;IACnB,SAAS,CAAC,OAAO,EAAE,iBAAiB,CAAC;IACrC,SAAS,CAAC,QAAQ,EAAE,CAClB,GAAG,EAAE,aAAa,CAAC,aAAa,CAAC,OAAO,GAAG,OAAO,CAAC,KAChD,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;IAC9B,SAAS,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,aAAa,CAAC,WAAW,KAAK,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;IAE/E,SAAS,CAAC,SAAS,EAAE,MAAM,IAAI,CAAC;IAChC,QAAQ,UAAS;IAEjB;;OAEG;gBAED,MAAM,EAAE,MAAM,EACd,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,iBAAiB,EACzB,SAAS,EAAE,MAAM,IAAI;IAOvB,OAAO;IAKP;;OAEG;IACH,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED;;OAEG;IACH,IAAI,UAAU,IAAI,MAAM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