@@ -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+
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
0 commit comments