@enonic-types/lib-content 0.1.1 → 7.11.0-B3
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 +18 -4
- package/content.d.ts +867 -886
- package/package.json +35 -32
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm i --save-dev @enonic/lib-content
|
|
8
|
+
npm i --save-dev @enonic-types/lib-content
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
## Use
|
|
@@ -26,8 +26,8 @@ Add the corresponding types to your `tsconfig.json` file that is used for applic
|
|
|
26
26
|
|
|
27
27
|
### Require and custom imports
|
|
28
28
|
|
|
29
|
-
To make `require` work out of box, you must install and add the `@enonic-types/global` types. Aside from providing definitions for XP
|
|
30
|
-
objects, e.g. `log`, `app`, `__`, etc, requiring library by the default path will return typed object.
|
|
29
|
+
To make `require` work out of the box, you must install and add the `@enonic-types/global` types. Aside from providing definitions for XP
|
|
30
|
+
global objects, e.g. `log`, `app`, `__`, etc, requiring a library by the default path will return typed object.
|
|
31
31
|
|
|
32
32
|
`tsconfig.json`
|
|
33
33
|
|
|
@@ -49,7 +49,7 @@ const {get, query, getChildren} = require('/lib/xp/content');
|
|
|
49
49
|
```
|
|
50
50
|
|
|
51
51
|
More detailed explanation on how it works and how to type custom import function can be
|
|
52
|
-
found [here](https://
|
|
52
|
+
found [here](https://developer.enonic.com/docs/xp/stable/api).
|
|
53
53
|
|
|
54
54
|
### ES6-style import
|
|
55
55
|
|
|
@@ -79,3 +79,17 @@ import {get, query, getChildren} from '/lib/xp/content';
|
|
|
79
79
|
```
|
|
80
80
|
|
|
81
81
|
Setting `baseUrl` and `paths` will allow the `tsc` to keep the valid paths in the resulting JavaScript files.
|
|
82
|
+
|
|
83
|
+
### Additional types
|
|
84
|
+
|
|
85
|
+
Note that not all types are available for import, but can easily be retrieved from the `Content`:
|
|
86
|
+
|
|
87
|
+
```ts
|
|
88
|
+
import type {Content} from '/lib/xp/content';
|
|
89
|
+
|
|
90
|
+
type Attachments = Content['attachments'];
|
|
91
|
+
|
|
92
|
+
type ContentInheritType = Content['inherit'];
|
|
93
|
+
|
|
94
|
+
type Workflow = Content['workflow'];
|
|
95
|
+
```
|