UNPKG

@myea/aem-mcp-handler

Version:

Advanced AEM MCP request handler with intelligent search, multi-locale support, and comprehensive content management capabilities

277 lines (276 loc) 8.05 kB
export interface NodeChild { name: string; path: string; primaryType: string; title: string; } export interface PageProperties { title?: string; description?: string; template?: string; lastModified?: string; lastModifiedBy?: string; created?: string; createdBy?: string; primaryType?: string; resourceType?: string; tags: string[]; properties: any; } export interface SearchParams { type?: string; fulltext?: string; path?: string; property?: string; "property.value"?: string; limit?: number; } export interface ValidateComponentRequest { locale: string; page_path: string; component: string; props: Record<string, any>; } export interface UpdateComponentRequest { componentPath: string; properties: Record<string, any>; } export interface UndoRequest { job_id: string; } export interface BulkUpdateRequest { pagePatterns: string[]; componentTypes: string[]; propertyUpdates: Record<string, any>; locales?: string[]; } export interface ComponentInfo { path: string; resourceType: string; primaryType: string; properties: Record<string, any>; pagePath: string; } export interface BulkUpdateResult { success: boolean; componentsUpdated: number; failedUpdates: number; errors: Array<{ componentPath: string; error: string; }>; summary: { pagePatterns: string[]; componentTypes: string[]; propertiesUpdated: Record<string, any>; }; } export interface TextContent { componentType: string; path: string; content: { title?: string; text?: string; description?: string; altText?: string; caption?: string; heading?: string; }; properties: Record<string, any>; } export interface TextContentSummary { path: string; type: string; content: { text?: string; title?: string; description?: string; richText?: boolean; heading?: string; }; location: string; } export interface ImageContent { componentType: string; path: string; content: { fileReference?: string; alt?: string; title?: string; caption?: string; link?: string; src?: string; }; xfPath?: string; properties: Record<string, any>; } export interface ExperienceFragment { path: string; fragmentVariationPath: string; title?: string; type: 'experience-fragment'; content?: any; } export interface ContentFragment { path: string; fragmentPath: string; elementNames: string[]; type: 'content-fragment'; content?: any; } export interface PageContent { mainContent: { components: any[]; images: ImageContent[]; text: TextContent[]; }; experienceFragments: ExperienceFragment[]; contentFragments: ContentFragment[]; } export interface CreatePageRequest { parentPath: string; title: string; template: string; name?: string; properties?: Record<string, any>; } export interface DeletePageRequest { pagePath: string; force?: boolean; } export interface CreateComponentRequest { pagePath: string; componentType: string; resourceType: string; properties?: Record<string, any>; name?: string; } export interface DeleteComponentRequest { componentPath: string; force?: boolean; } export interface UnpublishContentRequest { contentPaths: string[]; unpublishTree?: boolean; } export interface ActivatePageRequest { pagePath: string; activateTree?: boolean; } export interface DeactivatePageRequest { pagePath: string; deactivateTree?: boolean; } export interface UploadAssetRequest { parentPath: string; fileName: string; fileContent: Buffer | string; mimeType?: string; metadata?: Record<string, any>; } export interface UpdateAssetRequest { assetPath: string; metadata?: Record<string, any>; fileContent?: Buffer | string; mimeType?: string; } export interface DeleteAssetRequest { assetPath: string; force?: boolean; } export interface TemplateInfo { path: string; title: string; description?: string; thumbnail?: string; allowedPaths: string[]; initialContentPath?: string; ranking?: number; status: string; } export interface TemplateStructure { path: string; title: string; components: Array<{ name: string; type: string; path: string; properties: Record<string, any>; }>; policies: Array<{ path: string; title: string; allowedComponents: string[]; }>; } export declare class AEMConnector { private config; private auth; private aemConfig; constructor(); private loadConfig; /** * Create authenticated axios instance for AEM requests */ private createAxiosInstance; /** * Test AEM connectivity using standard AEM login endpoint */ testConnection(): Promise<boolean>; validateComponent(request: ValidateComponentRequest): Promise<any>; private validateComponentProps; updateComponent(request: UpdateComponentRequest): Promise<any>; undoChanges(request: UndoRequest): Promise<any>; private extractComponents; scanPageComponents(pagePath: string): Promise<any>; fetchSites(): Promise<any>; fetchLanguageMasters(site: string): Promise<any>; fetchAvailableLocales(site: string, languageMasterPath: string): Promise<any>; replicateAndPublish(selectedLocales: string[], componentData: any, localizedOverrides: any): Promise<any>; private simulateReplication; executeJCRQuery(query: string, limit?: number): Promise<any>; private validateQuerySecurity; getNodeContent(path: string, depth?: number): Promise<any>; searchContent(params: SearchParams): Promise<any>; getAssetMetadata(assetPath: string): Promise<any>; listChildren(path: string, depth?: number): Promise<NodeChild[]>; getPageProperties(pagePath: string): Promise<PageProperties>; private extractSites; private extractLanguageMasters; private extractLocales; /** * Get list of pages under a site root with optional depth * Enhanced version of listChildren that filters to pages only */ listPages(siteRoot: string, depth?: number, limit?: number): Promise<any>; bulkUpdateComponents(request: BulkUpdateRequest): Promise<BulkUpdateResult>; /** * @deprecated Use getAllTextContent instead for better performance and structure */ getPageTextContent(pagePath: string): Promise<any>; private extractTextContent; getAllTextContent(pagePath: string): Promise<any>; private extractImages; getPageImages(pagePath: string): Promise<any>; private fetchFragmentContent; private extractPageContent; getPageContent(pagePath: string): Promise<any>; updateComponentProperty(componentPath: string, propertyName: string, propertyValue: string): Promise<any>; private verifyComponentUpdate; updateImagePath(componentPath: string, newImagePath: string): Promise<any>; createPage(request: CreatePageRequest): Promise<any>; deletePage(request: DeletePageRequest): Promise<any>; createComponent(request: CreateComponentRequest): Promise<any>; deleteComponent(request: DeleteComponentRequest): Promise<any>; unpublishContent(request: UnpublishContentRequest): Promise<any>; activatePage(request: ActivatePageRequest): Promise<any>; deactivatePage(request: DeactivatePageRequest): Promise<any>; uploadAsset(request: UploadAssetRequest): Promise<any>; updateAsset(request: UpdateAssetRequest): Promise<any>; deleteAsset(request: DeleteAssetRequest): Promise<any>; getTemplates(sitePath?: string): Promise<any>; getTemplateStructure(templatePath: string): Promise<any>; private extractTemplates; private extractTemplateComponents; private extractTemplatePolicies; }