@dotcms/types
Advanced tools
+5
-1
@@ -159,5 +159,7 @@ 'use strict'; | ||
| class DotErrorPage extends Error { | ||
| constructor(message, httpError, graphql) { | ||
| constructor(message, status = 500, code = 'UNKNOWN', httpError, graphql) { | ||
| super(message); | ||
| this.name = 'DotCMSPageError'; | ||
| this.status = status; | ||
| this.code = code; | ||
| this.httpError = httpError; | ||
@@ -175,2 +177,4 @@ this.graphql = graphql; | ||
| message: this.message, | ||
| status: this.status, | ||
| code: this.code, | ||
| httpError: this.httpError?.toJSON(), | ||
@@ -177,0 +181,0 @@ graphql: this.graphql, |
+5
-1
@@ -157,5 +157,7 @@ const DotCMSEntityState = { | ||
| class DotErrorPage extends Error { | ||
| constructor(message, httpError, graphql) { | ||
| constructor(message, status = 500, code = 'UNKNOWN', httpError, graphql) { | ||
| super(message); | ||
| this.name = 'DotCMSPageError'; | ||
| this.status = status; | ||
| this.code = code; | ||
| this.httpError = httpError; | ||
@@ -173,2 +175,4 @@ this.graphql = graphql; | ||
| message: this.message, | ||
| status: this.status, | ||
| code: this.code, | ||
| httpError: this.httpError?.toJSON(), | ||
@@ -175,0 +179,0 @@ graphql: this.graphql, |
+1
-1
| { | ||
| "name": "@dotcms/types", | ||
| "version": "1.5.1-next.1965", | ||
| "version": "1.5.1-next.1972", | ||
| "keywords": [ | ||
@@ -5,0 +5,0 @@ "dotCMS", |
@@ -318,2 +318,9 @@ import { UVE_MODE } from '../editor/public'; | ||
| httpClient?: DotHttpClient; | ||
| /** | ||
| * Controls the verbosity of error logs from the SDK. | ||
| * - `'default'`: logs the error message only (default) | ||
| * - `'verbose'`: also logs the HTTP status, error code, and the GraphQL query and variables | ||
| * @example `logLevel: 'verbose'` | ||
| */ | ||
| logLevel?: 'default' | 'verbose'; | ||
| } |
@@ -1132,12 +1132,29 @@ import { DotHttpError } from '../client/public'; | ||
| /** | ||
| * dotCMS's GraphQL API response with a page and content query | ||
| * Raw GraphQL API response for a dotCMS page query. | ||
| * | ||
| * Shape varies by failure mode: | ||
| * - Success: { data: { page: DotCMSGraphQLPage, ... }, errors: undefined } | ||
| * - Page not found: { data: { page: null }, errors: [{ extensions: { code: 'NOT_FOUND' } }] } | ||
| * - Bad query: { data: null, errors: [{ message: '...' }] } | ||
| * - Partial failure: { data: { page: DotCMSGraphQLPage, ... }, errors: [...] } | ||
| * (page loaded but secondary content queries failed) | ||
| * | ||
| * Always check `errors` even when `data` is present — partial failures surface both. | ||
| */ | ||
| export interface DotGraphQLApiResponse { | ||
| data: { | ||
| page: DotCMSGraphQLPage; | ||
| page: DotCMSGraphQLPage | null; | ||
| content?: Record<string, unknown>; | ||
| }; | ||
| } | null; | ||
| errors?: DotCMSGraphQLError[]; | ||
| } | ||
| /** | ||
| * Error codes returned by the DotCMS GraphQL API. | ||
| * - NOT_FOUND: The requested page or resource does not exist (HTTP 404) | ||
| * - PERMISSION_DENIED: The user lacks permission or is not authenticated (always HTTP 403 — dotCMS does not distinguish 401 vs 403 at the GraphQL layer) | ||
| * - INVALID_LANGUAGE: The languageId provided is not a valid language (HTTP 400) | ||
| * - BAD_REQUEST: The GraphQL query itself is malformed or invalid (HTTP 400) | ||
| */ | ||
| export type DotCMSGraphQLErrorCode = 'NOT_FOUND' | 'PERMISSION_DENIED' | 'INVALID_LANGUAGE' | 'BAD_REQUEST'; | ||
| /** | ||
| * Represents a GraphQL error | ||
@@ -1148,8 +1165,17 @@ * @interface DotCMSGraphQLError | ||
| message: string; | ||
| locations: { | ||
| locations?: { | ||
| line: number; | ||
| column: number; | ||
| }[]; | ||
| extensions: { | ||
| classification: string; | ||
| path?: string[]; | ||
| extensions?: { | ||
| classification?: string; | ||
| /** Structured error code from DotCMS backend — use this for programmatic error handling */ | ||
| code?: DotCMSGraphQLErrorCode; | ||
| /** HTTP status hint from backend (e.g. 404, 400) */ | ||
| status?: number; | ||
| /** The type of resource that was not found, if applicable */ | ||
| resourceType?: string; | ||
| /** The identifier of the resource that was not found, if applicable */ | ||
| resourceId?: string; | ||
| }; | ||
@@ -1163,3 +1189,7 @@ } | ||
| content?: Record<string, unknown> | unknown; | ||
| /** | ||
| * @deprecated Use `errors` instead. Will be removed in August 2026. Kept for backward compatibility — represents the first GraphQL error when present. | ||
| */ | ||
| error?: DotCMSGraphQLError; | ||
| errors?: DotCMSGraphQLError[]; | ||
| graphql: { | ||
@@ -1184,2 +1214,4 @@ query: string; | ||
| export declare class DotErrorPage extends Error { | ||
| readonly status: number; | ||
| readonly code: DotCMSGraphQLErrorCode | 'UNKNOWN'; | ||
| readonly httpError?: DotHttpError; | ||
@@ -1190,3 +1222,3 @@ readonly graphql?: { | ||
| }; | ||
| constructor(message: string, httpError?: DotHttpError, graphql?: { | ||
| constructor(message: string, status?: number, code?: DotCMSGraphQLErrorCode | 'UNKNOWN', httpError?: DotHttpError, graphql?: { | ||
| query: string; | ||
@@ -1201,2 +1233,4 @@ variables: Record<string, unknown>; | ||
| message: string; | ||
| status: number; | ||
| code: "UNKNOWN" | DotCMSGraphQLErrorCode; | ||
| httpError: { | ||
@@ -1203,0 +1237,0 @@ name: string; |
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
139141
1.87%3589
1.38%10
11.11%