masterrecord 1.30.1 → 1.31.0

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/CHANGES.md CHANGED
@@ -1,5 +1,48 @@
1
1
  # MasterRecord Changelog
2
2
 
3
+ ## v1.31.0 — security maintenance: Node 22.12+, patched SQLite, clean audit
4
+
5
+ Node 20 reached end-of-life on 2026-04-30 and no longer receives security releases,
6
+ so this release stops claiming it. No API changes.
7
+
8
+ - **`engines.node` is now `>=22.12.0`.** The `>=20` claim was not backed by anything:
9
+ CI has only run Node 22 and 24, and `better-sqlite3@13` (which the old range already
10
+ resolved to) declares `node >=22`. The README and the docs site have said 22.12+ since
11
+ 1.2x; `package.json` now agrees with them. CI runs Node 22, 24 and 26. Use a current
12
+ patch release of your line — the 2026-10-20 Node.js security releases are 22.23.4,
13
+ 24.22.1 and 26.12.1.
14
+ - **`better-sqlite3` floor raised to `^13.0.3`** (was `>=12.6.2 <14`). 13.0.2 bundles
15
+ SQLite 3.53.4 and fixes table-parameter validation; 12.x bundled an older SQLite.
16
+ 13.x ships prebuilt N-API binaries, so SQLite loads even when npm blocks dependency
17
+ install scripts (see the README's install note).
18
+ - **`npm audit`: 0 vulnerabilities.** The lockfile now resolves `brace-expansion@5.0.12`
19
+ (GHSA-q2hr-2g5m-vwhr, GHSA-qhr7-859c-m2p7, GHSA-6j4f-fj2g-mc7p — DoS via crafted brace
20
+ patterns), reached through `glob` → `minimatch`. Consumers get the fixed version from
21
+ the existing `^` ranges on a fresh install; `npm update` picks it up in an existing app.
22
+ `mysql2` 3.24.6 and `pg` 8.23.1 are in the lockfile; their ranges are unchanged.
23
+ - **CI actions moved off the Node 20 runtime:** `actions/checkout@v6`,
24
+ `actions/setup-node@v5`.
25
+ - `update-database` no longer prints `💾 Updating snapshot...`. Since 1.30.0 it does not
26
+ write the snapshot (EF semantics); the message was left behind and said otherwise.
27
+
28
+ Verified: full suite (440 pass, 22 live-DB tests skipped) on Node 22.23.4, 24.22.1 and
29
+ 26.12.1.
30
+
31
+ ## v1.30.2 — pool reuse is a debug message
32
+
33
+ Every context a server constructs reuses the process's connection pool, and each
34
+ reuse printed `[PostgreSQL] Reusing pool for <db> (refs: N)` (or `[MySQL] …`) with
35
+ `console.log`, whatever the log level. A long-running server writes thousands of
36
+ these a minute. In CodeBook's production log they buried the one line that said
37
+ why a deploy was failing.
38
+
39
+ Reuse now goes through the logger at `debug`, so it is hidden at the default
40
+ `info` level and visible with `configureLogging({ level: 'debug' })`. Creating a
41
+ pool, which happens once per process, is logged as before. Nothing else changed:
42
+ the refcount is unchanged and still only decides when an idle pool may close.
43
+
44
+ New test: `test/pool-reuse-log-level.test.js`.
45
+
3
46
  ## v1.30.1 — `baseline` is scoped to one context, as everything in EF is
4
47
 
5
48
  **Data-corrupting bug.** `baseline <ctx> --all` globbed `**/*_migration.js` from the working
package/Migrations/cli.js CHANGED
@@ -586,7 +586,6 @@ program.hook('preAction', () => {
586
586
  await __cleanupAndExit(contextInstance, 1);
587
587
  }
588
588
 
589
- console.log(`\n💾 Updating snapshot...`);
590
589
  // EF: applying migrations does NOT touch the snapshot — only the history table.
591
590
  console.log(`\n✅ Database updated successfully!`);
592
591
 
package/context.js CHANGED
@@ -25,6 +25,7 @@ import deleteManager from './deleteManager.js';
25
25
  import EntityTrackerModel from './Entity/entityTrackerModel.js';
26
26
  import { ConcurrencyError } from './errors.js';
27
27
  import { withRetry } from './resilience.js';
28
+ import { log } from './logging.js';
28
29
  import { globSync } from 'glob';
29
30
  import fs from 'node:fs';
30
31
  import path from 'node:path';
@@ -532,13 +533,13 @@ class context {
532
533
  const result = await cached.promise;
533
534
  this._SQLEngine = result.engine;
534
535
  this.isMySQL = true;
535
- console.log(`[MySQL] Reusing pool for ${env.database} (refs: ${cached.refCount})`);
536
+ log('debug', `[MySQL] Reusing pool for ${env.database} (refs: ${cached.refCount})`);
536
537
  return result.client;
537
538
  }
538
539
  // Already resolved
539
540
  this._SQLEngine = cached.engine;
540
541
  this.isMySQL = true;
541
- console.log(`[MySQL] Reusing pool for ${env.database} (refs: ${cached.refCount})`);
542
+ log('debug', `[MySQL] Reusing pool for ${env.database} (refs: ${cached.refCount})`);
542
543
  return cached.client;
543
544
  }
544
545
 
@@ -644,13 +645,13 @@ class context {
644
645
  const result = await cached.promise;
645
646
  this._SQLEngine = result.engine;
646
647
  this._SQLEngine.__name = sqlName;
647
- console.log(`[PostgreSQL] Reusing pool for ${env.database} (refs: ${cached.refCount})`);
648
+ log('debug', `[PostgreSQL] Reusing pool for ${env.database} (refs: ${cached.refCount})`);
648
649
  return result.pool;
649
650
  }
650
651
  // Already resolved
651
652
  this._SQLEngine = cached.engine;
652
653
  this._SQLEngine.__name = sqlName;
653
- console.log(`[PostgreSQL] Reusing pool for ${env.database} (refs: ${cached.refCount})`);
654
+ log('debug', `[PostgreSQL] Reusing pool for ${env.database} (refs: ${cached.refCount})`);
654
655
  return cached.pool;
655
656
  }
656
657
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "masterrecord",
3
- "version": "1.30.1",
3
+ "version": "1.31.0",
4
4
  "description": "An Object-relational mapping for the Master framework. Master Record connects classes to relational database tables to establish a database with almost zero-configuration ",
5
5
  "type": "module",
6
6
  "main": "./MasterRecord.js",
@@ -60,7 +60,7 @@
60
60
  "THIRD-PARTY-NOTICES.md"
61
61
  ],
62
62
  "engines": {
63
- "node": ">=20.0.0"
63
+ "node": ">=22.12.0"
64
64
  },
65
65
  "scripts": {
66
66
  "test": "node --test test/*.test.js test/integration/*.test.js Migrations/pathUtils.test.js",
@@ -85,7 +85,7 @@
85
85
  "masterrecord"
86
86
  ],
87
87
  "dependencies": {
88
- "better-sqlite3": ">=12.6.2 <14",
88
+ "better-sqlite3": "^13.0.3",
89
89
  "commander": "^14.0.3",
90
90
  "deep-object-diff": "^1.1.9",
91
91
  "glob": "^13.0.6",
@@ -94,7 +94,7 @@
94
94
  },
95
95
  "devDependencies": {
96
96
  "@eslint/js": "^10.0.1",
97
- "eslint": "^10.8.0",
98
- "globals": "^17.9.0"
97
+ "eslint": "^10.13.0",
98
+ "globals": "^17.13.0"
99
99
  }
100
100
  }
package/readme.md CHANGED
@@ -207,24 +207,27 @@ npm install masterrecord better-sqlite3 # SQLite
207
207
  MasterRecord includes the following database drivers by default:
208
208
  - `pg@^8.22.0` - PostgreSQL (async)
209
209
  - `mysql2@^3.23.2` - MySQL (async with connection pooling)
210
- - `better-sqlite3@^13.0.2` - SQLite (async API wrapper for consistency)
210
+ - `better-sqlite3@^13.0.3` - SQLite (async API wrapper for consistency)
211
211
 
212
- ### npm v12+ install note (native SQLite build)
212
+ ### npm install-script note (native SQLite build)
213
213
 
214
- `better-sqlite3` is a native module — it runs a `node-gyp` build in its install
215
- script. As of **npm v12**, dependency lifecycle scripts (`preinstall` / `install` /
216
- `postinstall`) are **off by default** (`allowScripts` is opt-in). If you install
217
- MasterRecord with npm v12+ and SQLite fails to load with a "did not self-register"
218
- or missing-binding error, approve the build scripts once:
214
+ npm 12 (and the npm 11.19+ bundled with Node 24.22) **blocks dependency install
215
+ scripts by default** and lists them under `npm install-scripts ls`.
216
+ `better-sqlite3@13` ships prebuilt N-API binaries for macOS, Linux (glibc and musl)
217
+ and Windows on x64 and arm64, so SQLite loads without its install script running and
218
+ there is nothing to approve on those platforms. npm still lists it, because the
219
+ package carries a `binding.gyp`; record the decision once so the notice goes away:
219
220
 
220
221
  ```bash
221
- npm approve-scripts --allow-scripts-pending # review, then approve the trusted build scripts
222
- # commit the resulting allowlist in your package.json
222
+ npm install-scripts deny better-sqlite3 # prebuilt binary is enough
223
+ # or, on a platform with no prebuilt binary (it will compile from source):
224
+ npm install-scripts approve better-sqlite3
223
225
  ```
224
226
 
225
- Older npm (≤11) builds native modules automatically and needs no action. If you
226
- only use MySQL or Postgres, you can drop `better-sqlite3` entirely and this doesn't
227
- apply.
227
+ Either command writes `allowScripts` into your `package.json`; commit it. If SQLite
228
+ fails to load with a "did not self-register" or missing-binding error, you are on a
229
+ platform without a prebuilt binary — approve the script. If you only use MySQL or
230
+ Postgres, you can drop `better-sqlite3` entirely and this doesn't apply.
228
231
 
229
232
  ## Two Patterns: Entity Framework & Active Record
230
233