adpa-enterprise-framework-automation
Version:
Modular, standards-compliant Node.js/TypeScript automation framework for enterprise requirements, project, and data management. Provides CLI and API for BABOK v3, PMBOK 7th Edition, and DMBOK 2.0 (in progress). Production-ready Express.js API with TypeSpe
162 lines • 4.62 kB
TypeScript
/**
* SharePoint Publisher Module
* Part of ADPA (Advanced Document Processing Assistant) v2.1.3
*
* Handles publishing generated documents to SharePoint Online sites and document libraries
* using Microsoft Graph API for secure, enterprise-grade document management.
*
* Features:
* - Microsoft Graph API integration
* - OAuth 2.0 and Service Principal authentication
* - Batch document upload with retry logic
* - SharePoint metadata management
* - Folder structure creation and management
* - Version control and conflict resolution
* - Enterprise security and compliance
*
* References:
* - Microsoft Graph API: https://docs.microsoft.com/en-us/graph/api/overview
* - SharePoint REST API: https://docs.microsoft.com/en-us/sharepoint/dev/sp-add-ins/working-with-folders-and-files-with-rest
*/
import { SharePointConfig, SharePointDocument, PublishResult, SharePointDriveItem, PublishingOptions, BatchUploadOptions } from './types.js';
/**
* Main SharePoint Publisher class
* Handles all interactions with SharePoint Online via Microsoft Graph API
*/
export declare class SharePointPublisher {
private config;
private oauth2Handler?;
private graphClient?;
private axiosClient;
private siteId?;
private driveId?;
constructor(config: SharePointConfig);
/**
* Initialize SharePoint connection and get site/drive information
*/
initialize(): Promise<void>;
/**
* Test connection to SharePoint and verify permissions
*/
testConnection(): Promise<{
success: boolean;
error?: string;
siteInfo?: any;
driveInfo?: any;
}>;
/**
* Start OAuth2 authentication flow
*/
startOAuth2Login(): Promise<{
success: boolean;
error?: string;
}>;
/**
* Check if user is authenticated
*/
isAuthenticated(): Promise<boolean>;
/**
* Publish a single document to SharePoint
*/
publishDocument(document: SharePointDocument, options?: PublishingOptions): Promise<PublishResult>;
/**
* Publish multiple documents from a directory
*/
publishDocuments(documentsPath: string, options?: PublishingOptions & BatchUploadOptions): Promise<PublishResult[]>;
/**
* Create a folder in SharePoint document library
*/
createFolder(folderPath: string): Promise<SharePointDriveItem>;
/**
* Get drive item by path
*/
getDriveItem(itemPath: string): Promise<SharePointDriveItem>;
/**
* List items in a folder
*/
listFolderItems(folderPath?: string): Promise<SharePointDriveItem[]>;
/**
* Delete a drive item
*/
deleteItem(itemId: string): Promise<void>;
/**
* Get access token for authentication
*/
private getAccessToken;
/**
* Get service principal access token
*/
private getServicePrincipalToken;
/**
* Resolve SharePoint site ID from site URL
*/
private resolveSiteId;
/**
* Resolve drive ID for the document library
*/
private resolveDriveId;
/**
* Upload file to SharePoint
*/
private uploadFile;
/**
* Simple upload for smaller files
*/
private simpleUpload;
/**
* Session upload for larger files
*/
private sessionUpload;
/**
* Add metadata to a SharePoint item
*/
private addMetadata;
/**
* Ensure folder exists, create if necessary
*/
private ensureFolderExists;
/**
* Build complete folder path
*/
private buildFolderPath;
/**
* Prepare file content for upload
*/
private prepareFileContent;
/**
* Get all markdown files from directory recursively
*/
private getMarkdownFiles;
/**
* Get folder path from file path relative to base directory
*/
private getFolderPathFromFile;
/**
* Extract title from markdown content
*/
private extractTitleFromContent;
/**
* Generate SharePoint metadata from document content
*/
private generateMetadata;
/**
* Infer document category from file name/path
*/
private inferDocumentCategory;
/**
* Add delay between operations
*/
private delay;
}
/**
* Factory function to create SharePointPublisher instance
*/
export declare function createSharePointPublisher(config: SharePointConfig): SharePointPublisher;
/**
* Validate SharePoint configuration
*/
export declare function validateSharePointConfig(config: SharePointConfig): {
valid: boolean;
errors: string[];
};
//# sourceMappingURL=SharePointPublisher.d.ts.map