authorgravatar for 93338119+EtanHey@users.noreply.github.comEtan Heyman <93338119+EtanHey@users.noreply.github.com> 2026-03-15 04:22:56+02:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-03-14 19:22:56-07:00
log6d76865e742e24f93ae2dd3a33fadb90e9ee4e09
tree0d14be72415cff54db4078fd1e13e86ef838b24f
parent2bb71f41c34ef1fc2444901a64242f84601075bc
signature Signed by PGP key B5690EEEBB952194

fix: tighten node engine range for node:sqlite compat (#206) (#1096)

Co-authored-by: Julius Marminge <julius0216@outlook.com>

2 files changed, 25 insertions(+), 1 deletions(-)

apps/server/package.json+1-1
......@@ -44,6 +44,6 @@
4444 "vitest": "catalog:"
4545 },
4646 "engines": {
47 "node": "^22.13 || ^23.4 || >=24.10"
47 "node": "^22.16 || ^23.11 || >=24.10"
4848 }
4949}
apps/server/src/persistence/NodeSqliteClient.ts+24
......@@ -50,11 +50,35 @@ export interface SqliteMemoryClientConfig extends Omit<
5050 "filename" | "readonly"
5151> {}
5252
53/**
54 * Verify that the current Node.js version includes the `node:sqlite` APIs
55 * used by `NodeSqliteClient` — specifically `StatementSync.columns()` (added
56 * in Node 22.16.0 / 23.11.0).
57 *
58 * @see https://github.com/nodejs/node/pull/57490
59 */
60const checkNodeSqliteCompat = () => {
61 const parts = process.versions.node.split(".").map(Number);
62 const major = parts[0] ?? 0;
63 const minor = parts[1] ?? 0;
64 const supported = (major === 22 && minor >= 16) || (major === 23 && minor >= 11) || major >= 24;
65
66 if (!supported) {
67 return Effect.die(
68 `Node.js ${process.versions.node} is missing required node:sqlite APIs ` +
69 `(StatementSync.columns). Upgrade to Node.js >=22.16, >=23.11, or >=24.`,
70 );
71 }
72 return Effect.void;
73};
74
5375const makeWithDatabase = (
5476 options: SqliteClientConfig,
5577 openDatabase: () => DatabaseSync,
5678): Effect.Effect<Client.SqlClient, never, Scope.Scope | Reactivity.Reactivity> =>
5779 Effect.gen(function* () {
80 yield* checkNodeSqliteCompat();
81
5882 const compiler = Statement.makeCompilerSqlite(options.transformQueryNames);
5983 const transformRows = options.transformResultNames
6084 ? Statement.defaultTransforms(options.transformResultNames).array