UNPKG

dop-stick

Version:

Source control tooling for versionable-upgradeable smart contracts

58 lines 2.34 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ParallelBatchLogAdapter = void 0; const timelineLogAdapter_1 = require("./timelineLogAdapter"); const terminal_1 = require("../core/terminal"); class ParallelBatchLogAdapter { constructor() { this.timeline = new timelineLogAdapter_1.TimelineLogAdapter(); } startBatchCreation() { this.timeline.startSection('BATCH CREATION'); this.timeline.logColoredStep('Creating batches in parallel...', 0, terminal_1.Terminal.colors.magenta); } logBatchResults(batches) { let totalFunctions = 0; const totalActions = { add: 0, replace: 0, remove: 0 }; // Log each batch result batches.forEach(batch => { totalFunctions += batch.totalFunctions; Object.entries(batch.actions).forEach(([action, count]) => { totalActions[action] += count; }); const actionSummary = this.formatActionSummary(batch.actions); this.timeline.logArrowStep(`${batch.moduleName}: ${batch.totalFunctions} functions ${actionSummary}`, 1); }); // Log summary this.timeline.logStep('Summary'); this.timeline.logStep(`Total functions: ${totalFunctions}`, 1); this.timeline.logStep(`Actions: ${this.formatTotalActions(totalActions)}`, 1); this.timeline.logSuccessWithTime('All batches created successfully'); } formatActionSummary(actions) { const parts = []; if (actions.add > 0) parts.push(`${actions.add} add`); if (actions.replace > 0) parts.push(`${actions.replace} replace`); if (actions.remove > 0) parts.push(`${actions.remove} remove`); return parts.length > 0 ? `[${parts.join(', ')}]` : ''; } formatTotalActions(actions) { const parts = []; if (actions.add > 0) parts.push(`Add (${actions.add})`); if (actions.replace > 0) parts.push(`Replace (${actions.replace})`); if (actions.remove > 0) parts.push(`Remove (${actions.remove})`); return parts.join(', '); } } exports.ParallelBatchLogAdapter = ParallelBatchLogAdapter; //# sourceMappingURL=parallelBatchLogAdapter.js.map