DotCMS Type Definition Library
📦 @dotcms/types on npm
🛠️ View source on GitHub
Installation
npm install @dotcms/types@latest --save-dev
Overview
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.
Table of Contents
Commonly Used Types
import {
DotCMSPageAsset,
DotCMSPageResponse,
UVEEventType,
DotCMSInlineEditingPayload,
DotHttpClient,
DotHttpError,
DotErrorPage,
DotErrorContent,
DotErrorNavigation
} from '@dotcms/types';
Type Hierarchy (Jump to Definitions)
dotCMS Content & Pages
Page:
Content:
Site & Layout:
Navigation:
Universal Visual Editor (UVE)
Editor State:
Editor Events:
Inline Editing:
Block Editor
Client & HTTP
HTTP Client:
Client Configuration:
Error Handling
Base Error Types:
Domain-Specific Errors:
Type Usage
Error Type Checking
import {
DotHttpError,
DotErrorPage,
DotErrorContent,
DotErrorNavigation
} from '@dotcms/types';
if (error instanceof DotHttpError) {
console.error(`HTTP ${error.status}: ${error.statusText}`);
console.error('Response data:', error.data);
}
if (error instanceof DotErrorPage) {
console.error('GraphQL query:', error.graphql?.query);
}
if (error instanceof DotErrorContent) {
console.error(`${error.operation} failed for ${error.contentType}`);
}
Note: For complete implementation examples and usage patterns, see the @dotcms/client package documentation.
About
This package is maintained as part of the dotCMS core repository.
Keywords
- dotcms
- typescript
- types
- cms
- content-management-system
Changelog
[1.1.1]
Added
DotHttpClient interface for custom HTTP client implementations
BaseHttpClient abstract class with built-in error handling utilities
DotHttpError class for standardized HTTP error handling
DotErrorPage class for page-specific errors with GraphQL query context
DotErrorContent class for content API errors with operation details
DotErrorNavigation class for navigation-specific error handling
DotGraphQLApiResponse interface for GraphQL API responses
HttpErrorDetails interface for HTTP error standardization
- All error classes include
toJSON() methods for easy logging and serialization
Changed
- Renamed
RequestOptions to DotRequestOptions for better naming consistency
- Renamed
DotCMSGraphQLPageResponse to DotGraphQLApiResponse for clarity
- Enhanced
DotCMSClientConfig to support custom httpClient implementations