UNPKG

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

41 lines 1.91 kB
/** * Document Generator Module * Exports functionality for generating project documentation */ import { DocumentGenerator, documentGeneratorVersion } from './DocumentGenerator.js'; import { DOCUMENT_CONFIG } from '../fileManager.js'; import { GENERATION_TASKS, getAvailableCategories, getTasksByCategory, getTaskByKey } from './generationTasks.js'; import { withRetry } from '../../utils/retry.js'; // Enhanced batch generation with smart retry export async function generateDocumentsWithRetry(context, options = {}) { const maxRetries = options.maxRetries || 2; const retryBackoff = options.retryBackoff || 1000; const retryMaxDelay = options.retryMaxDelay || 25000; let lastResult = null; // Use a custom DocumentGenerator that wraps generateSingleDocument with withRetry const generator = new DocumentGenerator(context, { ...options, cleanup: true // Only cleanup on first attempt }); // Patch generateSingleDocument to use withRetry const origGenerateSingle = generator["generateSingleDocument"].bind(generator); generator["generateSingleDocument"] = async function (task) { return await withRetry(() => origGenerateSingle(task), maxRetries, retryBackoff, retryMaxDelay); }; // Now just call generateAll once (it will use the patched method) lastResult = await generator.generateAll(); return lastResult; } // Backward compatibility function export async function generateAllDocuments(context) { const generator = new DocumentGenerator(context, { maxConcurrent: 1, delayBetweenCalls: 500, continueOnError: true, generateIndex: true, cleanup: true }); await generator.generateAll(); } export { DocumentGenerator, documentGeneratorVersion, GENERATION_TASKS, DOCUMENT_CONFIG, getAvailableCategories, getTasksByCategory, getTaskByKey }; //# sourceMappingURL=index.js.map