/** * Heretto CMS uploader - handles uploading files back to Heretto CMS. */ import fs from "node:fs"; /** * Heretto uploader class implementing the uploader interface. */ declare class HerettoUploader { /** * Checks if this uploader can handle the given source integration. * @param {Object} sourceIntegration - Source integration metadata * @returns {boolean} True if this uploader handles Heretto integrations */ canHandle(sourceIntegration: any): boolean; /** * Uploads a file to Heretto CMS. * @param {Object} options - Upload options * @param {Object} options.config - Doc Detective config * @param {Object} options.integrationConfig - Heretto integration config * @param {string} options.localFilePath - Local file path to upload * @param {Object} options.sourceIntegration - Source integration metadata * @param {Function} options.log - Logging function * @returns {Promise} Upload result with status and description */ upload({ config, integrationConfig, localFilePath, sourceIntegration, log }: { config: any; integrationConfig: any; localFilePath: any; sourceIntegration: any; log: any; }): Promise<{ status: string; description: string; }>; /** * Resolves a file path to its UUID using the resource dependencies map. * @param {Object} options - Resolution options * @param {Object.} options.resourceDependencies - Map of resource paths to resource metadata * @param {string} options.filePath - Original file path to resolve * @param {string} options.filename - Filename extracted from the file path * @param {Function} options.log - Logging function * @returns {{uuid: string, parentFolderId: string}|null} File info with uuid and parentFolderId, or null if not found */ resolveFromDependencies({ resourceDependencies, filePath, filename, log }: { resourceDependencies: any; filePath: any; filename: any; log: any; }): any; /** * Finds the parent folder ID for a file path using resource dependencies. * Returns the target folder name for API lookup if not found in dependencies. * @param {Object} options - Resolution options * @param {Object.} options.resourceDependencies - Map of resource paths to resource metadata. * Keys are relative file paths, values are objects with uuid and parentFolderId. * Special keys starting with '_' (e.g., '_ditamapParentFolderId') store internal metadata. * @param {string} options.filePath - File path to find parent folder for (can be relative with ../ or ./ prefixes) * @param {Function} options.log - Logging function with signature (level, message) * @returns {{folderId: string|null, targetFolderName: string|null, ditamapParentFolderId: string|null}} Resolution result containing: * - folderId: The parent folder UUID if found in dependencies, null otherwise * - targetFolderName: The name of the target folder extracted from the file path * - ditamapParentFolderId: The ditamap's parent folder ID from dependencies (for API fallback lookup) */ findParentFolderFromDependencies({ resourceDependencies, filePath, log }: { resourceDependencies: any; filePath: any; log: any; }): { folderId: any; targetFolderName: any; ditamapParentFolderId: any; }; /** * Gets a child folder within a parent folder by name. * @param {Object} options - Search options * @returns {Promise} Child folder ID if found, null otherwise */ getChildFolderByName({ apiBaseUrl, apiToken, username, parentFolderId, folderName, log }: { apiBaseUrl: any; apiToken: any; username: any; parentFolderId: any; folderName: any; log: any; }): Promise; /** * Creates a new document in Heretto. * @param {Object} options - Creation options * @returns {Promise} Result with created: boolean, documentId: string (if successful or already exists) */ createDocument({ apiBaseUrl, apiToken, username, parentFolderId, filename, mimeType, log }: { apiBaseUrl: any; apiToken: any; username: any; parentFolderId: any; filename: any; mimeType: any; log: any; }): Promise; /** * Gets file information from a specific folder. * @param {Object} options - Options * @returns {Promise} File ID if found, null otherwise */ getFileInFolder({ apiBaseUrl, apiToken, username, folderId, filename, log }: { apiBaseUrl: any; apiToken: any; username: any; folderId: any; filename: any; log: any; }): Promise; /** * Escapes special characters for XML. * @param {string} str - String to escape * @returns {string} Escaped string */ escapeXml(str: string): string; /** * Searches for a folder in Heretto by name. * @param {Object} options - Search options * @returns {Promise} Folder ID if found, null otherwise */ searchFolderByName({ apiBaseUrl, apiToken, username, folderName, log }: { apiBaseUrl: any; apiToken: any; username: any; folderName: any; log: any; }): Promise; /** * Searches for a file in Heretto by filename. * @param {Object} options - Search options * @returns {Promise} Document ID if found, null otherwise */ searchFileByName({ apiBaseUrl, apiToken, username, filename, log }: { apiBaseUrl: any; apiToken: any; username: any; filename: any; log: any; }): Promise; /** * Uploads file content to Heretto. * @param {Object} options - Upload options * @returns {Promise} */ uploadFile({ apiBaseUrl, apiToken, username, documentId, content, contentType, log }: { apiBaseUrl: any; apiToken: any; username: any; documentId: any; content: any; contentType: any; log: any; }): Promise; /** * Gets document information from Heretto. * @param {Object} options - Options * @returns {Promise} Document info including id, name, mimeType, folderUuid, uri */ getDocumentInfo({ apiBaseUrl, apiToken, username, documentId, log }: { apiBaseUrl: any; apiToken: any; username: any; documentId: any; log: any; }): Promise; /** * Gets document content from Heretto. * @param {Object} options - Options * @returns {Promise} Document content as buffer */ getDocumentContent({ apiBaseUrl, apiToken, username, documentId, log }: { apiBaseUrl: any; apiToken: any; username: any; documentId: any; log: any; }): Promise; /** * Determines the content type based on file extension. * @param {string} filePath - File path * @returns {string} MIME content type */ getContentType(filePath: string): string; } export { HerettoUploader }; import { AxiosInstance } from "axios"; declare const POLLING_INTERVAL_MS = 5000; declare const POLLING_TIMEOUT_MS = 300000; declare const DEFAULT_SCENARIO_NAME = "Doc Detective"; export { POLLING_INTERVAL_MS, POLLING_TIMEOUT_MS, DEFAULT_SCENARIO_NAME }; export declare function createAuthHeader(username: string, apiToken: string): string; export declare function getBaseUrl(organizationId: string): string; export declare function validateDitamapInAssets(assets: string[]): boolean; export declare function createApiClient(herettoConfig: any): AxiosInstance; export declare function createRestApiClient(herettoConfig: any): AxiosInstance; export declare function findScenario(client: AxiosInstance, log: Function, config: any, scenarioName: string): Promise<{ scenarioId: string; fileId: string; } | null>; export declare function triggerPublishingJob(client: AxiosInstance, fileId: string, scenarioId: string): Promise; export declare function getJobStatus(client: AxiosInstance, fileId: string, jobId: string): Promise; export declare function getJobAssetDetails(client: AxiosInstance, fileId: string, jobId: string, log?: Function, config?: any): Promise; export declare function pollJobStatus(client: AxiosInstance, fileId: string, jobId: string, log: Function, config: any): Promise; interface DownloadDeps { fsModule?: typeof fs; ZipClass?: any; } export declare function downloadAndExtractOutput(client: AxiosInstance, fileId: string, jobId: string, herettoName: string, log: Function, config: any, deps?: DownloadDeps): Promise; export declare function getResourceDependencies(restClient: AxiosInstance, ditamapId: string, log: Function, config: any): Promise>; interface LoadDeps { createApiClientFn?: (config: any) => AxiosInstance; createRestApiClientFn?: (config: any) => AxiosInstance; downloadFn?: typeof downloadAndExtractOutput; getResourceDependenciesFn?: typeof getResourceDependencies; } export declare function loadHerettoContent(herettoConfig: any, log: Function, config: any, deps?: LoadDeps): Promise; //# sourceMappingURL=heretto.d.ts.map