@deinossrl/dgp-agent 1.5.22 → 1.5.24

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.
Files changed (3) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/index.mjs +22 -12
  3. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog - DGP Agent
2
2
 
3
+ ## [1.5.24] - 2026-01-13
4
+
5
+ ### Changed
6
+ - Improved progress calculation in `pg_restore`: "dropping" actions are now logged but do not increment the processed object count, preventing the progress from exceeding 100%. "From TOC entry" lines are ignored to avoid double counting.
7
+
8
+ ## [1.5.23] - 2026-01-13
9
+ ### Fixed
10
+ - **Critical**: Lógica invertida en flags `include_owner` e `include_privileges`. Ahora se respeta correctamente la exclusión con `--no-owner` y `--no-privileges` cuando el usuario desmarca las opciones.
11
+
12
+ ## [1.5.23] - 2026-01-13
13
+
14
+ ### Changed
15
+ - Improved progress calculation in `pg_restore`: "dropping" actions are now logged but do not increment the processed object count, preventing the progress from exceeding 100%. "From TOC entry" lines are ignored to avoid double counting.
16
+
3
17
  ## [1.5.22] - 2026-01-13
4
18
 
5
19
  ### Fixed
package/index.mjs CHANGED
@@ -1746,10 +1746,12 @@ async function executePgDump(command) {
1746
1746
  }
1747
1747
 
1748
1748
  // Incluir opciones adicionales
1749
- if (params.include_privileges) {
1749
+ // NOTA: pg_dump incluye owner y privilegios por defecto.
1750
+ // Usamos --no-owner y --no-privileges para excluirlos.
1751
+ if (!params.include_privileges) {
1750
1752
  pgDumpArgs.push('--no-privileges');
1751
1753
  }
1752
- if (params.include_owner) {
1754
+ if (!params.include_owner) {
1753
1755
  pgDumpArgs.push('--no-owner');
1754
1756
  }
1755
1757
 
@@ -2381,26 +2383,34 @@ async function executePgRestore(command) {
2381
2383
  const isLoopMessage = trimmed.includes('processing item') || trimmed.includes('processing data');
2382
2384
  const now = Date.now();
2383
2385
 
2384
- // LOGICA: Filtrar, calcular y MOSTRAR PROGRESO (Consola y Web)
2385
- // "from TOC entry" es clave para objetos metadata
2386
- // "dropping" es para actividad de limpieza (si --clean)
2387
- if (trimmed.includes('processing') || trimmed.includes('creating') || trimmed.includes('restoring') || trimmed.includes('creando') || trimmed.includes('procesando') || trimmed.includes('from TOC entry') || trimmed.includes('dropping')) {
2388
- processedObjects++;
2386
+ // LOGICA: Filtrar, calcular y MOSTRAR PROGRESO
2387
+ const isDropping = trimmed.includes('dropping');
2388
+ const isCreating = trimmed.includes('processing') || trimmed.includes('creating') || trimmed.includes('restoring') || trimmed.includes('creando') || trimmed.includes('procesando');
2389
+
2390
+ if (isDropping || isCreating) {
2391
+ // Solo incrementar si estamos CREANDO/RESTAURANDO (el TOC cuenta los objetos a crear)
2392
+ // Ignoramos 'dropping' para el contador (es fase de limpieza) y 'from TOC entry' (es redundante)
2393
+ if (isCreating) {
2394
+ processedObjects++;
2395
+ }
2389
2396
 
2390
- // Si es un item procesado, mostrar progreso en consola
2397
+ // Mostrar progreso en consola (throttled)
2391
2398
  if (now - lastLogTime > 500) { // Cada 500ms localmente
2392
2399
  let progressMsg = '';
2400
+ const safeProcessed = Math.min(processedObjects, totalObjects || processedObjects); // Cap visualmente
2401
+
2393
2402
  if (totalObjects > 0) {
2394
- const percentage = Math.min(Math.round((processedObjects / totalObjects) * 100), 100);
2395
- progressMsg = `Progreso: ${percentage}% (${processedObjects}/${totalObjects})`;
2403
+ const percentage = Math.min(Math.round((safeProcessed / totalObjects) * 100), 100);
2404
+ progressMsg = `Progreso: ${percentage}% (${safeProcessed}/${totalObjects})`;
2396
2405
  } else {
2397
- progressMsg = `Objetos procesados: ${processedObjects}`;
2406
+ progressMsg = `Objetos procesados: ${safeProcessed}`;
2398
2407
  }
2399
2408
 
2400
- // Limpiar detalle
2409
+ // Limpiar detalle para el log
2401
2410
  let detail = trimmed;
2402
2411
  if (detail.includes('processing item')) detail = detail.replace('processing item', '').trim();
2403
2412
  if (detail.includes('creating')) detail = detail.replace('creating', 'creando').trim();
2413
+ if (detail.includes('dropping')) detail = detail.replace('dropping', 'limpiando').trim();
2404
2414
 
2405
2415
  progressMsg += ` - ${detail.substring(0, 50)}`;
2406
2416
  console.log(`${colors.cyan}[INFO] ${progressMsg}${colors.reset}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deinossrl/dgp-agent",
3
- "version": "1.5.22",
3
+ "version": "1.5.24",
4
4
  "description": "Agente local para Despliegue-GPT - Reporta el estado del repositorio Git a la plataforma TenMinute IA",
5
5
  "main": "index.mjs",
6
6
  "bin": {