@enonic-types/lib-schema 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.
Files changed (3) hide show
  1. package/README.md +20 -28
  2. package/package.json +4 -1
  3. package/schema.d.ts +4 -2
package/README.md CHANGED
@@ -1,44 +1,34 @@
1
1
  # Enonic XP lib-schema TS types
2
2
 
3
3
  > TypeScript definitions for `lib-schema` library of Enonic XP
4
+
4
5
  ## Install
5
6
 
6
7
  ```bash
7
- npm i --save-dev @enonic/lib-schema
8
+ npm i --save-dev @enonic-types/lib-schema
8
9
  ```
9
10
 
10
11
  ## Use
11
12
 
12
- Add the corresponding types to your `tsconfig.json` file that is used for application's server-side TypeScript code.
13
-
14
- `tsconfig.json`
15
- ```json
16
- {
17
- "compilerOptions": {
18
- "types": [
19
- "@enonic-types/lib-schema"
20
- ]
21
- }
22
- }
23
- ```
24
-
25
13
  ### Require and custom imports
26
14
 
27
- To make `require` work out of box, you must install and add the `@enonic-types/global` types. Aside from providing definitions for XP global 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.
28
17
 
29
18
  `tsconfig.json`
30
- ```diff
19
+
20
+ ```json
31
21
  {
32
22
  "compilerOptions": {
33
23
  "types": [
34
- + "@enonic-types/global"
35
- "@enonic-types/lib-schema"
24
+ "@enonic-types/global"
36
25
  ]
37
26
  }
38
27
  }
39
28
  ```
40
29
 
41
30
  `example.ts`
31
+
42
32
  ```ts
43
33
  const {
44
34
  createSchema,
@@ -60,28 +50,30 @@ const {
60
50
  } = require('/lib/xp/schema');
61
51
  ```
62
52
 
63
- More detailed explanation on how it works and how to type custom import function can be found [here](https://github.com/enonic/xp/tree/master/modules/lib/typescript/README.md).
53
+ More detailed explanation on how it works and how to type custom import function can be
54
+ found [here](https://developer.enonic.com/docs/xp/stable/api).
64
55
 
65
56
  ### ES6-style import
66
57
 
67
- If you are planning to use `import` in your code and transpile it with the default `tsc` TypeScript compiler, you'll need to add proper types mapping to your configuration.
58
+ If you are planning to use `import` in your code and transpile it with the default `tsc` TypeScript compiler, you'll need to add proper
59
+ types mapping to your configuration.
68
60
 
69
61
  `tsconfig.json`
70
- ```diff
62
+
63
+
64
+ ```json
71
65
  {
72
66
  "compilerOptions": {
73
- "types": [
74
- "@enonic-types/lib-schema"
75
- ]
76
- + "baseUrl": "./",
77
- + "paths": {
78
- + "/lib/xp/schema": ["node_modules/@enonic-types/lib-schema"],
79
- + }
67
+ "baseUrl": "./",
68
+ "paths": {
69
+ "/lib/xp/schema": ["node_modules/@enonic-types/lib-schema"]
70
+ }
80
71
  }
81
72
  }
82
73
  ```
83
74
 
84
75
  `example.ts`
76
+
85
77
  ```ts
86
78
  import {
87
79
  createSchema,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@enonic-types/lib-schema",
3
- "version": "7.11.0-B1",
3
+ "version": "7.11.0-B4",
4
4
  "description": "Type definitions for lib-schema.",
5
5
  "types": "schema.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
  }
package/schema.d.ts CHANGED
@@ -11,6 +11,8 @@ declare global {
11
11
  '/lib/xp/schema': typeof import('./schema');
12
12
  }
13
13
  }
14
+ import type { UserKey } from '@enonic-types/core';
15
+ export type { PrincipalKey, UserKey, GroupKey, RoleKey } from '@enonic-types/core';
14
16
  export interface Icon {
15
17
  data: unknown;
16
18
  mimeType: string;
@@ -102,9 +104,9 @@ export interface Schema {
102
104
  description: string;
103
105
  descriptionI18nKey: string;
104
106
  createdTime: string;
105
- creator: string;
107
+ creator: UserKey;
106
108
  modifiedTime: string;
107
- modifier: string;
109
+ modifier: UserKey;
108
110
  resource: string;
109
111
  type: ContentSchemaType;
110
112
  icon?: Icon;