@deinossrl/dgp-agent 1.5.13 → 1.5.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/index.mjs +76 -25
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog - DGP Agent
|
|
2
2
|
|
|
3
|
+
## [1.5.16] - 2026-01-13
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
- **Formato Exacto de Progreso**: Implementado el formato exacto solicitado para la consola local: `[INFO] Progreso: 45% (200/450)`.
|
|
7
|
+
- Se mantiene la visibilidad de estados iniciales (lectura de schemas) pero con menor intrusión visual.
|
|
8
|
+
- Prioridad visual a los porcentajes y conteos durante la transferencia de datos.
|
|
9
|
+
|
|
10
|
+
## [1.5.15] - 2026-01-13
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
- **Logs más limpios**: Eliminado prefijo `pg_dump:` y traducidos mensajes comunes al español (`reading` -> `Leyendo`, `saving` -> `Guardando`, etc.) para una experiencia de consola más profesional.
|
|
14
|
+
- Feedback visual consistente en color cyan `[INFO]` para eventos importantes.
|
|
15
|
+
|
|
3
16
|
## [1.5.13] - 2026-01-13
|
|
4
17
|
|
|
5
18
|
### Changed
|
package/index.mjs
CHANGED
|
@@ -1837,15 +1837,44 @@ async function executePgDump(command) {
|
|
|
1837
1837
|
const isLoopMessage = trimmed.includes('dumping data') || trimmed.includes('processing data');
|
|
1838
1838
|
const now = Date.now();
|
|
1839
1839
|
|
|
1840
|
-
|
|
1841
|
-
console.log(`${colors.gray}[pg_dump] ${trimmed}${colors.reset}`);
|
|
1842
|
-
if (isLoopMessage) lastLogTime = now;
|
|
1843
|
-
}
|
|
1844
|
-
|
|
1845
|
-
// LOGICA WEB: Filtrar y contar para la UI
|
|
1840
|
+
// LOGICA: Filtrar, calcular y MOSTRAR PROGRESO (Consola y Web)
|
|
1846
1841
|
if (trimmed.includes('processing') || trimmed.includes('dumping data for table') || trimmed.includes('creating') || trimmed.includes('setting owner')) {
|
|
1847
1842
|
objectCount++;
|
|
1848
1843
|
}
|
|
1844
|
+
|
|
1845
|
+
// Mostrar TODO en consola inmediatamente para no esperar a "processing"
|
|
1846
|
+
// Pero si es "loop" (dumping data), calculamos y mostramos progreso
|
|
1847
|
+
if (isLoopMessage) {
|
|
1848
|
+
if (now - lastLogTime > 500) { // Consola: cada 500ms
|
|
1849
|
+
let progressMsg = '';
|
|
1850
|
+
// Si tenemos estimación, mostrar porcentaje
|
|
1851
|
+
if (totalEstimated > 0 && objectCount > 0) {
|
|
1852
|
+
const percentage = Math.min(Math.round((objectCount / totalEstimated) * 100), 100);
|
|
1853
|
+
progressMsg = `Progreso: ${percentage}% (${objectCount}/${totalEstimated})`;
|
|
1854
|
+
} else {
|
|
1855
|
+
progressMsg = `Objetos procesados: ${objectCount}`;
|
|
1856
|
+
}
|
|
1857
|
+
|
|
1858
|
+
// Limpiar mensaje detalle
|
|
1859
|
+
let detail = trimmed;
|
|
1860
|
+
if (detail.startsWith('pg_dump: ')) detail = detail.substring(9);
|
|
1861
|
+
if (detail.includes('dumping data for table')) detail = detail.replace('dumping data for table', 'exportando datos');
|
|
1862
|
+
|
|
1863
|
+
progressMsg += ` - ${detail.substring(0, 50)}`;
|
|
1864
|
+
console.log(`${colors.cyan}[INFO] ${progressMsg}${colors.reset}`);
|
|
1865
|
+
|
|
1866
|
+
lastLogTime = now;
|
|
1867
|
+
}
|
|
1868
|
+
} else if (now - lastLogTime > 2000) {
|
|
1869
|
+
// Mensajes no-data (reading triggers, etc.) - mostrar ocasionalmente
|
|
1870
|
+
let cleanMsg = trimmed;
|
|
1871
|
+
if (cleanMsg.startsWith('pg_dump: ')) cleanMsg = cleanMsg.substring(9);
|
|
1872
|
+
if (cleanMsg.includes('reading')) cleanMsg = cleanMsg.replace('reading', 'Leyendo');
|
|
1873
|
+
if (cleanMsg.includes('saving')) cleanMsg = cleanMsg.replace('saving', 'Guardando');
|
|
1874
|
+
|
|
1875
|
+
console.log(`${colors.gray}[INFO] ${cleanMsg}${colors.reset}`);
|
|
1876
|
+
lastLogTime = now;
|
|
1877
|
+
}
|
|
1849
1878
|
}
|
|
1850
1879
|
|
|
1851
1880
|
// Enviar log a la WEB cada 2 segundos para no saturar
|
|
@@ -2347,19 +2376,13 @@ async function executePgRestore(command) {
|
|
|
2347
2376
|
const isLoopMessage = trimmed.includes('processing item') || trimmed.includes('processing data');
|
|
2348
2377
|
const now = Date.now();
|
|
2349
2378
|
|
|
2350
|
-
|
|
2351
|
-
console.log(`${colors.gray}[pg_restore] ${trimmed}${colors.reset}`);
|
|
2352
|
-
if (isLoopMessage) lastLogTime = now;
|
|
2353
|
-
}
|
|
2354
|
-
|
|
2355
|
-
// LOGICA WEB
|
|
2379
|
+
// LOGICA: Filtrar, calcular y MOSTRAR PROGRESO (Consola y Web)
|
|
2356
2380
|
if (trimmed.includes('processing') || trimmed.includes('creating') || trimmed.includes('restoring')) {
|
|
2357
2381
|
processedObjects++;
|
|
2358
2382
|
|
|
2359
|
-
//
|
|
2360
|
-
if (now -
|
|
2383
|
+
// Si es un item procesado, mostrar progreso en consola
|
|
2384
|
+
if (now - lastLogTime > 500) { // Cada 500ms localmente
|
|
2361
2385
|
let progressMsg = '';
|
|
2362
|
-
|
|
2363
2386
|
if (totalObjects > 0) {
|
|
2364
2387
|
const percentage = Math.min(Math.round((processedObjects / totalObjects) * 100), 100);
|
|
2365
2388
|
progressMsg = `Progreso: ${percentage}% (${processedObjects}/${totalObjects})`;
|
|
@@ -2367,19 +2390,47 @@ async function executePgRestore(command) {
|
|
|
2367
2390
|
progressMsg = `Objetos procesados: ${processedObjects}`;
|
|
2368
2391
|
}
|
|
2369
2392
|
|
|
2370
|
-
//
|
|
2371
|
-
|
|
2372
|
-
if (
|
|
2373
|
-
|
|
2374
|
-
}
|
|
2393
|
+
// Limpiar detalle
|
|
2394
|
+
let detail = trimmed;
|
|
2395
|
+
if (detail.includes('processing item')) detail = detail.replace('processing item', '').trim();
|
|
2396
|
+
if (detail.includes('creating')) detail = detail.replace('creating', 'creando').trim();
|
|
2375
2397
|
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2398
|
+
progressMsg += ` - ${detail.substring(0, 50)}`;
|
|
2399
|
+
console.log(`${colors.cyan}[INFO] ${progressMsg}${colors.reset}`);
|
|
2400
|
+
|
|
2401
|
+
lastLogTime = now;
|
|
2379
2402
|
}
|
|
2403
|
+
} else if (!isLoopMessage && now - lastLogTime > 2000) {
|
|
2404
|
+
// Mensajes de estado (conectando, etc)
|
|
2405
|
+
let cleanMsg = trimmed;
|
|
2406
|
+
if (cleanMsg.includes('entering main parallel loop')) cleanMsg = 'Iniciando loop paralelo';
|
|
2407
|
+
if (cleanMsg.includes('finished main parallel loop')) cleanMsg = 'Finalizado loop paralelo';
|
|
2408
|
+
console.log(`${colors.gray}[INFO] ${cleanMsg}${colors.reset}`);
|
|
2409
|
+
lastLogTime = now;
|
|
2380
2410
|
}
|
|
2381
|
-
|
|
2382
|
-
|
|
2411
|
+
|
|
2412
|
+
// Enviar log WEB cada 2 segundos para no saturar
|
|
2413
|
+
if (now - lastLogTimeWeb > 2000) {
|
|
2414
|
+
let progressMsg = '';
|
|
2415
|
+
|
|
2416
|
+
if (totalObjects > 0) {
|
|
2417
|
+
const percentage = Math.min(Math.round((processedObjects / totalObjects) * 100), 100);
|
|
2418
|
+
progressMsg = `Progreso: ${percentage}% (${processedObjects}/${totalObjects})`;
|
|
2419
|
+
} else {
|
|
2420
|
+
progressMsg = `Objetos procesados: ${processedObjects}`;
|
|
2421
|
+
}
|
|
2422
|
+
|
|
2423
|
+
// Agregar detalle de lo que se está procesando
|
|
2424
|
+
const relevantLine = trimmed.substring(0, 100);
|
|
2425
|
+
if (relevantLine) {
|
|
2426
|
+
progressMsg += ` - ${relevantLine}`;
|
|
2427
|
+
}
|
|
2428
|
+
|
|
2429
|
+
// logInfo(progressMsg); // Ya mostramos raw stderr arriba
|
|
2430
|
+
addCommandLog('info', progressMsg).catch(() => { });
|
|
2431
|
+
lastLogTimeWeb = now;
|
|
2432
|
+
}
|
|
2433
|
+
});
|
|
2383
2434
|
|
|
2384
2435
|
// Mostrar progreso por tiempo cada 10 segundos como respaldo
|
|
2385
2436
|
progressInterval = setInterval(() => {
|