@dotcms/types 1.1.1 → 1.2.0
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
CHANGED
|
@@ -1,22 +1,14 @@
|
|
|
1
|
-
#
|
|
1
|
+
# dotCMS Types Library
|
|
2
|
+
|
|
3
|
+
The `@dotcms/types` package contains TypeScript type definitions for the dotCMS ecosystem. Use it to enable type safety and an enhanced developer experience when working with dotCMS APIs and structured content.
|
|
2
4
|
|
|
3
5
|
📦 [@dotcms/types on npm](https://www.npmjs.com/package/@dotcms/types)
|
|
4
6
|
🛠️ [View source on GitHub](https://github.com/dotCMS/core/tree/main/core-web/libs/sdk/types)
|
|
5
7
|
|
|
6
|
-
## Installation
|
|
7
|
-
|
|
8
|
-
```bash
|
|
9
|
-
npm install @dotcms/types@latest --save-dev
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
## Overview
|
|
13
|
-
|
|
14
|
-
This package contains TypeScript type definitions for the dotCMS ecosystem. Use it to enable type safety and an enhanced developer experience when working with dotCMS APIs and structured content.
|
|
15
|
-
|
|
16
8
|
## Table of Contents
|
|
17
9
|
|
|
18
|
-
- [Installation](#installation)
|
|
19
10
|
- [Overview](#overview)
|
|
11
|
+
- [Installation](#installation)
|
|
20
12
|
- [Commonly Used Types](#commonly-used-types)
|
|
21
13
|
- [Type Hierarchy (Jump to Definitions)](#type-hierarchy-jump-to-definitions)
|
|
22
14
|
- [dotCMS Content & Pages](#dotcms-content--pages)
|
|
@@ -24,11 +16,35 @@ This package contains TypeScript type definitions for the dotCMS ecosystem. Use
|
|
|
24
16
|
- [Block Editor](#block-editor)
|
|
25
17
|
- [Client & HTTP](#client--http)
|
|
26
18
|
- [Error Handling](#error-handling)
|
|
27
|
-
- [
|
|
19
|
+
- [Usage Examples](#usage-examples)
|
|
28
20
|
- [Error Type Checking](#error-type-checking)
|
|
29
|
-
- [
|
|
21
|
+
- [Support](#support)
|
|
22
|
+
- [Contributing](#contributing)
|
|
23
|
+
- [Licensing](#licensing)
|
|
30
24
|
- [Changelog](#changelog)
|
|
31
25
|
|
|
26
|
+
## Overview
|
|
27
|
+
|
|
28
|
+
### When to Use It
|
|
29
|
+
|
|
30
|
+
- Building TypeScript applications with dotCMS
|
|
31
|
+
- Enabling type safety in your dotCMS integrations
|
|
32
|
+
- Getting better IDE autocomplete and error checking
|
|
33
|
+
- Working with dotCMS Client SDK or other SDK packages
|
|
34
|
+
|
|
35
|
+
### Key Benefits
|
|
36
|
+
|
|
37
|
+
- **Type Safety**: Catch errors at compile time instead of runtime
|
|
38
|
+
- **IDE Support**: Rich autocomplete and inline documentation
|
|
39
|
+
- **Better Developer Experience**: Clear interfaces for all dotCMS data structures
|
|
40
|
+
- **Framework Agnostic**: Works with any TypeScript project
|
|
41
|
+
|
|
42
|
+
## Installation
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
npm install @dotcms/types@latest --save-dev
|
|
46
|
+
```
|
|
47
|
+
|
|
32
48
|
## Commonly Used Types
|
|
33
49
|
|
|
34
50
|
```ts
|
|
@@ -151,7 +167,7 @@ import {
|
|
|
151
167
|
| [DotErrorContent](https://github.com/dotCMS/core/blob/main/core-web/libs/sdk/types/src/lib/content/public.ts#L7) | Content API specific error handling |
|
|
152
168
|
| [DotErrorNavigation](https://github.com/dotCMS/core/blob/main/core-web/libs/sdk/types/src/lib/nav/public.ts#L7) | Navigation API error handling |
|
|
153
169
|
|
|
154
|
-
##
|
|
170
|
+
## Usage Examples
|
|
155
171
|
|
|
156
172
|
### Error Type Checking
|
|
157
173
|
|
|
@@ -183,17 +199,33 @@ if (error instanceof DotErrorContent) {
|
|
|
183
199
|
|
|
184
200
|
> **Note**: For complete implementation examples and usage patterns, see the [@dotcms/client](../client/README.md) package documentation.
|
|
185
201
|
|
|
186
|
-
##
|
|
202
|
+
## Support
|
|
187
203
|
|
|
188
|
-
|
|
204
|
+
We offer multiple channels to get help with the dotCMS Types library:
|
|
189
205
|
|
|
190
|
-
|
|
206
|
+
- **GitHub Issues**: For bug reports and feature requests, please [open an issue](https://github.com/dotCMS/core/issues/new/choose) in the GitHub repository
|
|
207
|
+
- **Community Forum**: Join our [community discussions](https://community.dotcms.com/) to ask questions and share solutions
|
|
208
|
+
- **Stack Overflow**: Use the tag `dotcms-types` when posting questions
|
|
209
|
+
- **Enterprise Support**: Enterprise customers can access premium support through the [dotCMS Support Portal](https://helpdesk.dotcms.com/support/)
|
|
191
210
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
211
|
+
When reporting issues, please include:
|
|
212
|
+
|
|
213
|
+
- Package version you're using
|
|
214
|
+
- TypeScript version
|
|
215
|
+
- Minimal reproduction steps
|
|
216
|
+
- Expected vs. actual behavior
|
|
217
|
+
|
|
218
|
+
## Contributing
|
|
219
|
+
|
|
220
|
+
GitHub pull requests are the preferred method to contribute code to dotCMS. We welcome contributions to the dotCMS Types library! If you'd like to contribute, please follow these steps:
|
|
221
|
+
|
|
222
|
+
1. Fork the repository [dotCMS/core](https://github.com/dotCMS/core)
|
|
223
|
+
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
|
|
224
|
+
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
|
|
225
|
+
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
226
|
+
5. Open a Pull Request
|
|
227
|
+
|
|
228
|
+
Please ensure your code follows the existing style and includes appropriate tests.
|
|
197
229
|
|
|
198
230
|
## Changelog
|
|
199
231
|
|
|
@@ -214,3 +246,9 @@ This package is maintained as part of the [dotCMS core repository](https://githu
|
|
|
214
246
|
- Renamed `RequestOptions` to `DotRequestOptions` for better naming consistency
|
|
215
247
|
- Renamed `DotCMSGraphQLPageResponse` to `DotGraphQLApiResponse` for clarity
|
|
216
248
|
- Enhanced `DotCMSClientConfig` to support custom `httpClient` implementations
|
|
249
|
+
|
|
250
|
+
## Licensing
|
|
251
|
+
|
|
252
|
+
dotCMS comes in multiple editions and as such is dual-licensed. The dotCMS Community Edition is licensed under the GPL 3.0 and is freely available for download, customization, and deployment for use within organizations of all stripes. dotCMS Enterprise Editions (EE) adds several enterprise features and is available via a supported, indemnified commercial license from dotCMS. For the differences between the editions, see [the feature page](http://www.dotcms.com/cms-platform/features).
|
|
253
|
+
|
|
254
|
+
This package is part of dotCMS's dual-licensed platform (GPL 3.0 for Community, commercial license for Enterprise).
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@ export interface BlockEditorMark {
|
|
|
9
9
|
attrs: Record<string, string>;
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
|
-
* Represents a
|
|
12
|
+
* Represents a Node in the Block Editor
|
|
13
13
|
*
|
|
14
14
|
* @export
|
|
15
15
|
* @interface BlockEditorNode
|
|
@@ -26,13 +26,3 @@ export interface BlockEditorNode {
|
|
|
26
26
|
/** Optional text content */
|
|
27
27
|
text?: string;
|
|
28
28
|
}
|
|
29
|
-
/**
|
|
30
|
-
* Represents a Block in the Block Editor
|
|
31
|
-
*
|
|
32
|
-
* @export
|
|
33
|
-
* @interface BlockEditorContent
|
|
34
|
-
*/
|
|
35
|
-
export interface BlockEditorContent {
|
|
36
|
-
content?: BlockEditorNode[];
|
|
37
|
-
type: string;
|
|
38
|
-
}
|
|
@@ -100,4 +100,23 @@ export interface DotContentletAttributes {
|
|
|
100
100
|
'data-dot-container': string;
|
|
101
101
|
'data-dot-on-number-of-pages': string;
|
|
102
102
|
}
|
|
103
|
+
/**
|
|
104
|
+
* Helper type to create analytics attribute names with the correct prefix
|
|
105
|
+
* @internal
|
|
106
|
+
*/
|
|
107
|
+
type AnalyticsAttribute<T extends string> = `data-dot-analytics-${T}`;
|
|
108
|
+
/**
|
|
109
|
+
* Analytics attribute keys
|
|
110
|
+
* @internal
|
|
111
|
+
*/
|
|
112
|
+
type AnalyticsAttributeKey = 'identifier' | 'inode' | 'basetype' | 'contenttype' | 'title';
|
|
113
|
+
/**
|
|
114
|
+
* Interface representing the analytics data attributes of a DotCMS contentlet.
|
|
115
|
+
* Guarantees all keys have the 'data-dot-analytics-' prefix.
|
|
116
|
+
* Includes a class for fast DOM selection.
|
|
117
|
+
* @interface DotAnalyticsAttributes
|
|
118
|
+
*/
|
|
119
|
+
export type DotAnalyticsAttributes = {
|
|
120
|
+
[K in AnalyticsAttributeKey as AnalyticsAttribute<K>]: string;
|
|
121
|
+
};
|
|
103
122
|
export {};
|