@enonic-types/lib-auditlog 7.11.0-B1 → 7.11.0-B4
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 +11 -29
- package/auditlog.d.ts +12 -2
- package/package.json +4 -1
package/README.md
CHANGED
|
@@ -5,38 +5,23 @@
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm i --save-dev @enonic/lib-auditlog
|
|
8
|
+
npm i --save-dev @enonic-types/lib-auditlog
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
## Use
|
|
12
12
|
|
|
13
|
-
Add the corresponding types to your `tsconfig.json` file that is used for application's server-side TypeScript code.
|
|
14
|
-
|
|
15
|
-
`tsconfig.json`
|
|
16
|
-
|
|
17
|
-
```json
|
|
18
|
-
{
|
|
19
|
-
"compilerOptions": {
|
|
20
|
-
"types": [
|
|
21
|
-
"@enonic-types/lib-auditlog"
|
|
22
|
-
]
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
```
|
|
26
|
-
|
|
27
13
|
### Require and custom imports
|
|
28
14
|
|
|
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.
|
|
15
|
+
To make `require` work out of the box, you must install and add the `@enonic-types/global` types. Aside from providing definitions for XP
|
|
16
|
+
global objects, e.g. `log`, `app`, `__`, etc, requiring a library by the default path will return typed object.
|
|
31
17
|
|
|
32
18
|
`tsconfig.json`
|
|
33
19
|
|
|
34
|
-
```
|
|
20
|
+
```json
|
|
35
21
|
{
|
|
36
22
|
"compilerOptions": {
|
|
37
23
|
"types": [
|
|
38
|
-
|
|
39
|
-
"@enonic-types/lib-auditlog"
|
|
24
|
+
"@enonic-types/global"
|
|
40
25
|
]
|
|
41
26
|
}
|
|
42
27
|
}
|
|
@@ -49,7 +34,7 @@ const {log, get, find} = require('/lib/xp/auditlog');
|
|
|
49
34
|
```
|
|
50
35
|
|
|
51
36
|
More detailed explanation on how it works and how to type custom import function can be
|
|
52
|
-
found [here](https://
|
|
37
|
+
found [here](https://developer.enonic.com/docs/xp/stable/api).
|
|
53
38
|
|
|
54
39
|
### ES6-style import
|
|
55
40
|
|
|
@@ -58,16 +43,13 @@ types mapping to your configuration.
|
|
|
58
43
|
|
|
59
44
|
`tsconfig.json`
|
|
60
45
|
|
|
61
|
-
```
|
|
46
|
+
```json
|
|
62
47
|
{
|
|
63
48
|
"compilerOptions": {
|
|
64
|
-
"
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
+ "paths": {
|
|
69
|
-
+ "/lib/xp/auditlog": ["node_modules/@enonic-types/lib-auditlog"],
|
|
70
|
-
+ }
|
|
49
|
+
"baseUrl": "./",
|
|
50
|
+
"paths": {
|
|
51
|
+
"/lib/xp/auditlog": ["node_modules/@enonic-types/lib-auditlog"]
|
|
52
|
+
}
|
|
71
53
|
}
|
|
72
54
|
}
|
|
73
55
|
```
|
package/auditlog.d.ts
CHANGED
|
@@ -1,13 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Functions to log and find audit logs.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* var auditLib = require('/lib/xp/auditlog');
|
|
6
|
+
*
|
|
7
|
+
* @module audit
|
|
8
|
+
*/
|
|
1
9
|
declare global {
|
|
2
10
|
interface XpLibraries {
|
|
3
11
|
'/lib/xp/auditlog': typeof import('./auditlog');
|
|
4
12
|
}
|
|
5
13
|
}
|
|
14
|
+
import type { UserKey } from '@enonic-types/core';
|
|
15
|
+
export type { UserKey } from '@enonic-types/core';
|
|
6
16
|
export interface AuditLogParams {
|
|
7
17
|
type: string;
|
|
8
18
|
time?: string;
|
|
9
19
|
source?: string;
|
|
10
|
-
user?:
|
|
20
|
+
user?: UserKey;
|
|
11
21
|
objects?: string[];
|
|
12
22
|
data?: Record<string, unknown>;
|
|
13
23
|
}
|
|
@@ -16,7 +26,7 @@ export interface AuditLog {
|
|
|
16
26
|
type: string;
|
|
17
27
|
time: string;
|
|
18
28
|
source: string;
|
|
19
|
-
user:
|
|
29
|
+
user: UserKey;
|
|
20
30
|
objects: string[];
|
|
21
31
|
data: Record<string, unknown>;
|
|
22
32
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@enonic-types/lib-auditlog",
|
|
3
|
-
"version": "7.11.0-
|
|
3
|
+
"version": "7.11.0-B4",
|
|
4
4
|
"description": "Type definitions for lib-auditlog.",
|
|
5
5
|
"types": "auditlog.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -26,6 +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": {
|
|
30
|
+
"@enonic-types/core": "7.11.0-B4"
|
|
31
|
+
},
|
|
29
32
|
"publishConfig": {
|
|
30
33
|
"access": "public"
|
|
31
34
|
}
|