@enonic-types/lib-admin 7.16.2 → 8.0.0-A3
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/README.md +2 -2
- package/admin.d.ts +40 -44
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -30,7 +30,7 @@ global objects, e.g. `log`, `app`, `__`, etc, requiring a library by the default
|
|
|
30
30
|
`example.ts`
|
|
31
31
|
|
|
32
32
|
```ts
|
|
33
|
-
const {getBaseUri,
|
|
33
|
+
const {getBaseUri, getHomeToolUrl, HomeToolUrlType} = require('/lib/xp/admin');
|
|
34
34
|
```
|
|
35
35
|
|
|
36
36
|
More detailed explanation on how it works and how to type custom import function can be
|
|
@@ -57,7 +57,7 @@ types mapping to your configuration.
|
|
|
57
57
|
`example.ts`
|
|
58
58
|
|
|
59
59
|
```ts
|
|
60
|
-
import {getBaseUri,
|
|
60
|
+
import {getBaseUri, getHomeToolUrl, HomeToolUrlType} from '/lib/xp/admin';
|
|
61
61
|
```
|
|
62
62
|
|
|
63
63
|
Setting `baseUrl` and `paths` will allow the `tsc` to keep the valid paths in the resulting JavaScript files.
|
package/admin.d.ts
CHANGED
|
@@ -3,48 +3,6 @@ declare global {
|
|
|
3
3
|
'/lib/xp/admin': typeof import('./admin');
|
|
4
4
|
}
|
|
5
5
|
}
|
|
6
|
-
/**
|
|
7
|
-
* Returns the admin base uri.
|
|
8
|
-
*
|
|
9
|
-
* @returns {string} Admin base uri.
|
|
10
|
-
*/
|
|
11
|
-
export declare function getBaseUri(): string;
|
|
12
|
-
/**
|
|
13
|
-
* Returns the admin assets uri.
|
|
14
|
-
*
|
|
15
|
-
* @returns {string} Assets uri.
|
|
16
|
-
*/
|
|
17
|
-
export declare function getAssetsUri(): string;
|
|
18
|
-
/**
|
|
19
|
-
* Returns the preferred locale based on the current HTTP request, or the server default locale if none is specified.
|
|
20
|
-
*
|
|
21
|
-
* @returns {string} Current locale.
|
|
22
|
-
*/
|
|
23
|
-
export declare function getLocale(): string;
|
|
24
|
-
/**
|
|
25
|
-
* Returns the list of preferred locales based on the current HTTP request, or the server default locale if none is specified.
|
|
26
|
-
*
|
|
27
|
-
* @returns {string[]} Current locales in order of preference.
|
|
28
|
-
*/
|
|
29
|
-
export declare function getLocales(): string[];
|
|
30
|
-
/**
|
|
31
|
-
* Returns all i18n phrases.
|
|
32
|
-
*
|
|
33
|
-
* @returns {object} JSON object with phrases.
|
|
34
|
-
*/
|
|
35
|
-
export declare function getPhrases(): string;
|
|
36
|
-
/**
|
|
37
|
-
* Returns the URL for launcher panel.
|
|
38
|
-
*
|
|
39
|
-
* @returns {string} URL.
|
|
40
|
-
*/
|
|
41
|
-
export declare function getLauncherUrl(): string;
|
|
42
|
-
/**
|
|
43
|
-
* Returns the URL for launcher javascript.
|
|
44
|
-
*
|
|
45
|
-
* @returns {string} Path.
|
|
46
|
-
*/
|
|
47
|
-
export declare function getLauncherPath(): string;
|
|
48
6
|
/**
|
|
49
7
|
* Returns the URL for an admin tool of specific application.
|
|
50
8
|
* @param {string} application Full application name (f.ex, 'com.enonic.app')
|
|
@@ -60,11 +18,11 @@ export declare function getToolUrl(application: string, tool: string): string;
|
|
|
60
18
|
*
|
|
61
19
|
* @returns {string} URL.
|
|
62
20
|
*/
|
|
63
|
-
export declare function getHomeToolUrl(params
|
|
21
|
+
export declare function getHomeToolUrl(params?: GetHomeToolUrlParams): string;
|
|
64
22
|
export interface GetHomeToolUrlParams {
|
|
65
23
|
type: HomeToolUrlType;
|
|
66
24
|
}
|
|
67
|
-
export
|
|
25
|
+
export type HomeToolUrlType = 'server' | 'absolute';
|
|
68
26
|
/**
|
|
69
27
|
* Returns installation name.
|
|
70
28
|
*
|
|
@@ -77,3 +35,41 @@ export declare function getInstallation(): string;
|
|
|
77
35
|
* @returns {string} Version.
|
|
78
36
|
*/
|
|
79
37
|
export declare function getVersion(): string;
|
|
38
|
+
export interface WidgetUrlParams {
|
|
39
|
+
application: string;
|
|
40
|
+
widget: string;
|
|
41
|
+
type?: 'server' | 'absolute';
|
|
42
|
+
params?: object;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* @deprecated Use `extensionUrl` instead. This function will be removed in future versions.
|
|
46
|
+
*
|
|
47
|
+
* Returns the URL for a widget.
|
|
48
|
+
*
|
|
49
|
+
* @param {object} [params] Parameter object
|
|
50
|
+
* @param {string} params.application Application to reference to a widget.
|
|
51
|
+
* @param {string} params.widget Name of the widget.
|
|
52
|
+
* @param {string} [params.type=server] URL type. Either `server` (server-relative URL) or `absolute`.
|
|
53
|
+
* @param {object} [params.params] Custom query parameters to append to the URL.
|
|
54
|
+
*
|
|
55
|
+
* @returns {string} URL.
|
|
56
|
+
*/
|
|
57
|
+
export declare function widgetUrl(params: WidgetUrlParams): string;
|
|
58
|
+
export interface ExtensionUrlParams {
|
|
59
|
+
application: string;
|
|
60
|
+
extension: string;
|
|
61
|
+
type?: 'server' | 'absolute';
|
|
62
|
+
params?: object;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Returns the URL for an extension.
|
|
66
|
+
*
|
|
67
|
+
* @param {object} [params] Parameter object
|
|
68
|
+
* @param {string} params.application Application to reference to an extension.
|
|
69
|
+
* @param {string} params.extension Name of the extension.
|
|
70
|
+
* @param {string} [params.type=server] URL type. Either `server` (server-relative URL) or `absolute`.
|
|
71
|
+
* @param {object} [params.params] Custom query parameters to append to the URL.
|
|
72
|
+
*
|
|
73
|
+
* @returns {string} URL.
|
|
74
|
+
*/
|
|
75
|
+
export declare function extensionUrl(params: ExtensionUrlParams): string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@enonic-types/lib-admin",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.0-A3",
|
|
4
4
|
"description": "Type definitions for lib-admin.",
|
|
5
5
|
"types": "admin.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -26,7 +26,9 @@
|
|
|
26
26
|
"url": "https://github.com/enonic/xp/issues"
|
|
27
27
|
},
|
|
28
28
|
"homepage": "https://github.com/enonic/xp/tree/master#readme",
|
|
29
|
-
"dependencies": {
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@enonic-types/core": "8.0.0-A3"
|
|
31
|
+
},
|
|
30
32
|
"publishConfig": {
|
|
31
33
|
"access": "public"
|
|
32
34
|
}
|