Skip to content

Commit 6d76865

Browse files
fix: tighten node engine range for node:sqlite compat (pingdotgg#206) (pingdotgg#1096)
Co-authored-by: Julius Marminge <julius0216@outlook.com>
1 parent 2bb71f4 commit 6d76865

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

apps/server/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
*/
60+
const 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+
5375
const 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

0 commit comments

Comments
 (0)