@@ -35,6 +35,8 @@ import {
3535 type PowerSyncConnectionOptions ,
3636 type RequiredAdditionalConnectionOptions
3737} from './sync/stream/AbstractStreamingSyncImplementation.js' ;
38+ import { TriggerManager } from './triggers/TriggerManager.js' ;
39+ import { TriggerManagerImpl } from './triggers/TriggerManagerImpl.js' ;
3840import { DEFAULT_WATCH_THROTTLE_MS , WatchCompatibleQuery } from './watched/WatchedQuery.js' ;
3941import { OnChangeQueryProcessor } from './watched/processors/OnChangeQueryProcessor.js' ;
4042import { WatchedQueryComparator } from './watched/processors/comparators.js' ;
@@ -191,6 +193,12 @@ export abstract class AbstractPowerSyncDatabase extends BaseObserver<PowerSyncDB
191193
192194 protected runExclusiveMutex : Mutex ;
193195
196+ /**
197+ * @experimental
198+ * Allows creating SQLite triggers which can be used to track various operations on SQLite tables.
199+ */
200+ readonly triggers : TriggerManager ;
201+
194202 logger : ILogger ;
195203
196204 constructor ( options : PowerSyncDatabaseOptionsWithDBAdapter ) ;
@@ -226,6 +234,7 @@ export abstract class AbstractPowerSyncDatabase extends BaseObserver<PowerSyncDB
226234 this . ready = false ;
227235 this . sdkVersion = '' ;
228236 this . runExclusiveMutex = new Mutex ( ) ;
237+
229238 // Start async init
230239 this . connectionManager = new ConnectionManager ( {
231240 createSyncImplementation : async ( connector , options ) => {
@@ -252,7 +261,13 @@ export abstract class AbstractPowerSyncDatabase extends BaseObserver<PowerSyncDB
252261 } ,
253262 logger : this . logger
254263 } ) ;
264+
255265 this . _isReadyPromise = this . initialize ( ) ;
266+
267+ this . triggers = new TriggerManagerImpl ( {
268+ db : this ,
269+ schema : this . schema
270+ } ) ;
256271 }
257272
258273 /**
0 commit comments