1 | /**
|
2 | * The namespace for `PageConfig` functions.
|
3 | */
|
4 | export declare namespace PageConfig {
|
5 | /**
|
6 | * Get global configuration data for the Jupyter application.
|
7 | *
|
8 | * @param name - The name of the configuration option.
|
9 | *
|
10 | * @returns The config value or an empty string if not found.
|
11 | *
|
12 | * #### Notes
|
13 | * All values are treated as strings.
|
14 | * For browser based applications, it is assumed that the page HTML
|
15 | * includes a script tag with the id `jupyter-config-data` containing the
|
16 | * configuration as valid JSON. In order to support the classic Notebook,
|
17 | * we fall back on checking for `body` data of the given `name`.
|
18 | *
|
19 | * For node applications, it is assumed that the process was launched
|
20 | * with a `--jupyter-config-data` option pointing to a JSON settings
|
21 | * file.
|
22 | */
|
23 | function getOption(name: string): string;
|
24 | /**
|
25 | * Set global configuration data for the Jupyter application.
|
26 | *
|
27 | * @param name - The name of the configuration option.
|
28 | * @param value - The value to set the option to.
|
29 | *
|
30 | * @returns The last config value or an empty string if it doesn't exist.
|
31 | */
|
32 | function setOption(name: string, value: string): string;
|
33 | /**
|
34 | * Get the base url for a Jupyter application, or the base url of the page.
|
35 | */
|
36 | function getBaseUrl(): string;
|
37 | /**
|
38 | * Get the tree url for a JupyterLab application.
|
39 | */
|
40 | function getTreeUrl(): string;
|
41 | /**
|
42 | * Get the base url for sharing links (usually baseUrl)
|
43 | */
|
44 | function getShareUrl(): string;
|
45 | /**
|
46 | * Get the tree url for shareable links.
|
47 | * Usually the same as treeUrl,
|
48 | * but overridable e.g. when sharing with JupyterHub.
|
49 | */
|
50 | function getTreeShareUrl(): string;
|
51 | /**
|
52 | * Create a new URL given an optional mode and tree path.
|
53 | *
|
54 | * This is used to create URLS when the mode or tree path change as the user
|
55 | * changes mode or the current document in the main area. If fields in
|
56 | * options are omitted, the value in PageConfig will be used.
|
57 | *
|
58 | * @param options - IGetUrlOptions for the new path.
|
59 | */
|
60 | function getUrl(options: IGetUrlOptions): string;
|
61 | const defaultWorkspace: string;
|
62 | /**
|
63 | * Options for getUrl
|
64 | */
|
65 | interface IGetUrlOptions {
|
66 | /**
|
67 | * The optional mode as a string 'single-document' or 'multiple-document'. If
|
68 | * the mode argument is missing, it will be provided from the PageConfig.
|
69 | */
|
70 | mode?: string;
|
71 | /**
|
72 | * The optional workspace as a string. If this argument is missing, the value will
|
73 | * be pulled from PageConfig. To use the default workspace (no /workspaces/<name>
|
74 | * URL segment will be included) pass the string PageConfig.defaultWorkspace.
|
75 | */
|
76 | workspace?: string;
|
77 | /**
|
78 | * Whether the url is meant to be shared or not; default false.
|
79 | */
|
80 | toShare?: boolean;
|
81 | /**
|
82 | * The optional tree path as as string. If treePath is not provided it will be
|
83 | * provided from the PageConfig. If an empty string, the resulting path will not
|
84 | * contain a tree portion.
|
85 | */
|
86 | treePath?: string;
|
87 | }
|
88 | /**
|
89 | * Get the base websocket url for a Jupyter application, or an empty string.
|
90 | */
|
91 | function getWsUrl(baseUrl?: string): string;
|
92 | /**
|
93 | * Returns the URL converting this notebook to a certain
|
94 | * format with nbconvert.
|
95 | */
|
96 | function getNBConvertURL({ path, format, download }: {
|
97 | path: string;
|
98 | format: string;
|
99 | download: boolean;
|
100 | }): string;
|
101 | /**
|
102 | * Get the authorization token for a Jupyter application.
|
103 | */
|
104 | function getToken(): string;
|
105 | /**
|
106 | * Get the Notebook version info [major, minor, patch].
|
107 | */
|
108 | function getNotebookVersion(): [number, number, number];
|
109 | /**
|
110 | * The namespace for page config `Extension` functions.
|
111 | */
|
112 | namespace Extension {
|
113 | /**
|
114 | * The collection of deferred extensions in page config.
|
115 | */
|
116 | const deferred: string[];
|
117 | /**
|
118 | * The collection of disabled extensions in page config.
|
119 | */
|
120 | const disabled: string[];
|
121 | /**
|
122 | * Returns whether a plugin is deferred.
|
123 | *
|
124 | * @param id - The plugin ID.
|
125 | */
|
126 | function isDeferred(id: string): boolean;
|
127 | /**
|
128 | * Returns whether a plugin is disabled.
|
129 | *
|
130 | * @param id - The plugin ID.
|
131 | */
|
132 | function isDisabled(id: string): boolean;
|
133 | }
|
134 | }
|