@hivemagnus/magnus 3.3.6 → 3.4.1

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.
@@ -12,9 +12,10 @@ export declare const SERVER_RESTORE_SINCE = "1.1.3";
12
12
  /** Bytes the database occupies (an upper bound for its dump), or null when it cannot be asked. */
13
13
  export declare function databaseBytes(io: Io, project: Project): Promise<number | null>;
14
14
  /**
15
- * Keep the newest `keep` dumps in backups/; older ones go, except the newest
16
- * dump of each label (the one a rollback of that step restores) and any file
17
- * in `protect`.
15
+ * Keep the newest `keep` dumps in backups/ and any file in `protect` (the dump
16
+ * the current upgrade's rollback restores); older ones go. Upgrade labels are
17
+ * unique per step (`pre-upgrade-A-to-B`), so a per-label exemption would keep
18
+ * every dump forever.
18
19
  */
19
20
  export declare function pruneBackups(dir: string, keep: number, protect?: readonly string[]): string[];
20
21
  /**
package/dist/database.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /** Pre-migration dumps and restores for both database kinds a project can use. */
2
2
  import { closeSync, chmodSync, existsSync, mkdirSync, openSync, readdirSync, readFileSync, rmSync, statSync, writeFileSync } from 'node:fs';
3
- import { basename, dirname, join } from 'node:path';
3
+ import { dirname, join } from 'node:path';
4
4
  import { compareVersions, restoreAsideSchema, restoreFinishSql, restoreRevertSql, restoreSwapSql } from '@hivemagnus/magnus-contracts';
5
5
  import { readEnvFile } from './env-file.js';
6
6
  import { mustRun } from './io.js';
@@ -44,9 +44,10 @@ export async function databaseBytes(io, project) {
44
44
  return Number.isFinite(bytes) && bytes > 0 ? bytes : null;
45
45
  }
46
46
  /**
47
- * Keep the newest `keep` dumps in backups/; older ones go, except the newest
48
- * dump of each label (the one a rollback of that step restores) and any file
49
- * in `protect`.
47
+ * Keep the newest `keep` dumps in backups/ and any file in `protect` (the dump
48
+ * the current upgrade's rollback restores); older ones go. Upgrade labels are
49
+ * unique per step (`pre-upgrade-A-to-B`), so a per-label exemption would keep
50
+ * every dump forever.
50
51
  */
51
52
  export function pruneBackups(dir, keep, protect = []) {
52
53
  if (!existsSync(dir) || keep < 1)
@@ -58,14 +59,11 @@ export function pruneBackups(dir, keep, protect = []) {
58
59
  meta = JSON.parse(readFileSync(`${file}.json`, 'utf8'));
59
60
  }
60
61
  catch { /* no metadata */ }
61
- return { file, label: meta.label ?? basename(file), at: Date.parse(meta.createdAt ?? '') || statSync(file).mtimeMs };
62
+ return { file, at: Date.parse(meta.createdAt ?? '') || statSync(file).mtimeMs };
62
63
  }).sort((a, b) => b.at - a.at);
63
- const seen = new Set();
64
64
  const removed = [];
65
65
  dumps.forEach((dump, index) => {
66
- const newest = !seen.has(dump.label);
67
- seen.add(dump.label);
68
- if (index < keep || newest || protect.includes(dump.file))
66
+ if (index < keep || protect.includes(dump.file))
69
67
  return;
70
68
  rmSync(dump.file, { force: true });
71
69
  rmSync(`${dump.file}.json`, { force: true });
package/dist/project.d.ts CHANGED
@@ -52,7 +52,7 @@ export interface ProjectState {
52
52
  current: string | null;
53
53
  previous: string | null;
54
54
  keepVersions: number;
55
- /** Dumps kept in backups/ (default 5); the newest of each label always stays. */
55
+ /** Dumps kept in backups/ (default 5), plus the dump the current upgrade's rollback restores. */
56
56
  keepBackups?: number;
57
57
  /** Node.js the units run (and the upgrade uses for npm and the server CLI); default: the units' ExecStart. */
58
58
  nodePath?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hivemagnus/magnus",
3
- "version": "3.3.6",
3
+ "version": "3.4.1",
4
4
  "description": "Install, upgrade and roll back a Magnus server and console with one command: `npx @hivemagnus/magnus init`, then `magnus upgrade`. Pins exact, tested component versions, backs up PostgreSQL before every migration and reverts automatically when the new version fails its health check.",
5
5
  "keywords": [
6
6
  "magnus",
@@ -47,7 +47,7 @@
47
47
  "clean": "node -e \"const fs=require('node:fs');fs.rmSync('dist',{recursive:true,force:true});fs.rmSync('tsconfig.tsbuildinfo',{force:true})\""
48
48
  },
49
49
  "dependencies": {
50
- "@hivemagnus/magnus-contracts": "3.3.6"
50
+ "@hivemagnus/magnus-contracts": "3.4.1"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@types/node": "^24.19.2",
@@ -56,15 +56,15 @@
56
56
  },
57
57
  "magnusRelease": {
58
58
  "schema": 1,
59
- "version": "3.3.6",
59
+ "version": "3.4.1",
60
60
  "engines": {
61
61
  "node": "^24.22.3 || ^26.13.1"
62
62
  },
63
63
  "components": {
64
- "@hivemagnus/magnus-server": "3.3.6",
65
- "@hivemagnus/magnus-ui": "3.3.6",
66
- "@hivemagnus/magnus-contracts": "3.3.6",
67
- "@hivemagnus/magnus-agent": "3.3.6"
64
+ "@hivemagnus/magnus-server": "3.4.1",
65
+ "@hivemagnus/magnus-ui": "3.4.1",
66
+ "@hivemagnus/magnus-contracts": "3.4.1",
67
+ "@hivemagnus/magnus-agent": "3.4.1"
68
68
  },
69
69
  "breaking": false,
70
70
  "minUpgradeFrom": "2.10.2",
@@ -77,8 +77,8 @@
77
77
  "selfUpgradeProtocol": 1,
78
78
  "minLauncher": 1
79
79
  },
80
- "summary": "Ships the node agent's patched XML dependencies: fast-xml-parser 5.12.1 and fast-xml-builder 1.3.2.",
81
- "notesUrl": "https://github.com/ChefTaco/magnus/releases/tag/v3.3.6",
80
+ "summary": "The code of 3.4.0 with its container images: the release workflow's published-digest check failed on the classic Docker image store, so 3.4.0's images were never tagged. No migrations beyond 3.4.0; from an earlier release follow the 3.4.0 upgrade notes.",
81
+ "notesUrl": "https://github.com/ChefTaco/magnus/releases/tag/v3.4.1",
82
82
  "allowScripts": {
83
83
  "@prisma/engines": true,
84
84
  "argon2": true,