@myea/aem-mcp-handler
Version:
Advanced AEM MCP request handler with intelligent search, multi-locale support, and comprehensive content management capabilities
75 lines (74 loc) • 2.59 kB
TypeScript
export interface AEMError {
code: string;
message: string;
details?: any;
recoverable: boolean;
retryAfter?: number;
}
export declare class AEMOperationError extends Error {
readonly code: string;
readonly details: any;
readonly recoverable: boolean;
readonly retryAfter?: number;
constructor(error: AEMError);
}
export declare const AEM_ERROR_CODES: {
readonly CONNECTION_FAILED: "CONNECTION_FAILED";
readonly TIMEOUT: "TIMEOUT";
readonly AUTHENTICATION_FAILED: "AUTHENTICATION_FAILED";
readonly UNAUTHORIZED: "UNAUTHORIZED";
readonly INVALID_PATH: "INVALID_PATH";
readonly INVALID_COMPONENT_TYPE: "INVALID_COMPONENT_TYPE";
readonly INVALID_LOCALE: "INVALID_LOCALE";
readonly INVALID_PARAMETERS: "INVALID_PARAMETERS";
readonly RESOURCE_NOT_FOUND: "RESOURCE_NOT_FOUND";
readonly COMPONENT_NOT_FOUND: "COMPONENT_NOT_FOUND";
readonly PAGE_NOT_FOUND: "PAGE_NOT_FOUND";
readonly UPDATE_FAILED: "UPDATE_FAILED";
readonly VALIDATION_FAILED: "VALIDATION_FAILED";
readonly REPLICATION_FAILED: "REPLICATION_FAILED";
readonly QUERY_FAILED: "QUERY_FAILED";
readonly INSUFFICIENT_PERMISSIONS: "INSUFFICIENT_PERMISSIONS";
readonly SYSTEM_ERROR: "SYSTEM_ERROR";
readonly RATE_LIMITED: "RATE_LIMITED";
};
/**
* Create standardized error responses for AEM operations
*/
export declare function createAEMError(code: string, message: string, details?: any, recoverable?: boolean, retryAfter?: number): AEMOperationError;
/**
* Handle HTTP errors from AEM responses
*/
export declare function handleAEMHttpError(error: any, operation: string): AEMOperationError;
/**
* Safe execution wrapper with retry logic
*/
export declare function safeExecute<T>(operation: () => Promise<T>, operationName: string, maxRetries?: number): Promise<T>;
/**
* Validate component operation parameters
*/
export declare function validateComponentOperation(locale: string, pagePath: string, component: string, props: any): void;
/**
* Create standardized success response
*/
export declare function createSuccessResponse(data: any, operation: string): {
success: boolean;
operation: string;
timestamp: string;
data: any;
};
/**
* Create standardized error response
*/
export declare function createErrorResponse(error: AEMOperationError, operation: string): {
success: boolean;
operation: string;
timestamp: string;
error: {
code: string;
message: string;
details: any;
recoverable: boolean;
retryAfter: number | undefined;
};
};