1- import BetterSQLite3Database , { Database } from 'better-sqlite3' ;
1+ import BetterSQLite3Database , { Database } from '@powersync/ better-sqlite3' ;
22import * as Comlink from 'comlink' ;
3- import { MessagePort , parentPort , threadId } from 'node:worker_threads' ;
3+ import { parentPort , threadId } from 'node:worker_threads' ;
44import OS from 'node:os' ;
55import url from 'node:url' ;
66import { AsyncDatabase , AsyncDatabaseOpener } from './AsyncDatabase.js' ;
@@ -24,19 +24,19 @@ class BlockingAsyncDatabase implements AsyncDatabase {
2424 }
2525
2626 installUpdateHooks ( ) {
27- this . db . updateHook ( ( _op : string , _dbName : string , tableName : string , _rowid : bigint ) => {
27+ ( this . db as any ) . updateHook ( ( _op : string , _dbName : string , tableName : string , _rowid : bigint ) => {
2828 this . uncommittedUpdatedTables . add ( tableName ) ;
2929 } ) ;
3030
31- this . db . commitHook ( ( ) => {
31+ ( this . db as any ) . commitHook ( ( ) => {
3232 for ( const tableName of this . uncommittedUpdatedTables ) {
3333 this . committedUpdatedTables . add ( tableName ) ;
3434 }
3535 this . uncommittedUpdatedTables . clear ( ) ;
3636 return true ;
3737 } ) ;
3838
39- this . db . rollbackHook ( ( ) => {
39+ ( this . db as any ) . rollbackHook ( ( ) => {
4040 this . uncommittedUpdatedTables . clear ( ) ;
4141 } ) ;
4242 }
@@ -110,7 +110,7 @@ const loadExtension = (db: Database) => {
110110 }
111111
112112 const resolved = url . fileURLToPath ( new URL ( `../${ extensionPath } ` , import . meta. url ) ) ;
113- db . loadExtension ( resolved , 'sqlite3_powersync_init' ) ;
113+ ( db as any ) . loadExtension ( resolved , 'sqlite3_powersync_init' ) ;
114114} ;
115115
116116Comlink . expose ( new BetterSqliteWorker ( ) , parentPort ! as Comlink . Endpoint ) ;
0 commit comments