Skip to content

Commit db49af3

Browse files
committed
feat: expose connection options
1 parent c9c1e24 commit db49af3

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

packages/common/src/client/AbstractPowerSyncDatabase.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ export abstract class AbstractPowerSyncDatabase extends BaseObserver<PowerSyncDB
181181
* Current connection status.
182182
*/
183183
currentStatus: SyncStatus;
184+
connectionOptions: PowerSyncConnectionOptions;
184185

185186
sdkVersion: string;
186187

@@ -514,6 +515,7 @@ export abstract class AbstractPowerSyncDatabase extends BaseObserver<PowerSyncDB
514515
*/
515516
async connect(connector: PowerSyncBackendConnector, options?: PowerSyncConnectionOptions) {
516517
const resolvedOptions: InternalConnectionOptions = options ?? {};
518+
this.connectionOptions = resolvedOptions;
517519
resolvedOptions.serializedSchema = this.schema.toJSON();
518520

519521
return this.connectionManager.connect(connector, resolvedOptions);
@@ -592,6 +594,15 @@ export abstract class AbstractPowerSyncDatabase extends BaseObserver<PowerSyncDB
592594
await this.iterateAsyncListeners(async (cb) => cb.closed?.());
593595
}
594596

597+
/**
598+
* Get the connection options used to connect to the PowerSync backend instance.
599+
*
600+
* @returns The connection options used to connect to the PowerSync backend instance.
601+
*/
602+
getConnectionOptions(): PowerSyncConnectionOptions | null {
603+
return this.connectionOptions ?? null;
604+
}
605+
595606
/**
596607
* Get upload queue size estimate and count.
597608
*/

0 commit comments

Comments
 (0)