11import {
2+ DEFAULT_SYNC_CLIENT_IMPLEMENTATION ,
23 PowerSyncDatabase ,
34 SyncClientImplementation ,
45 WASQLiteVFS ,
@@ -79,7 +80,9 @@ export class NuxtPowerSyncDatabase extends PowerSyncDatabase {
7980 const currentSchemaManager = getCurrentSchemaManager ( )
8081 const schemaManager = currentSchemaManager || this . schemaManager
8182
82- const adapter = this . connectionOptions ?. clientImplementation === SyncClientImplementation . JAVASCRIPT
83+ let adapter : RecordingStorageAdapter | RustClientInterceptor
84+ if ( this . connectionOptions ?. clientImplementation ) {
85+ adapter = this . connectionOptions ?. clientImplementation === SyncClientImplementation . JAVASCRIPT
8386 ? new RecordingStorageAdapter (
8487 ref ( this ) as Ref < PowerSyncDatabase > ,
8588 ref ( schemaManager ) as Ref < DynamicSchemaManager > ,
@@ -89,6 +92,17 @@ export class NuxtPowerSyncDatabase extends PowerSyncDatabase {
8992 new WebRemote ( connector , logger ) ,
9093 ref ( schemaManager ) as Ref < DynamicSchemaManager > ,
9194 )
95+ } else {
96+ // @ts -ignore - eventually the default will be Rust
97+ adapter = DEFAULT_SYNC_CLIENT_IMPLEMENTATION === SyncClientImplementation . RUST ? new RustClientInterceptor (
98+ ref ( this ) as Ref < PowerSyncDatabase > ,
99+ new WebRemote ( connector , logger ) ,
100+ ref ( schemaManager ) as Ref < DynamicSchemaManager > ,
101+ ) : new RecordingStorageAdapter (
102+ ref ( this ) as Ref < PowerSyncDatabase > ,
103+ ref ( schemaManager ) as Ref < DynamicSchemaManager > ,
104+ )
105+ }
92106
93107 return new WebStreamingSyncImplementation ( {
94108 adapter,
0 commit comments