@jupyterlite/settings 0.1.0-alpha.9 → 0.1.0-beta.2
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/settings.d.ts +18 -0
- package/lib/settings.js +16 -7
- package/lib/tokens.d.ts +0 -23
- package/package.json +6 -6
package/lib/settings.d.ts
CHANGED
|
@@ -3,6 +3,11 @@ import { IPlugin } from './tokens';
|
|
|
3
3
|
* A class to handle requests to /api/settings
|
|
4
4
|
*/
|
|
5
5
|
export declare class Settings {
|
|
6
|
+
constructor(options?: Settings.IOptions);
|
|
7
|
+
/**
|
|
8
|
+
* Create a settings store.
|
|
9
|
+
*/
|
|
10
|
+
protected defaultSettingsStorage(): LocalForage;
|
|
6
11
|
/**
|
|
7
12
|
* Get settings by plugin id
|
|
8
13
|
*
|
|
@@ -30,5 +35,18 @@ export declare class Settings {
|
|
|
30
35
|
* @param pluginId The id of a plugin
|
|
31
36
|
*/
|
|
32
37
|
private _getFederated;
|
|
38
|
+
private _settingsStorageName;
|
|
33
39
|
private _storage;
|
|
34
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* A namespaces for settings metadata.
|
|
43
|
+
*/
|
|
44
|
+
declare namespace Settings {
|
|
45
|
+
/**
|
|
46
|
+
* Initialization options for settings.
|
|
47
|
+
*/
|
|
48
|
+
interface IOptions {
|
|
49
|
+
settingsStorageName?: string | null;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
export {};
|
package/lib/settings.js
CHANGED
|
@@ -4,17 +4,26 @@ import localforage from 'localforage';
|
|
|
4
4
|
/**
|
|
5
5
|
* The name of the local storage.
|
|
6
6
|
*/
|
|
7
|
-
const
|
|
7
|
+
const DEFAULT_STORAGE_NAME = 'JupyterLite Storage';
|
|
8
8
|
/**
|
|
9
9
|
* A class to handle requests to /api/settings
|
|
10
10
|
*/
|
|
11
11
|
export class Settings {
|
|
12
|
-
constructor() {
|
|
13
|
-
this.
|
|
14
|
-
|
|
12
|
+
constructor(options) {
|
|
13
|
+
this._settingsStorageName = DEFAULT_STORAGE_NAME;
|
|
14
|
+
this._settingsStorageName =
|
|
15
|
+
(options || {}).settingsStorageName || DEFAULT_STORAGE_NAME;
|
|
16
|
+
this._storage = this.defaultSettingsStorage();
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Create a settings store.
|
|
20
|
+
*/
|
|
21
|
+
defaultSettingsStorage() {
|
|
22
|
+
return localforage.createInstance({
|
|
23
|
+
name: this._settingsStorageName,
|
|
15
24
|
description: 'Offline Storage for Settings',
|
|
16
25
|
storeName: 'settings',
|
|
17
|
-
version: 1
|
|
26
|
+
version: 1,
|
|
18
27
|
});
|
|
19
28
|
}
|
|
20
29
|
/**
|
|
@@ -48,7 +57,7 @@ export class Settings {
|
|
|
48
57
|
return {
|
|
49
58
|
...Private.override(plugin),
|
|
50
59
|
raw,
|
|
51
|
-
settings: json5.parse(raw)
|
|
60
|
+
settings: json5.parse(raw),
|
|
52
61
|
};
|
|
53
62
|
}));
|
|
54
63
|
return { settings };
|
|
@@ -86,7 +95,7 @@ export class Settings {
|
|
|
86
95
|
raw,
|
|
87
96
|
schema,
|
|
88
97
|
settings,
|
|
89
|
-
version: packageJson.version || '3.0.8'
|
|
98
|
+
version: packageJson.version || '3.0.8',
|
|
90
99
|
});
|
|
91
100
|
}
|
|
92
101
|
}
|
package/lib/tokens.d.ts
CHANGED
|
@@ -55,26 +55,3 @@ export interface ISettings {
|
|
|
55
55
|
*/
|
|
56
56
|
save(pluginId: string, raw: string): Promise<void>;
|
|
57
57
|
}
|
|
58
|
-
/**
|
|
59
|
-
* The interface for a federated extension, as it appears in `jupyter-config-data`
|
|
60
|
-
*
|
|
61
|
-
* TODO: sync with schema, Lab core, etc.
|
|
62
|
-
*/
|
|
63
|
-
export interface IFederatedExtension {
|
|
64
|
-
/**
|
|
65
|
-
* The npm-compatible name of the package
|
|
66
|
-
*/
|
|
67
|
-
name: string;
|
|
68
|
-
/**
|
|
69
|
-
* The relative path to the extension
|
|
70
|
-
*/
|
|
71
|
-
extension: string;
|
|
72
|
-
/**
|
|
73
|
-
* The relative entrypoint to the WebPack remoteEntry
|
|
74
|
-
*/
|
|
75
|
-
load: string;
|
|
76
|
-
/**
|
|
77
|
-
* Optional path to the style module
|
|
78
|
-
*/
|
|
79
|
-
style?: string;
|
|
80
|
-
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jupyterlite/settings",
|
|
3
|
-
"version": "0.1.0-
|
|
3
|
+
"version": "0.1.0-beta.2",
|
|
4
4
|
"description": "JupyterLite - Settings",
|
|
5
5
|
"homepage": "https://github.com/jupyterlite/jupyterlite",
|
|
6
6
|
"bugs": {
|
|
@@ -42,21 +42,21 @@
|
|
|
42
42
|
"watch": "tsc -b --watch"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@jupyterlab/coreutils": "~5.
|
|
46
|
-
"@jupyterlab/settingregistry": "~3.
|
|
47
|
-
"@lumino/coreutils": "^1.
|
|
45
|
+
"@jupyterlab/coreutils": "~5.3.0",
|
|
46
|
+
"@jupyterlab/settingregistry": "~3.3.0",
|
|
47
|
+
"@lumino/coreutils": "^1.12.0",
|
|
48
48
|
"json5": "^2.2.0",
|
|
49
49
|
"localforage": "^1.9.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@babel/core": "^7.11.6",
|
|
53
53
|
"@babel/preset-env": "^7.12.1",
|
|
54
|
-
"@jupyterlab/testutils": "~3.
|
|
54
|
+
"@jupyterlab/testutils": "~3.3.0",
|
|
55
55
|
"@types/jest": "^26.0.10",
|
|
56
56
|
"jest": "^26.4.2",
|
|
57
57
|
"rimraf": "~3.0.0",
|
|
58
58
|
"ts-jest": "^26.3.0",
|
|
59
|
-
"typescript": "~4.2
|
|
59
|
+
"typescript": "~4.5.2"
|
|
60
60
|
},
|
|
61
61
|
"publishConfig": {
|
|
62
62
|
"access": "public"
|